Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Same is different?

by BooK (Curate)
on May 29, 2001 at 00:58 UTC ( #83788=perlmeditation: print w/replies, xml ) Need Help??

In CGI will be with you, always, I used the content of to extract all four letter bits from it. I took care of line endings using chomp. Still, on different platforms, with the same version of, I get different results.

Why is it that the same version of is different on different platforms? For further checking:

$CGI::VERSIONPerl -varchOS Platform/versionMD5 hash
2.465.005_03MSWin32-x86-object (ActiveState 522)MS-Windows/4.10.1998,P903d4ad8e2d17990437c999eef9490c3
2.565.6.0i386-linuxLinux Mandrake/2.2.14-15mdk94ecf90cf567e9435a3db89ef50a72b7
2.745.6.0 MSWin32-x86-multi-thread (ActiveState 620)MS-Windows/4.10.1998,P355fc673032bedeb3cc0cb042738af22

Naturally, this calculus has problems, since line endings do vary between Win32 and Unix... But still, there are differences. Why?

Update: So I am stupid. tye suggested to use diff, which showed me the differences: some hardcoded globals, like $TempFile::TMPDIRECTORY do change between OSes...

Tool used: perl -p0777MDigest::MD5=md5_hex -e '$_=md5_hex$_'

Replies are listed 'Best First'.
Re: Same is different?
by DrZaius (Monk) on May 29, 2001 at 19:26 UTC
    Does this mean that CGI isn't always with you if you are trying to build a portable system?

    This is complete theory, but merlyn suggested in a previous node that in the worst case you can include the contents of CGI in a BEGIN block.

    If there are platform specific variables, this means you have to change your code for different platforms.

    Same deal with use lib.

      I think this mostly means I am a stupid wheening moron... :-S

      In my obfuscated code, I assumed that the same version of would be identical (except for line-endings) on every platform Perl runs on. This is false. But the differences are in fact very tiny (a few lines), and mostly regard configuration parameters, which actually and naturally change between platforms and installs.

      I think the Perl core (and CGI is part of the standard distribution) is you best bet at portable code. This doesn't include Obfuscation, that's all... :-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://83788]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2020-09-22 13:56 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (129 votes). Check out past polls.