[Chicago-talk] Portable Script and library

Jay Strauss me at heyjay.com
Wed Dec 16 19:10:47 PST 2009


thanks Steve,  that seems to work perfect

On Wed, Dec 16, 2009 at 3:27 PM, Steven Lembark <lembark at wrkhors.com> wrote:

> On Wed, 16 Dec 2009 14:44:08 -0600
> Jay Strauss <me at heyjay.com> wrote:
>
> > Hi,
> >
> > I need to build a script, to be able to bring with me from customer to
> > customer site.  I can count on running upon a recent version of Perl
> > (version will change from customer to customer).  I can not install new
> CPAN
> > modules at their site.  (generally I'm on a heavily firewalled production
> > box with no external http/ftp/ip access).   I will be running upon M$
> > primarily.
> >
> > While at the customer I'll need to be able to make changes to the script
> as
> > needed (and as I find needed new features or bugs).
> >
> > I have need for some modules on CPAN like date
>
>
> You can run the thing with
>
>    /path/to/perl your-program
>
> which avoids issues in #! paths (no guarantee they will
> have Perl in the same place you do.
>
> At that point you can create a local directory with:
>
>    ./bin/
>    ./lib/
>    ./t/
>
> directories in it. Put anything you need to take with
> you -- including your own modules -- under ./lib. At
> that point you can start your code with:
>
>    use 5.008;
>    use strict;
>    use FindBin qw( $Bin );
>    use lib "$Bin/../lib';
>
> to include the local library directory:
>
>    cd /blah/blah;
>    /path/to/perl  ./bin/frobnicate 'whatever';
>
> will set $Bin to "/blah/blah/bin" and leave you
> using "/blah/blah/bin/../lib" for your modules.
>
> Anything you need to take with you can be in
> the lib directory.
>
> Add the same thing to your ./t files and you can
> sanity check the thing with "prove" before trying
> to run the remaining code.
>
> --
> Steven Lembark                                            85-09 90th St.
> Workhorse Computing                                 Woodhaven, NY, 11421
> lembark at wrkhors.com                                      +1 888 359 3508
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/chicago-talk/attachments/20091216/7a099c7d/attachment.html>


More information about the Chicago-talk mailing list