Perl scripts for Unix on my windows machine

R

Ren Patterson

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.
 
A

Anand

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
 
T

Tad McClellan

Ren Patterson said:
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?
 
R

Ren Patterson

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.
 
T

Tad McClellan

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 ]
 
R

Ren Patterson

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?
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.
 
G

Gunnar Hjalmarsson

T

Tad McClellan

Ren Patterson said:
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?
 
J

James Willmore

On 15 Oct 2003 05:51:08 -0700
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 :)
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.
 
M

Michael P. Broida

James said:
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
 
R

Ren Patterson

Nice to meet you

Thank you, maybe next time an ignorant person (let us not use the N
word "newbie" oh my!) comes to the group that person can be directed
to your group etiquette instead of critizing her/him for not following
your little social code.
Really? So you preferred to waste the time of hundreds of readers of
this group??

It is analogous to a webmaster wanting to make a webpage available for
wireless devices. This webmaster does not know WAP which would be read
by non-html wireless devices. However, the webmaster searched
indefinitely and finds not an answer. Webmaster does not set up the
page "yet" to try it on a wireless device for the webmaster suspects
there might be an incompatibility. So one good day the webmaster heads
down to where the "know it all gods of WAP" hang out and asks them a
simple question as to whether it can be done or not.

So mike

If just telling someone wether a cgi-perl script is known to work or
not in a certain OS, is considered a waste of time by those who know -
then maybe those who know should not even be allowed to post on a
forum that should help those who don't...
 
G

Gunnar Hjalmarsson

So mike
Mike?

If just telling someone wether a cgi-perl script is known to work
or not in a certain OS, is considered a waste of time by those who
know - then maybe those who know should not even be allowed to post
on a forum that should help those who don't...

My point is that your way of justifying that you hadn't tried revealed
an irritating lack of respect to those whose help you were seeking.

As regards your initial general question, you got some general
guidance. It's of course not possible for anybody to know whether your
particualar programs, which we know nothing about, can be run on Windows.
 
T

Tad McClellan

Michael P. Broida said:
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.


Windows doesn't use it, but perl _does_, so it isn't really
just another comment line.

perl parses that line looking for switches, such as -w


3) File path syntax has to be changed. Windows wants drive
letters; Unix uses "/" and mountpoints. I don't know


Windows can use "/" as the directory separator too.
 
J

James Willmore

Michael P. Broida said:
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.
<snip>

True - however, it is something to consider when writing a portable
script. When you try and go the other way (Windows to Unix) it _does_
matter. And is something the OP should be made aware of - especial in
a mixed OS environment (something you should already know about, given
your email address).

perlport is the FAQ I was eluding to in my previous post.

HTH

Jim
 
R

Ren Patterson

Gunnar Hjalmarsson said:
My point is that your way of justifying that you hadn't tried revealed
an irritating lack of respect to those whose help you were seeking.


How in the world does wanting to learn whether it is known for a fact
that one "type" of script will not work in Windows, before installing
that very script represent a lack of respect much less irritating?

Have you ever heard of asking before acting? or when in doubt ask?

As regards your initial general question, you got some general
guidance. It's of course not possible for anybody to know whether your
particualar programs, which we know nothing about, can be run on Windows.



You see, I was trying to see if I was attempting a senseless act for,
perhaps "NO" Unix cgi-perl script could work in a Windows 98
environment. Remember I am new (oh not the N word!) and my intention
was to appeal to your gathered knwoledge, which I do not have. And for
those who may be thinking "well why didn't you do a search for it" my
illustrious, I did! and could not find a solid answer.

Now that could not be so hard cgi-perl and perl geniuses!

LOL watch the flame
 
B

Bob X

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.
Not entirely true. If you are using Apache on Windows, Apache uses that line
when calling CGI scripts. May not be true for all but I have to put "#!perl"
on the first line of my cgi's.

Bob
 
J

James Willmore

here's the place to find the FAQ for this
group (aka "our social code" you refer to):
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html


Calling it a FAQ when it has only one (seldom asked) question in
it is a bit of a stretch. :)

There is no FAQ for clp.misc.

There is a FAQ for Perl (of course).[/QUOTE]

Can we have a FAQ? It seems to me there _may_ be a need for one.

I suggest this because other newsgroups have one and I have gained
something from the fact they do. I know that Perl has many - which
could be the first fact of the FAQ (ha, ha). I cite one example group
for reference - comp.unix.shell.

--
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 ...
SHIFT TO THE LEFT! SHIFT TO THE RIGHT! POP UP, PUSH DOWN, BYTE,
BYTE, BYTE!
 
J

James Willmore

James Willmore trolls:
<snip>

Whatever.

I see enough clutter on the 'Net and there's other mediums for you to
advertise your web site in - that are also free.

Not only that, but your documentation is yet another place to find
what is already made available in more than a dozen different places
already :)

Have a nice day ;-)

--
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 ...
Boren's Laws: (1) When in charge, ponder. (2) When in trouble,
delegate. (3) When in doubt, mumble.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top