Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Running Perl standalone, e.g. from a USB key

by TheFluffyOne (Beadle)
on Sep 06, 2006 at 11:59 UTC ( #571427=perlquestion: print w/ replies, xml ) Need Help??
TheFluffyOne has asked for the wisdom of the Perl Monks concerning the following question:

For reasons best known to myself and my neighbour's cat, I'd really like to have a version of Win32 Perl on my USB key that I can use to develop and run scripts without installing ActiveState on a machine.

I'm aware of various tools to convert scripts to standalone executables, but since I want to be able to develop and test new scripts these aren't ideal.

Has someone done the work already, or am I looking at doing some custom-compiling of the Perl source here?

Comment on Running Perl standalone, e.g. from a USB key
Re: Running Perl standalone, e.g. from a USB key
by davidrw (Prior) on Sep 06, 2006 at 12:06 UTC
      Thank you davidrw. I failed to find that in my searches -- probably because of my use of "standalone" instead of "portable", and "key" instead of "thumbdrive"!
      Thanks to everyone for their comments. A few days ago I wasn't aware of a single portable version of Perl and now I have more options than I know what to do with!

      The immediate problem I had was solved with TinyPerl as I needed to do some simple pinging and executable launching. That was very messy in Windows batch script and nice and simple in Perl.

      Next I need to figure out which of these variants will get pride of place on the USB key. Given that I have plenty of free space I wonder if I could fit all of them on there... :)

Re: Running Perl standalone, e.g. from a USB key
by xdg (Monsignor) on Sep 06, 2006 at 16:27 UTC
    Has someone done the work already

    Sort of. To create Vanilla/Strawberry Perl, I use Perl::Dist::Strawberry, which uses Perl::Dist::Builder. The latter badly needs a re-write -- which is high on my list of "to-do" as soon as I have time. However, in the meantime, it may work for you, like this:

    1. Install some sort of Perl on your Win32 machine. (ActiveState or Strawberry, most likely.)

    2. Download and install Perl::Dist::Strawberry (and dependencies). Right now, that's an annoying process of CPAN install to get dependencies and then download the tarball again separately into a working directory. Change into that directory.

    3. Edit strawberry.yml and change the image_dir parameter to the drive/path of your desired USB key perl. E.g.

      image_dir: e:\thumb-perl

      Note -- you may want to force your USB key to a high drive letter and always use that. Until we have "relocatable perl" (hopefully the next release), the hard-coded directories during compilation are used for @INC. That means that compiling to e:\thumb-perl and then mounting the key somewhere else as g:\thumb-perl probably won't work.

    4. Set your environment variables to take defaults and skip some testing:

    5. Run "perl bin\"

    6. Wait for all the various Strawberry Perl binaries and Perl sources to download, install, compile, etc.

    No guaranteees that will work -- each Strawberry Perl build still has an element of hope/prayer to it. But I wish you luck.


    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

      if you always want to have the same path, you could also use subst (CMD command).For example:
      subst <usbdriveletter>:\myportablesoftware v:
      like that you could "remount" a directory as an drive letter. If you pick a higher drive letter it's likely that it never will be taken. If you configure your software for v: it will always work, you'll only have to call subst with a correct directory before trying to execute the scripts.
Re: Running Perl standalone, e.g. from a USB key
by planetscape (Canon) on Sep 07, 2006 at 16:33 UTC
      On URL: Check "Minimal Perl" Win32 binary (560 Kb) Installed: ~1 Mb I copied perl and Dll in a directory and it works ... may be that is what you are looking for !!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://571427]
Approved by davidrw
Front-paged by grinder
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (13)
As of 2014-09-22 12:19 GMT
Find Nodes?
    Voting Booth?

    How do you remember the number of days in each month?

    Results (191 votes), past polls