Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Newbie: Perl script to Windows and Linux executable versions.

Reply
Thread Tools

Newbie: Perl script to Windows and Linux executable versions.

 
 
Harry
Guest
Posts: n/a
 
      09-18-2009
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:acker from CPAN. After having successfully
installed all its dependencies manually, I discovered that I couldn't
install PAR:acker 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
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      09-18-2009
Harry <(E-Mail Removed)> 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:acker 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
 
Reply With Quote
 
 
 
 
Harry
Guest
Posts: n/a
 
      09-18-2009
On Sep 18, 8:17*pm, Harry <(E-Mail Removed)> 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:acker from CPAN. After having successfully
> installed all its dependencies manually, I discovered that I couldn't
> install PAR:acker 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.
 
Reply With Quote
 
RedGrittyBrick
Guest
Posts: n/a
 
      09-18-2009

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
 
Reply With Quote
 
Harry
Guest
Posts: n/a
 
      09-18-2009
On Sep 18, 8:55*pm, Jürgen Exner <(E-Mail Removed)> wrote:
> Harry <(E-Mail Removed)> 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:acker 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!
 
Reply With Quote
 
Harry
Guest
Posts: n/a
 
      09-18-2009
On Sep 18, 8:59*pm, RedGrittyBrick <(E-Mail Removed)>
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)!
 
Reply With Quote
 
Andrew DeFaria
Guest
Posts: n/a
 
      09-18-2009
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;(E-Mail Removed)&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.

 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      09-18-2009
Harry <(E-Mail Removed)> 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
 
Reply With Quote
 
RedGrittyBrick
Guest
Posts: n/a
 
      09-18-2009

Harry wrote:
> On Sep 18, 8:17 pm, Harry <(E-Mail Removed)> 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:acker from CPAN. After having successfully
>> installed all its dependencies manually, I discovered that I couldn't
>> install PAR:acker 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
 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      09-18-2009
Harry <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running an Executable Before Executable JAR Jason Cavett Java 8 05-16-2007 07:14 PM
How to make perl script executable from anywhere on windows? veg_all@yahoo.com Perl Misc 2 04-21-2007 04:10 PM
what is fast dynamically linked executable or statically linked executable ?how to decide? pratap C Programming 20 03-07-2007 04:46 AM
How can I run a c executable in pwd ,while the executable is in some other directory vishsid3@gmail.com C Programming 15 08-21-2006 06:04 AM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM



Advertisments