in reply to How can I do with only Standard Perl Distribution

There is another approach you can take. If you can create files in just a single directory you can still use CPAN modules. Adding this code:

BEGIN { unshift @INC,'/home/fred/sc'; }

To the start of your script will allow you to use any Pure Perl CPAN modules (.pm files) that have been copied into the named directory. If the CPAN modules have shared binary libraries (dll or so) then you will need to mess with either $ENV{PATH} or $ENV{LD_LIBRARY_PATH}.

If you can only use a single script file you can still use CPAN modules by appending them to the script (obviously before any data and it is usually best to enclose each "file" in curly braces).

The least good (but still workable) option is to read the CPAN module and "borrow" the routines into your script.

It is almost always a better plan to use CPAN modules rather than attempt to rewrite from scratch

Replies are listed 'Best First'.
Re^2: How can I do with only Standard Perl Distribution
by dragonchild (Archbishop) on Jan 19, 2006 at 14:21 UTC
    use lib '/home/fred/sc';
    Not only is that much friendlier to the user, it also handles a number of possible cross-platform issues for you.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
      Even better, in my opinion, for a self-contained script or application:
      use FindBin qw(); use lib "$FindBin::Bin/../lib";