David Storrs wrote:
#!/usr/bin/perl6

#use warnings;  # Note that I am NOT explicitly using these
#use strict;

{   no 'warnings'; no 'strict';   # These must be explicitly turned off...
    no installation_security;     # or this would throw warning & error

use SomeModule; #
use OtherModule; # use Foo; # If these are not installed,
use Bar; # they will be auto-installed.
use Baz; #
use Jaz; #
}


use FrobNitz;           # If this is not installed, the script fails.

<script goes here>

__END__

This is really something you want to enable or disable per-run, IMHO (so e.g. the first time you run the script, you run it with "perl -Minstall" or something). Or you could just make it part of the 'cpan' program:


    brent:~$ wget www.somesite.com/somescript.cgi.gz
    brent:~$ gunzip somescript.cgi.gz
    brent:~$ cpan --prereqs=somescript.cgi
    brent:~$ cp somescript.cgi /www/cgi-bin
    brent:~$ chmod 755 /www/cgi-bin/somescript.cgi
    # somescript.cgi is now ready for use

This would require 'cpan' to parse the script with a modified grammar that noted all the 'use's (and 'require's, I guess), then install each module. Or something like that.

Hmm...maybe this could be done for Perl 5...

--
Brent "Dax" Royal-Gordon <[EMAIL PROTECTED]>
Perl and Parrot hacker

Oceania has always been at war with Eastasia.

Reply via email to