AutoSession

 view release on metacpan or  search on metacpan

lib/AutoSession.pm  view on Meta::CPAN

sub id {
  my $this = shift ;
  return $$this->{driver}->{id} ;
}

########
# NAME #
########

sub name {
  my $this = shift ;
  return $$this->{name} ;
}

##########
# DRIVER #
##########

sub driver {
  my $this = shift ;
  return uc($$this->{driver}->{type}) ;
}

#############
# DIRECTORY #
#############

sub directory {
  my $this = shift ;
  return $$this->{driver}->{dir} ;
}

############
# AUTOLOAD #
############

sub autoload {
  my $this = shift ;
  return $$this->{autoload} ;
}

##########
# EXISTS #
##########

sub exists {
  my $this = shift ;
  if ( $this->exist_id ) { return 1 ;}
  return undef ;
}

###############
# COOKIE_LINE #
###############

sub cookie_line {
  my $this = shift ;
  my $name = $this->name ;
  my $id = $this->id ;
  
  my $line = qq`Set-Cookie: AutoSession=$name:$id` ;
  return( $line ) ;
}

############
# HASH_REF #
############

sub hash_ref {
  my $this = shift ;
  return $$this->{driver}{tree} ;
}

##################
# _OVER_GET_HASH #
##################

sub _OVER_get_hash {
  my $this = shift ;
  
  if ( $$this->{driver}{closed} ) { return( {} ) ;}
  
  if ( ! $$this->{hash} ) {
    my %hash ;
    $$this->{hash} = \%hash ;
    tie(%hash, 'AutoSession::TieHandle' , $$this->{driver}) ;
    $$this->{driver}->load ;
  }

  return( $$this->{hash} ) ;
}

###########
# DESTROY #
###########

sub DESTROY {
  my $this = shift ;
  
  $this->check_expired if $$this->{driver} ;
  
  delete $$this->{driver} ;
  
  untie $$this->{hash} ;
  delete $$this->{hash} ;
}

#######
# END #
#######


1;


__END__

=head1 NAME

AutoSession - Automatically Session module for Web/CGI & scripts.



( run in 0.880 second using v1.01-cache-2.11-cpan-39bf76dae61 )