- Original Message -
From: "Patrick LeBoutillier"
To: "Sisyphus"
Cc: "inline"
Sent: Thursday, January 27, 2011 2:37 AM
Subject: Re: require an inline script that contains DATA section
Rob,
As is you can't because Inline uses an INIT block to
Rob,
As is you can't because Inline uses an INIT block to kickstart the
reading from the DATA handle, and INIT blocks are not run when you
"require" a file.
You need to modify data.pl in two ways for this to work:
1) replace __END__ by __DATA__ (I think __END__ works only in the main script)
2)
Hi,
The demo:
##
C:\>type data.pl
use warnings;
use Inline C;
print multiply(3, 7), "\n"; # line 5
1;
__END__
__C__
int multiply(int x, int y) {
return x * y;
}
C:\>type try.pl
use warnings;
require 'data.pl'; # line 3
C:\>perl try.pl
Undefine