OpenFrame::WebApp::Segment::Session - abstract class for getting Sessions


OpenFrame-WebApp documentation Contained in the OpenFrame-WebApp distribution.

Index


Code Index:

NAME

Top

OpenFrame::WebApp::Segment::Session - abstract class for getting Sessions from the store.

SYNOPSIS

Top

  # abstract class - cannot be used directly

  use base qw( OpenFrame::WebApp::Segment::Session );

  sub dispatch {
      ...
      my $session $self->get_session_from_store;
      ...
  }

DESCRIPTION

Top

The OpenFrame::WebApp::Segment::Session class provides a method for getting Session objects from the store.

This class inherits its interface from Pipeline::Segment. You must override dispatch() for it to do anything.

METHODS

Top

get_session_from_store

If the store is a Pipeline::Store::ISA, looks for a descendant of OpenFrame::WebApp::Session, otherwise looks for known OpenFrame::WebApp::Session->types().

AUTHOR

Top

Steve Purkis <spurkis@epn.nu>

COPYRIGHT

Top

SEE ALSO

Top

Pipeline::Segment, OpenFrame::WebApp::Session


OpenFrame-WebApp documentation Contained in the OpenFrame-WebApp distribution.
package OpenFrame::WebApp::Segment::Session;

use strict;
use warnings::register;

use OpenFrame::WebApp::Session;
use OpenFrame::WebApp::Error::Abstract;

our $VERSION = (split(/ /, '$Revision: 1.2 $'))[1];

use base qw( Pipeline::Segment );

## try various methods to find a session in the store
sub get_session_from_store {
    my $self = shift;
    my $session;

    if ($self->store->isa( 'Pipeline::Store::ISA' )) {
	$session = $self->store->get('OpenFrame::WebApp::Session');
    } else {
	foreach my $class (values %{ OpenFrame::WebApp::Session->types }) {
	    last if( $session = $self->store->get($class) );
	}
    }

    return $session;
}

1;

__END__