[Catalyst] how to reuse Catalyst Schema for non-web purposes?

Alexander Hartmaier alexander.hartmaier at t-systems.at
Wed Apr 22 15:10:59 GMT 2009


I have a MyNamespace::Model::DBIC module containing all ResultSet,
ResultSource and Table classes.
This module is a requirement for my Cat apps and is used in the apps
schema:

package MyNamespace::Web::AppName::Schema::AppName;
use base qw/DBIx::Class::Schema/;

# load subclassed tables
__PACKAGE__->load_classes(qw/
    Table3
/);

__PACKAGE__->load_classes({
    'MyNamespace::Model::DBIC::Table' => [qw/
        Table1
        Table2
    /]}
);

1;


--
BR Alex


Am Mittwoch, den 22.04.2009, 16:30 +0200 schrieb Simon Wilcox:
> On 22/4/09 14:52, Matt S Trout wrote:
> > On Wed, Apr 22, 2009 at 02:41:34PM +1000, kakimoto at tpg.com.au wrote:
> >
> >>   I just looked at my app and found that I need to reuse the Schema
> >> files found in my 'Schema' directory.
> >
> > Your DBIC classes aren't connected to the Catalyst app at all.
>
> Unless you've fallen into the trap of putting business logic in your
> Controller classes.
>
> See this as a good opportunity to refactor the logic back into the
> Schema classes where it belongs (or to a set of business objects if that
> suits your application better).
>
> Your code will be better for it :-)
>
> S.
>
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/


*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH   Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*



More information about the Catalyst mailing list