calling methods on deserialized objects



Hello Perl Specialists,

i'm struggling with a weird problem ....

background:
I have stored an "object tree" in a CGI::Session. I want to make the whole
object model persistent, when the page has finished rendering and restore
all the stuff when the page is loaded by a new request. So far so good: The
object structure seems to be serialized correct. When looking at the
structure with Data::Dumper before and after the
serialization/deserialization step, I can see no difference. Even the
blessing and backpointers in the structure are maintained. But anyway an
error occurs when trying to call methods on the deserialzed objects.

problem:

I have a "restored" object like:

my $page = $session->param{page};

now I want to iterate through the child controls and call a method on them:

foreach my $controlName (keys (%{$page->{mControls}}))
{
my $childControl = $page->{mControls}->{$controlName };
$childControl->load(); # i've checked that $childControl is a valid
blessed reference at this point!
}

The "$childControl->load();" statement causes the following error:

"can't locate object method "load" via package SMDplus::Web::Controls::Form

As the error also shows, perl is well aware of the class where the load
method is implemented. Unfortunately it says that the package doesn't
contain the "load" method (which is not the case).

I can achieve what I want by transforming the statement

$childControl->load(); # generates error

into:

my $class = ref($childControl);
eval("$class\:\:load(\$childControl)"); # works fine

Since I don't want to use eval for several reasons, I am looking for a way
to make the "intuitive syntax" work. I should say that i'm using
"inheritance" as well.... I'm very confused about this behaviour and also
have the bad feeling, that I didn't understand some fundamentals of perl
"objects" :-(.

Can anybody please enlight me? This problem drives me mad by the time ...

kind regards
Michael



.



Relevant Pages

  • Re: Desktop wont finish booting after spamware attack
    ... fine but you are unable to get your applications to open. ... While the following assumes you have an actual XP CD as opposed to a restore ... type sfc /scannow in the run box and press enter. ... It'll stay like this> for hours, once in a while something will jar it loose> and things will continue to load and all is fine. ...
    (microsoft.public.windowsxp.accessibility)
  • Re: Cannot Open any Applics after 2004 Install
    ... I've taken out the library preferences folder, Office still won't load (error ... the other office applics that won't open at all. ... think I'd better learn to create a disk image - can I restore this if i erase ...
    (microsoft.public.mac.office)
  • Re: Only Wallpaper shows after boot, no icons or task bar
    ... Desktop Icons and the Taskbar Fail to Load at Startup ... Restore a Missing "userinit" Registry Value: ... If your Windows is not on drive C: replace C: with your Windows ... I tried restoring the computer to a point where it worked through System Restore. ...
    (microsoft.public.windowsxp.general)
  • Re: Oblivion saved game restore problem (minor spoilers)
    ... when I load it I seem to be in a sort of time warp. ... already done the first mission for the Grey Fox. ... Is there any trick to restoring a single saved game like that? ... mistake on which saved game to restore. ...
    (comp.sys.ibm.pc.games.rpg)
  • Re: Reinstall XP?
    ... "could'nt load resourse file" came up. ... Informed, by the disc, that the version on my computer was more recent than the disc' version and to restart and boot to load the disc if I wanted to load from it. ... Also, I cannot restore as my restore calender does not show dates, I cannot manually input a date, and to unrestore my last event, it does not work. ...
    (microsoft.public.windowsxp.help_and_support)