[Catalyst] Connect DBIx::Class model on startup?

will trillich will.trillich at serensoft.com
Mon Mar 5 04:23:28 GMT 2012


On Sun, Mar 4, 2012 at 8:30 PM, Daniel J. Luke <dluke at geeklair.net> wrote:

> >>>> MyApp->model('DB')->schema->dbh->ping; # Check we have a DB
> connection that's working straight after forking but before starting to
> handle requests.
> >>
> >> Maybe I'm being thick, but where does that instance of MyApp come from?
> I don't see it being passed into FCGI::ProcManager
> >
> > What instance of MyApp?
>

MyApp->method() is a direct reference to the original package, not to an
instance.

my $myapp =3D MyApp->instantiate() would be an instance, if you had such a
method to call.

   use MyApp;
   MyApp->something();

MyApp has been included as a library, so now you can call it appropriately.
There's *no instance* in this case...


> the one that I'm going to call ->model() on in order to pre-connect to my
> DB?
>
> > There is no instance?
>
>
> Then there's some magic that I'm missing? If I take your code literally,
> I'm going to get a 'cannot use a string as a hash ref' error.
>
> --
> Daniel J. Luke
> +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D+
> | *---------------- dluke at geeklair.net ----------------* |
> | *-------------- http://www.geeklair.net -------------* |
> +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D+
> |   Opinions expressed are mine and do not necessarily   |
> |          reflect the opinions of my employer.          |
> +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D+
>
>
>
>
> _______________________________________________
> 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/
>



-- =

"We act as though comfort and luxury were the chief requirements of life,
when all that we need to make us happy is something to be enthusiastic
about." -- Albert Einstein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120304/8ad5e=
427/attachment.htm


More information about the Catalyst mailing list