Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Newbie: Perl script to Windows and Linux executable versions. (http://www.velocityreviews.com/forums/t911401-newbie-perl-script-to-windows-and-linux-executable-versions.html)

Harry 09-18-2009 03:17 PM

Newbie: Perl script to Windows and Linux executable versions.
 
Hey folks,

I have a perl script that I'd like to be able to run on Windows and
Linux. Is this easily possible?

Here's what I've tried so far... unsuccessfully!

I've tried to install PAR::Packer from CPAN. After having successfully
installed all its dependencies manually, I discovered that I couldn't
install PAR::Packer itself. I got the message:
Can't locate ExtUtils/Embed.pm in @INC ...

I then tried installing ExtUtils/Embed.pm from CPAN. Couldn't. This is
what I got:
CPAN.pm: Going to build D/DO/DOUGM/ExtUtils-Embed-1.14.tar.gz
Writing files for ExtUtils::Embed tests...
Can't locate ExtUtils/Embed.pm in @INC (@INC contains:

Not sure what the current recommended method is in the community for
what I'm trying to do. I'm looking for a 100% free/opensource
solution. Perl2Exe works but only on Windows and with an irritating a
few seconds delay on each invocation.

Regards,
/HS

Jürgen Exner 09-18-2009 03:55 PM

Re: Newbie: Perl script to Windows and Linux executable versions.
 
Harry <simonsharry@gmail.com> wrote:
>I have a perl script that I'd like to be able to run on Windows and
>Linux. Is this easily possible?


Yes, it is. See "perldoc perlport" for hints about which OS-specific
functions and features to avoid.
Basically you need to watch out for the different representations for
newline and of course using system() or file system specific features is
a no-no.
For some areas like parallel programming, process control, networking,
etc. it can become tricky, too.

>Here's what I've tried so far... unsuccessfully!


>I've tried to install PAR::Packer from CPAN.


Why? It has nothing to do with writing cross-platform code.

>Not sure what the current recommended method is in the community for
>what I'm trying to do. I'm looking for a 100% free/opensource
>solution.


Again, see the FAQ I mentioned above.

>Perl2Exe works but only on Windows and with an irritating a
>few seconds delay on each invocation.


Again, why? It has nothing to do with portable code.

jue

Harry 09-18-2009 03:57 PM

Re: Newbie: Perl script to Windows and Linux executable versions.
 
On Sep 18, 8:17*pm, Harry <simonsha...@gmail.com> wrote:
> Hey folks,
>
> I have a perl script that I'd like to be able to run on Windows and
> Linux. Is this easily possible?
>
> Here's what I've tried so far... unsuccessfully!
>
> I've tried to install PAR::Packer from CPAN. After having successfully
> installed all its dependencies manually, I discovered that I couldn't
> install PAR::Packer itself. I got the message:
> * * Can't locate ExtUtils/Embed.pm in @INC ...
>
> I then tried installing ExtUtils/Embed.pm from CPAN. Couldn't. This is
> what I got:
> * * * CPAN.pm: Going to build D/DO/DOUGM/ExtUtils-Embed-1.14.tar.gz
> * Writing files for ExtUtils::Embed tests...
> * Can't locate ExtUtils/Embed.pm in @INC (@INC contains:
>
> Not sure what the current recommended method is in the community for
> what I'm trying to do. I'm looking for a 100% free/opensource
> solution. Perl2Exe works but only on Windows and with an irritating a
> few seconds delay on each invocation.
>
> Regards,
> /HS


Also, I'm a bit surprised that the standard distribution for a great
and mature language like Perl doesn't already come with a tool for
this problem.

RedGrittyBrick 09-18-2009 03:59 PM

Re: Newbie: Perl script to Windows and Linux executable versions.
 

Harry wrote:
>
> I have a perl script that I'd like to be able to run on Windows and
> Linux. Is this easily possible?
>


1) Yes

Save your script in an ASCII file with a .pl filename extension. It
should then run on Linux or Windows.

