1

I'm trying to patch a program that checked for a portable version of perl like this:

use Config;
my $is_portable = $Config{userelocatableinc};

This does not work on Strawberry Perl, and thus the program is failing.

I am using Perl 5.20.1, 64-bit:

>perl -V:userelocatableinc
userelocatableinc='undef';

What can I do to find if the current Perl is a portable one, Strawberry or not?

Nate Glenn
  • 6,455
  • 8
  • 52
  • 95
  • When you did your testing, did you use [the portable version of Strawberry Perl](http://strawberryperl.com/releases.html)? – Schwern Feb 08 '15 at 17:53

2 Answers2

2

That's what you do. perl -V:userelocatableinc will tell you if its been built to use relative paths or not.

Strawberry is not built with this option, so its not portable. If you need this support, you'll have to build it yourself, though I understand ActiveState's perl has some hacks to make it portable.

I'd consider raising a ticket with Strawberry guys and seeing if they should add this option to their build.

gbjbaanb
  • 51,617
  • 12
  • 104
  • 148
  • Darn. I guess I'll do that. – Nate Glenn Oct 13 '14 at 11:55
  • @gbjbaanb - are you sure, because there's a "portable" version in the sense of unzip it and go. – Richard Huxton Oct 13 '14 at 14:37
  • 1
    @RichardHuxton AFAIK the portability is about some paths that are absolute, building perl with the special config tells it to use relative paths. That's what makes it portable in this case, not the ability to put the binary on a zip drive. It appears Strawberry perl isn't built this way so 2 different versions of perl will conflict with each other. (or so I understand it) – gbjbaanb Oct 13 '14 at 15:01
-1

This worked for me:

print "I'm portable" if eval 'require Portable';

Portable Strawberry Perl comes with Portable.pm in the vendor directory which augments File::Homedir, among others.

Nate Glenn
  • 6,455
  • 8
  • 52
  • 95
  • Portable is a particular module to implement portable applications. It does not generally indicate if the Perl executable is relocatable. – Schwern Feb 08 '15 at 07:08
  • @schwern Just my luck that Metacpan search would be down when I check for `Portable` on it. How about if I did 'use File::Homedir; exists $INC{'Portable.pm'};"? Strawberry portable has a vendor lib version of File::HomeDir which loads Portable. Even if it's not necessarily Strawberry portable, it still says that your core modules have been tweaked to be portable. – Nate Glenn Feb 08 '15 at 10:05
  • Your question is whether or not a given Perl installation can be moved. Neither Portable nor File::HomeDir ship with Perl, I think this is a Strawberry Perl only thing. – Schwern Feb 08 '15 at 17:51