Re: Apache::Session and blessed references

2000-07-24 Thread Dylan Weed


Hi Jeffrey --

I'm pretty sure the problem is reproducible, but I'll rerun the dog 
test case tomorrow when I get a chance and let you know whether
things are still broken.  I'll also flesh it out into a complete program.

One unique thing about our configuration is that we're using Apache
1.3.12/mod_perl 1.24/Perl 5.6.0.  (We're also running under Linux and
using mysql locking if it matters.)  We're running Perl 5.6 because we
want to avoid the dying-in-an-eval bug in 5.005, but I can't say that I
trust 5.6 entirely -- it seems to still have a few nasty bugs.  Were you
running your latest tests under 5.6?  And do you think it's possible that
the bug might be a 5.6/Apache::Session interaction?

I'll write again tomorrow with more info.

Thanks,

 -- Dylan

On Sun, 23 Jul 2000, Jeffrey W. Baker wrote:

 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?
  
  
  
  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}";
  }
 
 
 You know, I thought that there was a problem here when I first saw this
 email, but today I simply cannot reproduce it.  When I run the example
 program, everything barks.
 
 Can you still reproduce this problem, and, if so, could you please send me
 a complete, working perl program as a demonstration?
 
 Regards,
 Jeffrey
 




Re: Apache::Session and blessed references

2000-07-23 Thread Jeffrey W. Baker

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?
 
 
 
 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}";
 }


You know, I thought that there was a problem here when I first saw this
email, but today I simply cannot reproduce it.  When I run the example
program, everything barks.

Can you still reproduce this problem, and, if so, could you please send me
a complete, working perl program as a demonstration?

Regards,
Jeffrey




Re: Apache::Session and blessed references

2000-06-01 Thread Jeffrey W. Baker

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}";
 }
 
 




Re[2]: Apache::Session and blessed references

2000-06-01 Thread serg gajdajchuk





Re[2]: Apache::Session and blessed references

2000-06-01 Thread serg gajdajchuk





Apache::Session and blessed references

2000-05-31 Thread Dylan Weed


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?



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}";
}