Stefan Seifert wrote:
> Inline::Python inspects the main namespace of the Python code and imports 
> those names into the current package. Thus you have to specify the fully 
> qualified name of the imported class:
> 
> package TestPy;
> use Inline Python => 'from StringIO import StringIO';
> my $stringio = TestPy::StringIO->new;
> 
> It's the same as when your TestPy package imports names from other Perl 
> modules.
> 
> Your test script worked because in Perl you don't have to qualify names in 
> the 
> main package, though doing so works as well:
> 
> package main;
> use Inline Python => 'from StringIO import StringIO';
> my $stringio = main::StringIO->new; # works
> my $stringio = ::StringIO->new; # shortcut works, too
> my $stringio = StringIO->new; # unqualified works as well
> 
> Regards,
> Stefan

Excellent! Thanks, Stefan. As always, it's not how many bytes need
changing, it's knowing which bytes to change :) It works now.

I'd like to suggest adding your example, pretty much as you've typed it
above, to the POD for the module. One other change I'd suggest is moving
the parts about calling perl from within python to a separate POD. I
found that very confusing, especially working out where that part ends
and I should start reading again.

Thanks again for the prompt help,
Cheers, Dave

Reply via email to