Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Perl scripts for Unix on my windows machine

Reply
Thread Tools

Perl scripts for Unix on my windows machine

 
 
Ren Patterson
Guest
Posts: n/a
 
      10-14-2003
Hi newbie question:


I have a few perl scripts made for Unix that I would like to use
either on my windows server or apache on my windows PC if I must
install apache. Is there a foreknown reason why the Unix scripts would
not work in these environments? thanks.
 
Reply With Quote
 
 
 
 
Anand
Guest
Posts: n/a
 
      10-14-2003
Unix scripts will not work for many reasons in windows env.
example... if you are using unix commands in script .. windows will not
recognize.
- need to set path as /usr/bin/perl will not work in windows

and there may be many reasons.
--Anand

Ren Patterson wrote:
> Hi newbie question:
>
>
> I have a few perl scripts made for Unix that I would like to use
> either on my windows server or apache on my windows PC if I must
> install apache. Is there a foreknown reason why the Unix scripts would
> not work in these environments? thanks.


 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      10-14-2003
Ren Patterson <(E-Mail Removed)> wrote:

> Hi newbie question:

^^^^^^^^^^^^^^^

Who is that?


> I have a few perl scripts made for Unix that I would like to use
> either on my windows server or apache on my windows PC if I must
> install apache.



You never need a web server to run Perl programs.

You (almost) always need a web server to run CGI programs,
regardless of what programming language you choose to
write them in.

Perl is not CGI.

CGI is not Perl.


> Is there a foreknown reason why the Unix scripts would
> not work in these environments?



Yes, if it "shells out" to call system-specific external programs
via system(), exec(), ``, qx//, or a pipe open().

Do your Perl programs use any of those?


--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Ren Patterson
Guest
Posts: n/a
 
      10-15-2003
Hi thanks for replying

none of these system(), exec(), ``, qx//, or a pipe open().

seem to be on my cgi-perl Unix scripts. Does that mean they should be
able to run from my Windows web server cgi-bin folder? thanks.


(E-Mail Removed) (Tad McClellan) wrote in message news:<(E-Mail Removed)>.. .
> Ren Patterson <(E-Mail Removed)> wrote:
>
> > Hi newbie question:

> ^^^^^^^^^^^^^^^
>
> Who is that?
>
>
> > I have a few perl scripts made for Unix that I would like to use
> > either on my windows server or apache on my windows PC if I must
> > install apache.

>
>
> You never need a web server to run Perl programs.
>
> You (almost) always need a web server to run CGI programs,
> regardless of what programming language you choose to
> write them in.
>
> Perl is not CGI.
>
> CGI is not Perl.
>
>
> > Is there a foreknown reason why the Unix scripts would
> > not work in these environments?

>
>
> Yes, if it "shells out" to call system-specific external programs
> via system(), exec(), ``, qx//, or a pipe open().
>
> Do your Perl programs use any of those?

 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      10-15-2003
Ren Patterson <(E-Mail Removed)> wrote:


> Hi thanks for replying



If you really mean that, then please start quoting your
followups properly.


> none of these system(), exec(), ``, qx//, or a pipe open().
>
> seem to be on my cgi-perl Unix scripts. Does that mean they should be
> able to run from my Windows web server cgi-bin folder?



Probably, though there _are_ a few less obvious potential problems.

What happened when you tried it?



[ snip TOFU ]

--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Ren Patterson
Guest
Posts: n/a
 
      10-15-2003
> If you really mean that, then please start quoting your
> followups properly.


What are you talking about? quoting your followups properly? what is
wrong with this guy mike?

>
>
> > none of these system(), exec(), ``, qx//, or a pipe open().
> >
> > seem to be on my cgi-perl Unix scripts. Does that mean they should be
> > able to run from my Windows web server cgi-bin folder?

>
>
> Probably, though there _are_ a few less obvious potential problems.
>
> What happened when you tried it?



I have not tried yet, I wanted to know before hand if I would be
wasting my time for maybe there was no way they worked. I will give it
a shot and post my results. Thanks.
 
