Perl portability

Tim Riker TimR "at" WordCruncher.com
Thu, 10 Dec 1998 20:29:28 +0000


Yes, Yes!

This is a Good Thing. Can we get this rolled into the distro?

($] >= 5.0) ? eval 'use Socket' : eval 'require "sys/socket.ph"';

Jonathan Marsden wrote:
> 
> On 10 Dec 1998, raoul "at" world.std.com writes:
> 
> >> We would like to get rid of the Perl, but it isn't a shell script
> >> because it needs to check connections to sockets and do some simple
> >> stuff to create cookies.  It isn't C, because we want it to be easy
> >> for people to customise.  But yes, some combination of the two is
> >> certainly possible.  As we're discovering, Perl isn't a good
> >> solution where portability is concerned!
> 
> > Well, you've just made quite good points. And trying to make shell
> > scripts portable can be a *nightmare*, where Perl at least has the
> > pretense of being similar from platform to platform. It's just hard
> > to tell which *release* of Perl is in use, which is easier to double
> > check under Linux (rpm is your friend).
> 
> Hmmm?  rpm???  What for?  perl -e 'print $]' is 'hard' for you??
> 
> This works on a lot more systems than RPM-based Linux (and BTW not all
> Linux distributions use RPM anyway, check out Debian or Slackware for
> example).
> 
> As I see it, if the vncserver script had just checked whether one had
> Perl5 or Perl4 and done the eval require for perl4 and the use Socket
> for Perl5, the script would have been very portable.  So (unless I am
> misunderstanding some inherently deep trickiness in the script??) the
> script should probably read something closer to:
> 
>     ($] >= 5.0) ? eval 'use Socket' : eval 'require "sys/socket.ph"';
> 
> where it currently has just the eval require statement.  Those who
> keep suggesting RH 5.2 users replace that eval with the plain 'use
> Socket' are effectively making the code *less* portable, which seems a
> bad idea to me.
> 
> IMO, well-written Perl *is* a good solution when portability is a
> requirement.
> 
> Jonathan
> --
> Jonathan Marsden   | Internet: jonathan "at" xc.org  | Making electronic
> 1849 N. Wabash Ave.| Phone: +1 (909) 794 1151   | communications work
> Redlands, CA 92374 | FAX:   +1 (909) 794 3016   | reliably for Christian
> USA                | http://www.xc.org/jonathan | missions worldwide
> 
> ---------------------------------------------------------------------
> The VNC mailing list     -   see http://www.orl.co.uk/vnc/intouch.html
> ---------------------------------------------------------------------

-- 
Tim Riker - http://riker.dsl.inconnect.com/ - short SIGs! <g>


---------------------------------------------------------------------
The VNC mailing list     -   see http://www.orl.co.uk/vnc/intouch.html
---------------------------------------------------------------------