On Wed, 31 May 2000, Dylan Weed wrote:

> 
> I can't seem to get Apache::Session to save the blessedness of an object.  
> Is this an oversight on my part, a limitation of the module, a limitation
> of the database, or an intentional design decision?  
> 
> Conceptually, it seems as though an objects blessing is stored in a
> different place in the Perl guts than its contents.  Is the problem just
> that Apache::Session never saves this information to the database?
> 
> Has anyone else had occasion to do this?

Well, that sucks a lot.  This is actually a bug in Apache::Session.  If it
was working properly, blessed references should be fine.  Unfortunately,
the module doesn't seem to be saving hash entries that are added
immediately after creation.  I will fix this tomorrow.

Also I will add a test for this case.

> 
> 
> 
> An example in Perl:
> 
> # %session is a hash tied to a DB with Apache::Session 1.51
> 
> package main;
> 
> my $dog_obj = { name => 'Fido', breed => 'Mutt' };
> 
> bless ($dog_obj, 'Dog');
> 
> $dog_obj->bark();
> $session{my_dog} = $dog_obj;
> 
> # The following line dies with an error:
> #       cannot call method bark on unblessed reference.
> $session{my_dog}->bark();
> 
> package Dog;
> 
> sub bark {
>       my $self = shift;
>       print "Woof! I'm $self->{name}";
> }
> 
> 

Reply via email to