Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Perl to go.

I dont work in the computer field... Actually, I work in the medical field. However, in my downtime at work I sometimes like to play around with ideas in perl. I have computer access, but no access to install software.

In the past, I have run ssh client from a usb thumbdrive to my computer at home. However, I really didnt like the idea of my password possibly being logged since there is monitoring software.

Well, how about a full perl distribution on a thumbdrive? Talk about portable. I could take my perl, modules, editor and code with me.

Here is what I wanted.

I wanted to be able to insert my thumbdrive click on a shortcut and have cmd prompt pop-up with perl, my editor, and unix utils in my path. Here is what I did to get it working.

The systems I wanted to use this on would be running either windows XP or Windows 2000. Instead of messing with trying to get Activestate to work I compiled perl from the source.

The stuff

First I installed mingw which was used to compile perl. The procedure was quite simple, install the software and add to your path. Next download dmake and add it to your path.

If you dont want to install perl to c:\perl then you need to edit the file makefile.mk. The config file is allready setup to use with mingw right out of the box. Then fire up a cmd shell, and do the following:

c:\src\perl-5.8.7> cd win32 c:\src\perl-5.8.7> dmake c:\src\perl-5.8.7> dmake test c:\src\perl-5.8.7> dmake install

NOTE:
If you install the unix utilities and add to your path beware of the following problem. The unix utilities adds a program called type.exe that will cause errors on the following tests:

  • ../ext/IO/t/io_dup.t
  • comp/multiline.t
  • io/dup.t
This is due to how the tests try to call 'type' using the backticks and invoking the installed type.exe instead of the shell's version. Remove the type.exe from path and you are fine.

Then you just copy over the c:\perl over to your thumbdrive. Perl to go. To save some space you can also delete the html docs.

I also then added the unix utils to the thumbdrive and also the vim editor.

The next problem was how to deal with the drive allways being on a different volume from computer to computer.. One computer it would be drive I: the other e: for example... And how can I set the path to my binaries??

My solution is one batch file and a small perl script.

Batch file: start-cmd.bat

programs\perl\bin\perl.exe src\perl\autostart.pl

Perl file: autostart.pl

use strict; use warnings; use File::Spec; my $cur_dir = File::Spec->curdir(); $cur_dir = File::Spec->rel2abs unless ( File::Spec->file_name_is_absolute($cur_dir) ); my $drive = (File::Spec->splitpath($cur_dir))[0]; $drive .= '\\'; my @paths = ( 'programs\\perl\\bin', 'programs\\bin', 'programs\\dmake', 'programs\\usr\local\wbin' ); my $path = '%PATH%;'; foreach my $item (@paths) { my $tmp = File::Spec->catpath($drive,$item); $path .= File::Spec->canonpath($tmp) . ';'; } my $path_cmd = "set path=$path"; print "Current directory: $cur_dir\n"; print "Current drive: $drive\n"; print "Path to be set: $path_cmd\n"; exec ("cmd.exe /K $path_cmd") or die "Couldn't exec cmd.exe: $!\n";

Tada!!! Now I just double-click on the batch file start-cmd.bat and I have a cmd window with the path set to all of my binaries. No matter what drive it is mapped to I have a nice portable perl development environment to go. :)

zzSPECTREz

In reply to Portable perl: usb thumbdrive by zzspectrez

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (10)
    As of 2014-07-24 12:03 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (160 votes), past polls