Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am using PAR, and several cgi scripts in a folder, my problem is if i want to send my scripts through email and wanted somebody else to open it in another computer. What should I do with the @INC, the module I use in c:/perl/lib and c:/perl/site/lib ?

janitored by ybiC: Retitle from less-than-descriptive "@inc", as one-word nodetitles hinder site search

Replies are listed 'Best First'.
Re: Using @INC with PAR
by nite_man (Deacon) on Aug 03, 2004 at 10:27 UTC

    The better way to create a simple script which will check all dependences and install missing modules:

    my $list_modules = { 'SOAP::Lite' => '0.60', 'Time::Local' => ''}; for my $module (@$list_modules) { eval "use $module $list_modules->{$module}"; if($@) { my $error = $@; $error =~ s/\n(.*)$//s; print "Not found!!!\n"; print "\t$error\n" if $error =~ /this is only/; if($install) { CPAN::Shell->install($module, $list_modules->{ +$module}); } } else { print "Ok\n" } }
    This works correct under Linux (I mean install modules). Maybe you should find another way for Windows if it won't work.

    ---
    Schiller

    It's only my opinion and it doesn't have pretensions of absoluteness!

Re: Using @INC with PAR
by Jaap (Curate) on Aug 03, 2004 at 10:00 UTC
    Do you expect the recipients to have these modules or do you want to mail the modules to them too?
      if I email the module too, will it work? I wouldn't know his/her @INC and he/she might not know how to put in his/her computer @INC

      TQ

        Just include the .pm files in the same directory and inlude the current direcotry "." in @INC. You can use -I like in this example:
        #!/usr/bin/perl -w -I. use MyModule.pm # in the same dir as this script