Hi, 

I'm trying to write an application, that allows the user to generate
complex SQL Queries step by step.  
Therefore I need to make the same SQL-object available over many
requests. 

I'm using the Aapache::Singleton Module and mod_perl 2.x/Apache2.x but I
always seem to get a new Object as the properties are set to default
every time.


My Testcode is printing out a $counter - which it saved as an attribute
of the object - that's supposed to increment with every request:

###############   MyClass Module ###################

 package MyClass;

 use base qw (Apache::Singleton);

 {
        Sub _new_instance {
                my $class = shift;
                                
                my $self = {};
                bless $self, $class;

                $self->setProperty( 'counter', 1);

        }       
 }

#####################################################




################   Script: index.pl  ################

 Use MyClass;

 my $instance = MyClass->instance();

 my $counter = 0;

 $counter = $instance->getProperty('counter');

 print $counter;

 $counter++;

 $instance->setProperty('counter', $counter);

######################################################



The result is always 1. it doesn't increment. What am I doing wrong?

Any comment is appreciated.

Cheers,
mesel

Reply via email to