Obviously the operating system needs runtime support for Perl, but that
isn't a problem for most server/desktop/notebook PC operating systems.
All modern Unix systems and mainstream server/desktop/notebook Linux
distributions will include perl as part of the normal environment. For
any Windows platform you have a choice of installable 3rd-party Perl
runtimes, Activestate Perl for example.


2) No

If you want some sort of single executable that runs, without any
runtime support, on a variety of operating systems (even if they're all
the same x86 architecture) - I can't think of any programming language
where this is possible.

--
RGB

Harry 09-18-2009 04:05 PM

Re: Newbie: Perl script to Windows and Linux executable versions.
 
On Sep 18, 8:55*pm, Jürgen Exner <jurge...@hotmail.com> wrote:
> Harry <simonsha...@gmail.com> wrote:
> >I have a perl script that I'd like to be able to run on Windows and
> >Linux. Is this easily possible?

>
> Yes, it is. See "perldoc perlport" for hints about which OS-specific
> functions and features to avoid.
> Basically you need to watch out for the different representations for
> newline and of course using system() or file system specific features is
> a no-no.
> For some areas like parallel programming, process control, networking,
> etc. it can become tricky, too.
>
> >Here's what I've tried so far... unsuccessfully!
> >I've tried to install PAR::Packer from CPAN.

>
> Why? It has nothing to do with writing cross-platform code.
>
> >Not sure what the current recommended method is in the community for
> >what I'm trying to do. I'm looking for a 100% free/opensource
> >solution.

>
> Again, see the FAQ I mentioned above.
>
> >Perl2Exe works but only on Windows and with an irritating a
> >few seconds delay on each invocation.

>
> Again, why? It has nothing to do with portable code.
>
> jue


Jürgen, sorry if I mis-spoke.
From my already cross-platform Perl script,
1. I want a Windows .EXE file that I could run on a Windows box
without any need for a Perl installation.
2. Likewise, I should be able to have an ELF for the Linux platform.

Thanks for your quick response!

Harry 09-18-2009 04:11 PM

Re: Newbie: Perl script to Windows and Linux executable versions.
 
On Sep 18, 8:59*pm, RedGrittyBrick <RedGrittyBr...@spamweary.invalid>
wrote:
> If you want some sort of single executable that runs, without any
> runtime support, on a variety of operating systems (even if they're all
> the same x86 architecture) - I can't think of any programming language
> where this is possible.


What I want is
an EXE for Windows, and
an ELF for Linux
each of which runs without any dependence on the Perl installation.

Thanks, RGB (for taking the time to write)!

Andrew DeFaria 09-18-2009 04:14 PM

Re: Newbie: Perl script to Windows and Linux executable versions.
 
