Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

RFC: Perl-onna-Stick

by Bloodrage (Monk)
on Feb 26, 2008 at 03:33 UTC ( [id://670212]=perlmeditation: print w/replies, xml ) Need Help??

Ave sodales ab camelus

I like UltraEdit321 it's nice. I like it for hacking about with Perl, ECMAScript2, XML, CSS, and XHTML... and I suppose plain text too. At the same time as purchasing it, I wanted to be able to continue my hackery at work (where I don't have install privilages) so I thought about running it off a flash drive... then I saw this. I pondered this briefly and purchased the UltraEdit/UE3 bundle, and a 4GB U3 flash drive (and a 2BG U3 Flash drive to bribe Her, which she likes very much). This works very very well.

Shortly afterwards I found Command Prompt Portable U3 and it occured to me "If I can fire up a command prompt off my flash drive, can I make Perl run off it too? Then I'd have a Perl dev-suite in my pocket. That would be cool."

The plan was simple;

  1. Install Command Prompt Portable U3 onto my stick, and run it once to finalise the installation.
  2. Do a fresh Strawberry Perl3 install (download from here)
  3. Copy the installation to the flash drive
  4. Edit the environment variables set in commandprompt.bat to include the new Perl directory, before any existing paths. Something like this:
    echo Setting Path to Strawberry Perl set STRAWBERRY=%U3_DEVICE_PATH%\strawberry path %STRAWBERRY%\c\bin;%STRAWBERRY%\perl\bin;%PATH% set LIB=%STRAWBERRY%\c\lib;%STRAWBERRY%\perl\bin;%LIB% set INCLUDE=%STRAWBERRY%\c\include;%STRAWBERRY%\perl\lib\CORE;%INCLUDE +% set PKG_CONFIG_PATH=%STRAWBERRY%\lib\pkgconfig
  5. Bingo! Portable command prompt with Perl

Actually it was as simple as that. Perl mostly worked.

What didn't work was installing things with CPAN... especially things that needed C++ complied. The first bit was fixed with a Perl program that was run on opening the command prompt (see this meditation on Changing Perl Config settings). This also partially solved the compiling problem (to some degree, still can't compile GTK2-perl4), but I'll probably meditate on that in another thread.

Following the instructions randyk has given here adds PPM, XML::Parser, eXpat and SOAP to the Strawberry Perl installation, giving my stick working PPM installs, and this line ppm set build %STRAWBERRY%\ppm is added to commandprompt.bat5 to set up a working directory for PPM (you may have to create it manually first).

So far it's been working very well (except for C++ compiling) and I prefer it now to my own computer's installation of Perl (ActiveState 64bit actually). I have noted the following issues:

  • Windows sometimes randomly chooses to recognise file ownership or something and won't let the script update the config files. Restore the originals and restart the command prompt and it works again.
  • cpan sometimes leaves it's lockfile locked and can't reset it. Delete it and try again and it's fine.
  • Any CPAN configurations in your C:\Documents and Settings\Username\Local Settings\Application Data\.cpan will override the settings elsewhere, including your stick. Delete that too...
  • Using o conf in CPAN will often make the config file unreadable/unwritable to the script. Delete it, restore backup...
  • Using CPAN's autoconfig can be unpredictable. If it shows up the script failed. Fix whatever caused that first. ...you might also consider restoring those backups too...
  • Flattening the include libraries doesn't help with the compiling. Mostly it seems to be Makefile or Makefile.PL that have shell components that fail... or more likely dependencies I don't have. At least you don't have to restore the backed up config files.

This tells me I need to make a roll-back script that restores those config.pm.orig files I carefully backed up and removes the cpan lock file, and I need to carefully put together my compile libraries.

Do any other Perl Monks have any further suggestions or comments for this project?

Updated:Incorporated material from comments.

1Damn. I just noticed that the new version is out. With added nifty, like useing regexes to do search and replace within your documents. Sigh, so many features to ignore...

2I despise the JavaScript misnomer. Stop it. You too can help stamp out confusion.

3I chose Strawberry Perl because it includes minGW (a compiler) and a significant subset of the GNU libraries already compiled for Windows. I suspect ActivePerl will also work.

4I want to do graphics, I've chosen the GTK2 library because it's fairly straight forward, it utilises Cairo, it can also render to image files and SVG, and it would make my programs simpler to implement in other operating systems. Using Win32::GUI would tie my work to Windows.

5as noted here by syphilis

PS Semi-final rewrite. Will probably add some more to it later.

If all else fails the Command Prompt U3 can be found on RapidShare too.

