perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Angus Lees <...@inodes.org>
Subject Embperl::Object doesn't cache app object correctly?
Date Thu, 04 Aug 2005 11:24:16 GMT
Gerald, I think the app object logic in Embperl::Object::Execute() is
wrong.  It seems to always recreate the application object, where it
should only do it once.  Looking at the code, it never seems to check
if $packages{"$fn::$appfn"} already exists before creating a new app
object.

Now that I think about it further, is "$fn::$appfn" the right key to
use here - do we *want* a new app object for each base file?  Surely
we should just be caching this against the appname or something.


In case I've missed the mark completely, the bug I'm seeing is this:

I've got an (offline) perl loop that repeatedly calls:
    my $rc = Embperl::Object::Execute({inputfile => $inpath,
				       outputfile => $outpath,
				       appname => 'gusweb',
				       object_app => '_app.pl',
				      });

and I'm seeing the application object get created and work correctly
on the first request - but the second request gets:

 [24276]ERR:  24:  Error in Perl code: Can't locate object method "init" via package "Embperl::__4"
at /usr/lib/perl5/Embperl/Object.pm line 314, <$inv> line 5.

and the third gets:

 [24276]ERR:  32:  Warning in Perl code: Subroutine init redefined at /home/gus/public_html/gus/_app.pl
line 12, <$inv> line 8.
 [24276]ERR:  32:  Warning in Perl code: Subroutine get_recipe redefined at /home/gus/public_html/gus/_app.pl
line 23, <$inv> line 8.

the fourth gets:

 [24276]ERR:  24:  Error in Perl code: Can't locate object method "init" via package "Embperl::__4"
at /usr/lib/perl5/Embperl/Object.pm line 314, <$inv> line 32.

the fifth gets the "subroutine redefined" errors, etc.

dbgObjectSearch log attached.

 - Gus


Mime
View raw message