Reply With Quote
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      10-15-2003
Ren Patterson wrote:
>> If you really mean that, then please start quoting your followups
>> properly.

>
> What are you talking about? quoting your followups properly? what
> is wrong with this guy mike?


Mike?

Please read the posting guidelines for this group:
http://mail.augustmail.com/~tadmc/cl...uidelines.html

>> What happened when you tried it?

>
> I have not tried yet, I wanted to know before hand if I would be
> wasting my time for maybe there was no way they worked.


Really? So you preferred to waste the time of hundreds of readers of
this group??

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      10-15-2003

Ren Patterson <(E-Mail Removed)> wrote:
>> If you really mean that, then please start quoting your
>> followups properly.

>
> What are you talking about?



Who is "you"?

[ Please provide an attribution when you quote someone. ]


I am talking about the conventions that are near universal in
Usenet newsgroups.

http://www.catb.org/~esr/faqs/smart-questions.html


> quoting your followups properly?


http://web.presby.edu/~nnqadmin/nnq/nquote.html


> what is
> wrong with this guy mike?



Who is Mike?

Since there is no Mike in this thread, I'm wondering which guy is
really the guy that has something wrong?


--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
James Willmore
Guest
Posts: n/a
 
      10-15-2003
On 15 Oct 2003 05:51:08 -0700
(E-Mail Removed) (Ren Patterson) wrote:
> > If you really mean that, then please start quoting your
> > followups properly.

>
> What are you talking about? quoting your followups properly? what is
> wrong with this guy mike?


Top posting is rude. Please don't do it

> > > none of these system(), exec(), ``, qx//, or a pipe open().
> > >
> > > seem to be on my cgi-perl Unix scripts. Does that mean they
> > > should be able to run from my Windows web server cgi-bin folder?

> >
> >
> > Probably, though there _are_ a few less obvious potential
> > problems.
> >
> > What happened when you tried it?

>
> I have not tried yet, I wanted to know before hand if I would be
> wasting my time for maybe there was no way they worked. I will give
> it a shot and post my results. Thanks.


Why not? Oh, you wanted to prevent an issue before it happened.

The first line of your script _may_ present an issue. Consider this:
#!/usr/bin/perl -w

This is no /usr/bin on many Windows boxes (unless you're using Cygwin,
which it appears you're not).

I believe there's a FAQ on portability. Try the documentation.
You could try _reading_ the various newsgroups as well. This is a
common topic. Google is your friend

HTH

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
Malek's Law: Any simple idea will be worded in the most
<complicated way.
 
Reply With Quote
 
Michael P. Broida
Guest
Posts: n/a
 
      10-15-2003
James Willmore wrote:
>
> The first line of your script _may_ present an issue. Consider this:
> #!/usr/bin/perl -w
>
> This is no /usr/bin on many Windows boxes (unless you're using Cygwin,
> which it appears you're not).


I've had that line in many of my Windows Perl scripts and
had NO problems with it. Windows doesn't use that line
in any way at all, so it's just another comment line.

From my MINIMAL experience shifting Perl between Unix and
Windows, I think the biggest problems are:

1) Unix NEEDS that initial line shown above (usually). When moving
from Windows to Unix, you need to make sure it's added.
When going from Unix to Windows, leave it there: no problem.

2) Executing external commands (as someone else pointed out)
may need tinkering to get the correct command names/etc
for the target system.

3) File path syntax has to be changed. Windows wants drive
letters; Unix uses "/" and mountpoints. I don't know
if it's possible for Perl to seamlessly handle both in
one script.

4) I'm sure there are other problems, but I haven't had any pop
up in the very few 'ports I've done.

Mike
 
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
What is required for perl scripts to run correct when launched from rc scripts on HPUX 11? deanjones7@gmail.com Perl Misc 13 09-10-2007 11:58 AM
Use of Perl in Unix startup / shutdown scripts Larry Perl Misc 9 07-20-2005 11:48 AM
unix pipes to perl scripts trt. Perl 1 03-15-2005 02:25 AM
unix pipes to perl scripts trt. Perl Misc 4 03-14-2005 03:40 PM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM



Advertisments