>
> >
> > > Would it be so wrong to wedge cpan into the module loader so that
> > > if you use Some::Module and it doesn't exist perl can download and
> > > install to /tmp the missing modules . Obviously this isn't going
> > > to be good for production but it could be enabled by a pragma i.e
> > > use clusterfuck
> >
> > It would be *terribly* wrong, but this'll get you started ...
> >
> > package autocpan;
> > ...
>
> This wheel has already been invented several times before:
> CPAN::AutoINC, Module::AutoINC, with Acme::RemoteINC as an
> intriguingly daft alternative.
>


Thanks for the pointers.

On a kind of related note (things getting sucked into your coding
environment) I'm having fun with applying the anti-pattern of GOD objects in
Moose.

I know it's 'wrong' to have a mega-God object that does everything - but
being able to build attributes lazily in Moose has opened up a new
opportunity to hang stuff off a generic object - when you need it.

So for example all these things just magically become available when needed
by any object[1]:

$self->cache             # connect to the memcache
$self->db                  # grab a DBIx::Simple object
$self->log                 # Log::Dispatch
$self->timer              # time the life of an object
$self->config             # application settings
$self->res                 # web response
$self->req                 # web request
   ...
$self->app_specific_stuff_too

The only downside is when I need to put an object into the memcache - I
sometimes need to jettison stuff in the interests of space - but apart from
that this is making my life a lot  easier [2].

Nige

[1] A kind of poor man's inversion of control (IOC) framework
[2] Seeing glimmers of light at the end of the Moosification tunnel  ;-)
_______________________________________________
BristolBathPM mailing list
[email protected]
http://mailman.bristolbath.org/mailman/listinfo/bristolbathpm

Reply via email to