Replies are listed 'Best First'.
Re: RFC: Perl-onna-Stick
by jepri (Parson) on Feb 26, 2008 at 21:35 UTC
    I've been wanting something like this for a long time. The last time I tooled around with Strawberry Perl I couldn't get many modules to install, looks like that situation has improved. I'll definitely give this a twirl.

    I gave up on Gtk2 a long time ago - difficult to install, difficult to work with :( I went with Prima instead and have been very pleased.

    ___________________
    Jeremy
    Bots of the disorder.

      With the reconfigure program CPAN installs modules that have no, or small amounts, C++ compiling required. That's not quite true, it installs those modules that only require the libraries that are already installed with the minGW distribution included in Strawberry Perl. So the comliling and linking could be extensive, but has to stay within these 'standard' libraries.

      It also has problems with modules that have non-standard Makefile.PL scripts, especially ones that need extra command line arguments or hard coded file locations (eg. XML::Parser looks for eXpat in a version specific location on the C: drive, or requires flags passed to dmake). I also need to figure out if I need to incorporate the libraries from the Windows Platform SDK or Visual Studio (indications say yes).

        Hmmm, for a while I've been wanting a mega-distribution of perl for windows, with all the popular libraries and whatnot bundled. I hate having to compile libraries over and over again.

        Heh, perl used to be described as huge and bloated. But now the world has changed and Perl is one of the smaller serious languages. An all-in-one bundle would take up a bit of room, but it's a reasonable proposition - a Java install is 100+ Mb and I don't think perl runs to that.

        I've got a bit of free time, I might see what I can come up with.

        ___________________
        Jeremy
        Bots of the disorder.

      Installing Gtk2 etc. isn't a problem thanks to the nifty Glade/GTK+ project on SourceForge. No compiling needed there. It's specifically with compiling the Perl modules Gtk2 and Glib that provide Perl with interfaces with Gtk2.
Re: RFC: Perl-onna-Stick
by syphilis (Archbishop) on Feb 28, 2008 at 08:13 UTC
    but it fails to compile even after explicitly giving a path to eXpat

    Yes - the Makefile.PL is not the best. I think that if you build XML::Parser the old fashioned way and begin with perl Makefile.PL EXPATLIBPATH=/home/me/lib EXPATINCPATH=/home/me/include it will work - though you may have to change (in the Makefile.PL) die <<'Expat_Not_Installed;'; to warn <<'Expat_Not_Installed;';. (I can't remember - perhaps that change only needs to be made if you build XML::Parser using CPAN.pm.)

    I suspect ActivePerl will also work

    Yes - should work. Interestingly enough, ActivePerl now works seamlessly with MinGW (and has done for a while) - and it comes with PPM already installed. This (imo) gives ActivePerl a slight edge over Strawberry Perl, at the moment. I'm hoping that future versions of Strawberry Perl will ship with both XML::Parser and the non-proprietary (CPAN) version of PPM pre-installed. That would (imo) definitely make Strawberry the more attractive option.

    Cheers,
    Rob
Re: RFC: Perl-onna-Stick
by technojosh (Priest) on Feb 26, 2008 at 22:29 UTC
    It seemed like there was quite the fuss for a while about the U3 stuff on portable USB drives...how it took up space on a storage device and most people didn't use it anyway. I actually like being able to carry portable apps along with my storage device...

    I had pondered if something like this was even possible a few months back and shyed away, and what you've worked on so far looks very cool!

      IMHO if they didn't want to use some space for portable applications, why did they buy a U3 stick? There are plenty of just-storage flash drives out there. Just because a product doesn't suit you, does not imply it doesn't suit other people, or that they might actually value those features you don't use.

      It looks like a complete Perl + compiler install will be around 300MB, just Perl would be less. I'm not going to package it for U3, as compressing and uncompressing at runtime would break the plug-in-and-Perl utility I've created.

Re: RFC: Perl-onna-Stick
by TGI (Parson) on Feb 27, 2008 at 20:24 UTC

    First, thank you for working on this. Perl-On-A-Stick will be very handy. It's a great idea. Good luck!

    Does the U3 command prompt require a U3 flash drive?

    Would it be possible to use the PortableApps.com command prompt instead?

    I haven't used either PA.com or U3, so I am not sure about the relative merits, other than PA.com is open source, while U3 is proprietary. I've been meaning to investigate this stuff further, but I've been rather busy on other projects. Sadly, it seems all my tuits are square these days. In any case, you may wish to consider PA.com, unless you already have and chose U3 due to it's technical brilliace, or beautiful logo or whatever. For all I know, it may even be trivial to accomodate either command prompt.

    Anyhow, thanks for pursuing this and good luck getting it working.


    TGI says moo

      I chose U3 because there was a U3 version of UltraEdit. It would seem that I'm an UltraEdit whore and every post seems to be about UltraEdit. UltraEdit UltraEdit UltraEdit. Then some bugger goes asks me questions that make me bang on and on about UltraEdit :)

      ...Yup. UltraEdit U3 is why.

      I didn't find portable apps until after U3, but I'm certain that exactly the same methods could be applied.


      Actually I prefer Eclipse, but I like Windows XP 64-bit edition more, and they don't get along. UltraEdit works and behaves consistantly on all versions of Windows.

Re: RFC: Perl-onna-Stick
by Bloodrage (Monk) on Feb 29, 2008 at 09:08 UTC

    This has been working fine and I've these additional discoveries to share:

    • Windows sometimes randomly chooses to recognise file ownership or something and won't let the script update the config files. Restore the originals and restart the command prompt and it works again.
    • cpan sometimes leaves it's lockfile locked and can't reset it. Delete it and try again and it's fine.
    • Any CPAN configurations in your C:\Documents and Settings\Username\Local Settings\Application Data\.cpan will override the settings elsewhere, including your stick. Delete that too...
    • Using o conf in CPAN will often make the config file unreadable/unwritable to the script. Delete it, restore backup...
    • Using CPAN's autoconfig can be unpredictable. If it shows up the script failed. Fix whatever caused that first. ...you might also consider restoring those backups too...
    • Flattening the include libraries doesn't help with the compiling. Mostly it seems to be Makefile or Makefile.PL that have shell components that fail... or more likely dependencies I don't have. At least you don't have to restore the backed up config files.

    This tells me I need to make a roll-back script that restores those config.pm.orig files I carefully backed up and removes the cpan lock file, and I need to carefully put together my compile libraries.

Re: RFC: Perl-onna-Stick
by Bloodrage (Monk) on Feb 29, 2008 at 20:58 UTC

    Thankfully randyk has done most of the work for me. This gives me PPM, XML::Parser, eXpat and SOAP! All that needs to be done is running the command ppm set build %U3_DEVICE_PATH%\strawberry\ppm in the commandprompt.bat file (as noted here by syphilis).

    Hmm is crazyinsomniac's PPM Repository still active. I'm getting a lot of 404s on the various links.

    Now I need to figure out how to hack up ppd files so that it doesn't care about OS and Perl versions (quite so much) because of the portable nature of the stick I may need to mangle the ppd files regularly to overcome Windows inconsistancies.

    Update: Yup, just edit the ppd file and update <ARCHITECTURE NAME="MSWin32-x86-multi-thread-5.8" /> to <ARCHITECTURE NAME="MSWin32-x86-multi-thread-5.10" /> and those ppd modules install. They even install into the Perl-onna-Stick and not the version installed on the host machine! Have to download and unpack the PPM package tarballs manually, but that's a minor irritation. I now have Gtk2 and Glib! Doh! make that I have Gtk2 and Glib that whine about perl58.dll not being available. Need to find Perl 5.10 PPM files.


    can do search me!

Re: RFC: Perl-onna-Stick
by benizi (Hermit) on Feb 28, 2008 at 03:31 UTC

    The strawberryperl.com site that you linked to is irritatingly lacking in both content and context (very little in the way of explanation, and zero(!) external links). Thought I'd save someone the trouble of googling it. It's part of the Vanilla Perl project, which aims to provide a Win32 Perl with a bundled compiler. Strawberry Perl extends Vanilla Perl to include a functioning Bundle::CPAN, and adds Win32-specific fixes.

Re: RFC: Perl-onna-Stick
by krishnoid (Novice) on Sep 07, 2009 at 23:48 UTC
    I pondered this briefly and purchased the UltraEdit/UE3 bundle,

    UltraEdit32 just released a PortableApps.com compatible version; you might ask them if you can trade your U3 version for one that integrates with the PortableApps.com suite and launcher if you prefer that. I talked to the PortableApps.com lead at OSCON and he specifically mentioned UltraEdit32 as one of the partners for PortableApps.com's commercial launch.

Re: RFC: Perl-onna-Stick
by Bloodrage (Monk) on Apr 18, 2008 at 10:50 UTC

    This works for Strawberry Perl 5.10.0.1... actually it works better. You do have to remember to create all the directory structures first.

    OTOH I now hate Gtk2 :P


    In other news: I have a Perl job starting soon, no doubt I'll be posting all my problems here soon.

Re: RFC: Perl-onna-Stick
by Anonymous Monk on Apr 07, 2008 at 23:20 UTC
    There's a little bit more to it than just those things. Have a look at Vanilla 16 for some more tricks to get a bit closer to Perl on a Stick. Suffice it to say I am paying attention to this issue, as it is something I want myself. For July Strawberry we may be closer to a good solution. Adam K
Re: RFC: Perl-onna-Stick
by Anonymous Monk on Apr 10, 2008 at 16:06 UTC
    Your command prompt link is out-dated... http://www.u3applications.net/utilities/command_prompt_portable_u3.html Enjoy :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://670212]
Approved by wfsp
Front-paged by wfsp
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-12-02 17:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found