body { font: Helvetica, Arial, sans-serif; } p { font: Helvetica, Arial, sans-serif; } .standout { font-family: verdana, arial, sans-serif; font-size: 12px; color: #933; line-height: 13px; font-weight: bold; margin-bottom: 10px; } .code { border-top: 1px solid #ddd; border-left: 1px solid #ddd; border-right: 2px solid #000; border-bottom: 2px solid #000; padding: 5px; margin-top: 5px; margin-left: 5%; margin-right: 5%; background: #ffffea; color: black; white-space: pre; font-family: courier; font-size: 12px; -moz-border-radius: 10px; } .terminal { border-top: 10px solid #03f; border-left: 1px solid #ddd; border-right: 2px solid grey; border-bottom: 2px solid grey; padding: 5px; margin-top: 5px; margin-left: 5%; margin-right: 5%; background: black; color: white; white-space: pre; font-family: courier; font-size: 12px; -moz-border-radius: 10px; } blockquote id=cite { margin: 1em 0em 1em 0em !important; padding: .25em .25em 0em .25em !important; border-right: 2px solid blue !important; border-left: 2px solid blue !important; } blockquote blockquote id=cite { margin: 0em .25em .25em .25em !important; padding: 0em .25em .25em .25em !important; border-right: 2px solid maroon !important; border-left: 2px solid maroon !important; } blockquote blockquote blockquote id=cite { border-right: 2px solid teal !important; border-left: 2px solid teal !important; } blockquote blockquote blockquote blockquote id=cite { border-right: 2px solid purple !important; border-left: 2px solid purple !important; } blockquote blockquote blockquote blockquote blockquote id=cite { border-right: 2px solid green !important; border-left: 2px solid green !important; } Harry wrote: On Sep 18, 8:59Â*pm, RedGrittyBrick &lt;RedGrittyBr...@spamweary.invalid&gt;
wrote:
If you want some sort of single executable that runs, without any runtime support, on a variety of operating systems (even if they're all the same x86 architecture) - I can't think of any programming language where this is possible.
What I want is
an EXE for Windows, and
an ELF for Linux
each of which runs without any dependence on the Perl installation.

Thanks, RGB (for taking the time to write)!
And I want a car that runs on seawater. Neither will happen in our lifetimes...


--
Andrew DeFaria
You never really learn to swear until you learn to drive.


Jürgen Exner 09-18-2009 04:14 PM

Re: Newbie: Perl script to Windows and Linux executable versions.
 
Harry <simonsharry@gmail.com> wrote:
>From my already cross-platform Perl script,
>1. I want a Windows .EXE file that I could run on a Windows box
>without any need for a Perl installation.
>2. Likewise, I should be able to have an ELF for the Linux platform.


Well, if you need binaries, then Perl may not have been the best choice.
IMO all tools that create self-containd executable from Perl scripts are
crutches at best and don't work all that well.

jue

RedGrittyBrick 09-18-2009 04:15 PM

Re: Newbie: Perl script to Windows and Linux executable versions.
 

Harry wrote:
> On Sep 18, 8:17 pm, Harry <simonsha...@gmail.com> wrote:
>> Hey folks,
>>
>> I have a perl script that I'd like to be able to run on Windows and
>> Linux. Is this easily possible?
>>
>> Here's what I've tried so far... unsuccessfully!
>>
>> I've tried to install PAR::Packer from CPAN. After having successfully
>> installed all its dependencies manually, I discovered that I couldn't
>> install PAR::Packer itself. I got the message:
>> Can't locate ExtUtils/Embed.pm in @INC ...


Doesn't that mean that you have *not* installed all the dependencies? Or
at least, not in the right places? Did you install ExtUtils::Embed?
Isn't that one of the standard modules? What Perl versions are you using
(perl -v)?


>>
>> I then tried installing ExtUtils/Embed.pm from CPAN. Couldn't. This is
>> what I got:
>> CPAN.pm: Going to build D/DO/DOUGM/ExtUtils-Embed-1.14.tar.gz
>> Writing files for ExtUtils::Embed tests...
>> Can't locate ExtUtils/Embed.pm in @INC (@INC contains:
>>
>> Not sure what the current recommended method is in the community for
>> what I'm trying to do. I'm looking for a 100% free/opensource
>> solution. Perl2Exe works but only on Windows and with an irritating a
>> few seconds delay on each invocation.
>>

>
> Also, I'm a bit surprised that the standard distribution for a great
> and mature language like Perl doesn't already come with a tool for
> this problem.


I don't find it a problem! I use the same .pl files in Windows and Linux
(so long as they don't use OS-specific features/resources)

I'm a bit confused about what you want. Do you want two separate files,
one for Windows and one for Linux, where each file can be installed
(how? self installer?) and run without first installing Perl and it's
normal collection of standard modules? Why? Do you want to avoid
explicitly installing perl? Is there some reason you can install you
program but not perl?

--
RGB

Jürgen Exner 09-18-2009 04:17 PM

Re: Newbie: Perl script to Windows and Linux executable versions.
 
Harry <simonsharry@gmail.com> wrote:
>Also, I'm a bit surprised that the standard distribution for a great
>and mature language like Perl doesn't already come with a tool for
>this problem.


Perl is an interpreted language and works very well as such. There are
no compilers to generate executables for tcsh, bash, awk, cmd, ...,
either.

jue


All times are GMT. The time now is 04:37 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.