Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Inline::C and multiple platforms

Reply
Thread Tools

Inline::C and multiple platforms

 
 
Andrei Alexandrescu (See Website For Email)
Guest
Posts: n/a
 
      02-20-2006
I'd like to put a Perl script using Inline::C on a shared filesystem.
Users might invoke the script from Linux or Solaris systems.

Now the problem is, the Inline module will use an MD5 digest and caching
to ensure that the C part is recompiled if changed. However, that also
means that the the mechanism won't detect that the script is being
invoked under different operating systems, so it will erroneously
attempt to use the Linux shared lib on Solaris or vice versa.

How can I avoid that in an elegant manner?


Thanks,

Andrei
 
Reply With Quote
 
 
 
 
Sisyphus
Guest
Posts: n/a
 
      02-20-2006

"Andrei Alexandrescu (See Website For Email)"
<> wrote in message
news:...
> I'd like to put a Perl script using Inline::C on a shared filesystem.
> Users might invoke the script from Linux or Solaris systems.
>
> Now the problem is, the Inline module will use an MD5 digest and caching
> to ensure that the C part is recompiled if changed. However, that also
> means that the the mechanism won't detect that the script is being
> invoked under different operating systems, so it will erroneously
> attempt to use the Linux shared lib on Solaris or vice versa.
>
> How can I avoid that in an elegant manner?
>


I can't think of a very elegant solution. I would create 2 versions of the
Inline::C script - one named 'linux_version.pl', the other named
'solaris_version.pl'. The user would not invoke either of those 2 scripts
directly - instead the user would run a script that looks something lke
this:

use warnings;
if($^O =~ /linux/i) { do 'linux_version.pl'}
else {do 'solaris_version.pl'}

Cheers,
Rob


 
Reply With Quote
 
 
 
 
ednotover@gmail.com
Guest
Posts: n/a
 
      02-21-2006

Andrei Alexandrescu (See Website For Email) wrote:
> I'd like to put a Perl script using Inline::C on a shared filesystem.
> Users might invoke the script from Linux or Solaris systems.
>
> Now the problem is, the Inline module will use an MD5 digest and caching
> to ensure that the C part is recompiled if changed. However, that also
> means that the the mechanism won't detect that the script is being
> invoked under different operating systems, so it will erroneously
> attempt to use the Linux shared lib on Solaris or vice versa.
>
> How can I avoid that in an elegant manner?


Untested, but perhaps you could use Inline's NAME config option and
base the value off $^O.

Ed

 
Reply With Quote
 
xhoster@gmail.com
Guest
Posts: n/a
 
      02-21-2006
"Andrei Alexandrescu (See Website For Email)"
<> wrote:
> I'd like to put a Perl script using Inline::C on a shared filesystem.
> Users might invoke the script from Linux or Solaris systems.
>
> Now the problem is, the Inline module will use an MD5 digest and caching
> to ensure that the C part is recompiled if changed. However, that also
> means that the the mechanism won't detect that the script is being
> invoked under different operating systems, so it will erroneously
> attempt to use the Linux shared lib on Solaris or vice versa.
>
> How can I avoid that in an elegant manner?


I wouldn't exactly call it elegant, but....

my $arch_version;
BEGIN {
use Config;
$arch_version = "./_Inline_" .
$Config{'archname'}.'-'.$Config{'version'};
mkdir $arch_version or die $! unless -d $arch_version;
};

use Inline C=> 'DATA', DIRECTORY => $arch_version;


Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
 
Reply With Quote
 
Bart Lateur
Guest
Posts: n/a
 
      02-21-2006
Andrei Alexandrescu (See Website For Email) wrote:

>I'd like to put a Perl script using Inline::C on a shared filesystem.
>Users might invoke the script from Linux or Solaris systems.
>
>Now the problem is, the Inline module will use an MD5 digest and caching
>to ensure that the C part is recompiled if changed. However, that also
>means that the the mechanism won't detect that the script is being
>invoked under different operating systems, so it will erroneously
>attempt to use the Linux shared lib on Solaris or vice versa.
>
>How can I avoid that in an elegant manner?


I think it sounds like a bug in Inline. What it does, is create a
subdirectory ".Inline/lib/auto" and place the compiled module under a
custom sudirectory. What it *should* do, IMO, is place the subdirectory
under ".Inline/lib/$Config{archname}/auto", where %Config is the hash
from Config.pm, or perhaps even throwing in $Config{version} as well.

--
Bart.
 
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
A service for testing Python code on multiple platforms and versions David Moss Python 3 09-13-2008 02:03 PM
Need help porting a C++ / Python Embedded app to multiple platforms jpw Python 1 02-05-2008 11:35 PM
make on multiple platforms Khookie C Programming 3 10-31-2007 05:27 AM
Adapting code to multiple platforms Jeffrey Barish Python 6 03-14-2005 03:08 AM
Coding for multiple platforms Joe C C++ 3 01-06-2004 10:48 PM



Advertisments