[Dbix-class] How do I make global attribute for schema?

Thomas Klausner domm at cpan.org
Tue Jun 19 09:52:46 GMT 2018


Hi!

On Tue, Jun 19, 2018 at 12:12:20PM +0300, Alex Povolotsky wrote:
 
> Using some web framework, like Mojolicious, I often need to pass, say,
> $app->log into DBIx::Class-related classes.

Don't do that, use Log::Any!

> What is the recommended way to add extra attribute for schema?
> DBIx::Class::Schema by itself does not use Moose, is it safe to add Moose to
> my Schema class?

But in case you want to still merry Moose with DBIx::Class:

https://stackoverflow.com/questions/22483145/how-to-setup-a-dbixclass-schema-with-moose-the-definite-guide

I usually tell DBIx::Class::Schema::Loader to use_moose=>1

(I think I did the first implementation of that feature in 2010...)

Greetings,
domm

-- 
#!/usr/bin/perl                              http://domm.plix.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}



More information about the DBIx-Class mailing list