Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > How to port scripts written for UNIX on windows

Reply
Thread Tools

How to port scripts written for UNIX on windows

 
 
karuna
Guest
Posts: n/a
 
      06-01-2005
Hi

I have written nearly 70 perl scripts which run well on UNIX
platforms. But on windows(2000/03 and XP) am finding lot of problem.

I am ending up rewriting code with too much of modification.

What is the solution for this ?.

Those who know kindly reply back to me ..

Thanks
Karuna

 
Reply With Quote
 
 
 
 
Brian Wakem
Guest
Posts: n/a
 
      06-01-2005
karuna wrote:

> Hi
>
> I have written nearly 70 perl scripts which run well on UNIX
> platforms. But on windows(2000/03 and XP) am finding lot of problem.
>
> I am ending up rewriting code with too much of modification.
>
> What is the solution for this ?.



Write portable code. Of course it's too late as you've already it. Do you
have any specific problems? code examples?


--
Brian Wakem

 
Reply With Quote
 
 
 
 
Brian Wakem
Guest
Posts: n/a
 
      06-01-2005
Brian Wakem wrote:

> Of course it's too late as you've already it.



.....already written it.


--
Brian Wakem

 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      06-01-2005
karuna wrote:
> I have written nearly 70 perl scripts which run well on UNIX
> platforms. But on windows(2000/03 and XP) am finding lot of problem.
>
> I am ending up rewriting code with too much of modification.


Do you have examples of pieces that you have to rewrite?

> What is the solution for this ?.


Simple. Don't write non-portable Perl code to begin with. Doesn't help you
much now, but that is really the underlying problem.

For details please see "perldoc perlport"

jue


 
Reply With Quote
 
Tintin
Guest
Posts: n/a
 
      06-02-2005

"karuna" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Hi
>
> I have written nearly 70 perl scripts which run well on UNIX
> platforms. But on windows(2000/03 and XP) am finding lot of problem.
>
> I am ending up rewriting code with too much of modification.
>
> What is the solution for this ?.


Write portal code to start with.

Don't call external programs that can be done natively in Perl.

Use configuration files so you don't have to hardcode settings in the Perl
scripts.


 
Reply With Quote
 
Anno Siegel
Guest
Posts: n/a
 
      06-02-2005
Tintin <(E-Mail Removed)> wrote in comp.lang.perl.misc:
>
> "karuna" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) oups.com...
> > Hi
> >
> > I have written nearly 70 perl scripts which run well on UNIX
> > platforms. But on windows(2000/03 and XP) am finding lot of problem.
> >
> > I am ending up rewriting code with too much of modification.
> >
> > What is the solution for this ?.

>
> Write portal code to start with.


Portal code? Do you mean "portable"?

Anno
 
Reply With Quote
 
Tintin
Guest
Posts: n/a
 
      06-02-2005

"Anno Siegel" <(E-Mail Removed)-berlin.de> wrote in message
news:d7mkhn$340$(E-Mail Removed)-Berlin.DE...
> Tintin <(E-Mail Removed)> wrote in comp.lang.perl.misc:
>>
>> "karuna" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed) oups.com...
>> > Hi
>> >
>> > I have written nearly 70 perl scripts which run well on UNIX
>> > platforms. But on windows(2000/03 and XP) am finding lot of problem.
>> >
>> > I am ending up rewriting code with too much of modification.
>> >
>> > What is the solution for this ?.

>>
>> Write portal code to start with.

>
> Portal code? Do you mean "portable"?


Doh! I've been working on too many web portals recently.


 
Reply With Quote
 
karuna
Guest
Posts: n/a
 
      06-03-2005
Hi

Thanks for your replies
the problem is on unix suppose am using the path as "/opt/OV/bin"
on windows it becomes "C:/Prog Files/Product Name/bin"

and all scalar variables need to be enclosed with escape sequence
for eg : a variable called $BIN need to be used as \"$BIN\"
this is becomming a big pain.
IS there is any way in windows or any API is there which could solve
my problem

Or normally how perl scripts will be written which work both on unix
and
windows ...
Karuna

 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      06-03-2005
karuna wrote:
> Thanks for your replies
> the problem is on unix suppose am using the path as "/opt/OV/bin"
> on windows it becomes "C:/Prog Files/Product Name/bin"


Well, obviously calling external programs is not portable. Period.

"Doctor, if I do this then it hurts."
"Well, then don't do it."

Use native Perl functions or modules instead.
Or if those are custom programs for which there is no Perl equivalent, then
define those pathes in one single configuration module. Then you have to
change that one single file only.

> and all scalar variables need to be enclosed with escape sequence
> for eg : a variable called $BIN need to be used as \"$BIN\"


What? Why do you think so?

> this is becomming a big pain.
> IS there is any way in windows or any API is there which could solve
> my problem
>
> Or normally how perl scripts will be written which work both on unix
> and
> windows ...


Well, did you actually read the FAQ that was pointed out to you? Or did you
just thank people blindly without reading their suggestions?

jue


 
Reply With Quote
 
Brian Wakem
Guest
Posts: n/a
 
      06-03-2005
karuna wrote:

> Hi
>
> Thanks for your replies
> the problem is on unix suppose am using the path as "/opt/OV/bin"
> on windows it becomes "C:/Prog Files/Product Name/bin"
>
> and all scalar variables need to be enclosed with escape sequence
> for eg : a variable called $BIN need to be used as \"$BIN\"
> this is becomming a big pain.



Can you give an example of where you need to do that?


--
Brian Wakem

 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Generally, are the programs written by C++ slower than written by C10% ? KaiWen C++ 102 09-14-2011 11:12 PM
how to exceute shell scripts in unix server(telnet) from java application which is on windows? vinay Java 2 07-28-2006 08:52 PM
Perl scripts for Unix on my windows machine Ren Patterson Perl Misc 23 10-17-2003 07:00 PM
Re: Can a usercontrol written in C# be used in Web Forms that is written in VB.Net? Steve C. Orr, MCSD ASP .Net 1 08-24-2003 12:06 AM



Advertisments