On Wed, Mar 11, 2009 at 05:48:45PM +0000, Amias Channer wrote:

> 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;
  push @INC, sub {
      local @INC = grep { !ref($_) } @INC;
      my $filename = $_[1];
      $filename =~ s/\.pm$//;
      $filename =~ s/\//::/g;

      eval 'use CPAN';
      CPAN::install("$filename") && eval "use $filename";
  };

-- 
David Cantrell | Official London Perl Mongers Bad Influence

      You know you're getting old when you fancy the
      teenager's parent and ignore the teenager
        -- Paul M in uknot
_______________________________________________
BristolBathPM mailing list
[email protected]
http://mailman.bristolbath.org/mailman/listinfo/bristolbathpm

Reply via email to