You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by H Jayakumar <HJ...@novell.com> on 2002/07/17 13:10:39 UTC

global variables,

Hello, 

Modperl seems to clear the global objects only when it is unloaded.
Is there a way to clear objects created with new at the end 
of execution of every script ?

The code snippet is as follows in the script,

use Perl2UCS;
my $vm;
$vm = Perl2UCS->new("UCX:Volumemgr");
-----------------------------------------------

This is Perl2UCS.pm
sub new {
    my( $object );
    my( $class ) = shift;
    if($class eq 'UCSObject' || $class eq 'Perl2UCS')
    {
        $class = shift;
    }

    if ( Perl2UCS::New( $class, $object ) ) {
        return $object;
    } else {
        return undef;
    }
}

sub DESTROY {
    my( $self ) = shift;
    Perl2UCS::Delete( $self );
    return undef;
}
-----------------------------------------------

DESTROY is called by perl when I unload mod_perl, Can I get it
destroyed immediately after the script is executed.

Explicitly calling DESTROY in the script results in an error.

I hope Iam clear, 
Thank You,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: global variables,

Posted by Stas Bekman <st...@stason.org>.
You posted this to the wrong list, please repost to:
http://perl.apache.org/maillist/modperl.html

H Jayakumar wrote:
> Hello, 
> 
> Modperl seems to clear the global objects only when it is unloaded.
> Is there a way to clear objects created with new at the end 
> of execution of every script ?
> 
> The code snippet is as follows in the script,
> 
> use Perl2UCS;
> my $vm;
> $vm = Perl2UCS->new("UCX:Volumemgr");
> -----------------------------------------------
> 
> This is Perl2UCS.pm
> sub new {
>     my( $object );
>     my( $class ) = shift;
>     if($class eq 'UCSObject' || $class eq 'Perl2UCS')
>     {
>         $class = shift;
>     }
> 
>     if ( Perl2UCS::New( $class, $object ) ) {
>         return $object;
>     } else {
>         return undef;
>     }
> }
> 
> sub DESTROY {
>     my( $self ) = shift;
>     Perl2UCS::Delete( $self );
>     return undef;
> }
> -----------------------------------------------
> 
> DESTROY is called by perl when I unload mod_perl, Can I get it
> destroyed immediately after the script is executed.
> 
> Explicitly calling DESTROY in the script results in an error.
> 
> I hope Iam clear, 
> Thank You,
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
> For additional commands, e-mail: dev-help@perl.apache.org



-- 


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org