-----Original Message----- From: sisyph...@optusnet.com.au
Sent: Tuesday, April 09, 2013 12:44 PM
To: Chris Nighswonger ; inline@perl.org
Subject: Re: Using Inline Python to import Python vars



-----Original Message----- From: Chris Nighswonger

    @{$DATA{$pkg}} = split /(?m)(__\S+?__\n)/, $data;

Try replacing that line (in Inline.pm) with:

    #warn "\n########\n\$data:\n$data\n########\n";
   @{$DATA{$pkg}} = split /(?m)(\n[ \t]{0,}__\S+?__\n)/, $data;
for(@{$DATA{$pkg}}) {$_ = (split /\s/, $_)[-1] . "\n" if $_ =~ /^\s{0,}__\S+?__\n$/} # remove any whitespace that precedes marker
    #warn "\n########\n", scalar(@{$DATA{$pkg}}), "\n";l
    #for(@{$DATA{$pkg}}) {warn ">>$_<<\n"}

It's only 2 lines of code - the (commented out) warnings might be useful if things go awry. They won't appear in the final version of Inline.pm.

That works ok for my failing Inline::C script, and without causing any of the Inline tests in the Inline-0.52 test suite to fail.
I'm hopeful it will do the trick for your Inline::Python script, too.

It's possibly a little convoluted at the moment ... maybe someone can improve on that.

Cheers,
Rob

Reply via email to