Perl scripts for Unix on my windows machine

Discussion in 'Perl Misc' started by Ren Patterson, Oct 14, 2003.

  1. 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.
    Ren Patterson, Oct 14, 2003
    #1
    1. Advertising

  2. Ren Patterson

    Anand Guest

    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.
    Anand, Oct 14, 2003
    #2
    1. Advertising

  3. Ren Patterson <> 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
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Oct 14, 2003
    #3
  4. 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.


    (Tad McClellan) wrote in message news:<>...
    > Ren Patterson <> 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?
    Ren Patterson, Oct 15, 2003
    #4
  5. Ren Patterson <> 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
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Oct 15, 2003
    #5
  6. > 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.
    Ren Patterson, Oct 15, 2003
    #6
  7. 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/clpmisc/clpmisc_guidelines.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
    Gunnar Hjalmarsson, Oct 15, 2003
    #7
  8. Ren Patterson <> 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
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Oct 15, 2003
    #8
  9. On 15 Oct 2003 05:51:08 -0700
    (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.
    James Willmore, Oct 15, 2003
    #9
  10. 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
    Michael P. Broida, Oct 15, 2003
    #10
  11. Gunnar Hjalmarsson <> wrote in message news:<bmjgbl$o5j7j$1@ID-> Mike?

    Nice to meet you

    >
    > Please read the posting guidelines for this group:
    > http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html


    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.

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


    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...
    Ren Patterson, Oct 15, 2003
    #11
  12. Ren Patterson wrote:
    > Gunnar Hjalmarsson wrote:
    >> Ren Patterson wrote:
    >>> Tad McClellan wrote:
    >>>> Ren Patterson wrote:
    >>>>> Does that mean they should be able to run from my Windows
    >>>>> web server cgi-bin folder?
    >>>>
    >>>> 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??


    <snip>

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

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Oct 15, 2003
    #12
  13. Michael P. Broida <michael.p.broida@boeing_oops.com> wrote:
    > 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.



    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.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Oct 15, 2003
    #13
  14. Ren Patterson <> wrote:

    > So mike



    Who _is_ this Mike?


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Oct 15, 2003
    #14
  15. (Tad McClellan) writes:
    > Ren Patterson <> wrote:
    >
    >> So mike

    >
    > Who _is_ this Mike?


    <URL:http://www.itswalky.com/faq/biomike.html> maybe, but it's still
    not obvious if it's meant as a compliment or not.

    -=Eric
    --
    Come to think of it, there are already a million monkeys on a million
    typewriters, and Usenet is NOTHING like Shakespeare.
    -- Blair Houghton.
    Eric Schwartz, Oct 15, 2003
    #15
  16. "Michael P. Broida" <michael.p.broida@boeing_oops.com> wrote in message news:<3F8D8FA5.8F3030FF@boeing_oops.com>...
    > 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.

    <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
    James Willmore, Oct 16, 2003
    #16
  17. Gunnar Hjalmarsson <> wrote in message news:<bmk5vk$ngmu4$1@ID->
    > 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
    Ren Patterson, Oct 16, 2003
    #17
  18. Ren Patterson

    Bob X Guest

    "Michael P. Broida" <michael.p.broida@boeing_oops.com> wrote in message
    news:3F8D8FA5.8F3030FF@boeing_oops.com...
    > James Willmore wrote:
    > >

    <snip>
    > 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
    Bob X, Oct 17, 2003
    #18
  19. Need for a FAQ? (Re: Perl scripts for Unix on my windows machine)

    On Fri, 17 Oct 2003 00:43:59 -0500
    (Tad McClellan) wrote:

    > James Willmore <> wrote:
    >
    > > 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).


    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!
    James Willmore, Oct 17, 2003
    #19
  20. Re: Easy Access Perl Documentation (was Re: Perl... Unix...windowsmachine)

    On Fri, 17 Oct 2003 07:51:18 -0700
    Purl Gurl <> wrote:

    > James Willmore trolls:
    >
    > > Purl Gurl offers help to a poster:

    <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.
    James Willmore, Oct 17, 2003
    #20
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dpackwood
    Replies:
    3
    Views:
    1,774
  2. trt.
    Replies:
    1
    Views:
    588
    Michael Abootorab
    Mar 15, 2005
  3. trt.

    unix pipes to perl scripts

    trt., Mar 14, 2005, in forum: Perl Misc
    Replies:
    4
    Views:
    149
    Chris Mattern
    Mar 14, 2005
  4. Larry
    Replies:
    9
    Views:
    282
    samwyse
    Jul 20, 2005
  5. Replies:
    13
    Views:
    517
    Anno Siegel
    Sep 10, 2007
Loading...

Share This Page