Apache-Session-Wrapper

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN



0.19   2005-02-15

- Add support for Apache::RequestRec as header_object by checking
  header_object for err_headers_out and headers_out methods.


0.18   2004-06-30

- Made the password & lock_password parameters default to undef.


0.17   2004-04-23

- Fix a bug in checking parameters which could occur when the "commit"
  parameter for Postgres, Oracle, or Sybcase was passed.  This caused
  a fatal error when creating the wrapper object.  Patch by Max Baker.


0.16   2004-04-08

lib/Apache/Session/Wrapper.pm  view on Meta::CPAN

      data_source =>
      { type => SCALAR,
	optional => 1,
	descr => 'The data source when using MySQL or PostgreSQL' },

      user_name =>
      { type => UNDEF | SCALAR,
        optional => 1,
	descr => 'The user name to be used when connecting to a database' },

      password =>
      { type => UNDEF | SCALAR,
	default => undef,
	descr => 'The password to be used when connecting to a database' },

      table_name =>
      { type => UNDEF | SCALAR,
        optional => 1,
        descr => 'The table in which sessions are saved' },

      lock_data_source =>
      { type => SCALAR,
	optional => 1,
	descr => 'The data source when using MySQL or PostgreSQL' },

      lock_user_name =>
      { type => UNDEF | SCALAR,
        optional => 1,
	descr => 'The user name to be used when connecting to a database' },

      lock_password =>
      { type => UNDEF | SCALAR,
	default => undef,
	descr => 'The password to be used when connecting to a database' },

      handle =>
      { type => OBJECT,
        optional => 1,
	descr => 'An existing database handle to use' },

      lock_handle =>
      { type => OBJECT,
        optional => 1,
	descr => 'An existing database handle to use' },

lib/Apache/Session/Wrapper.pm  view on Meta::CPAN

      File     => [ [ qw( directory lock_directory ) ] ],
      DB_File  => [ [ qw( file_name lock_directory ) ] ],

      PHP      => [ [ qw( save_path ) ] ],
    );

@ApacheSessionParams{ qw( Informix Oracle Sybase ) } =
    ( $ApacheSessionParams{Postgres} ) x 3;

my %OptionalApacheSessionParams =
    ( MySQL    => [ [ qw( table_name password lock_password ) ] ],
      Postgres => [ [ qw( table_name password ) ] ],
      Informix => [ [ qw( table_name password ) ] ],
      Oracle   => [ [ qw( long_read_len table_name password ) ] ],
      Sybase   => [ [ qw( textsize table_name password ) ] ],
    );

my %ApacheSessionFlexParams =
    ( store =>
      { MySQL    => [ [ qw( data_source user_name ) ],
		      [ qw( handle ) ] ],
	Postgres => $ApacheSessionParams{Postgres},
	File     => [ [ qw( directory ) ] ],
	DB_File  => [ [ qw( file_name ) ] ],
	PHP      => $ApacheSessionParams{PHP},

lib/Apache/Session/Wrapper.pm  view on Meta::CPAN

=item * data_source  =>  DSN

Corresponds to the C<DataSource> parameter passed to the DBI-related
session modules.

=item * user_name  =>  user name

Corresponds to the C<UserName> parameter passed to the DBI-related
session modules.

=item * password  =>  password

Corresponds to the C<Password> parameter passed to the DBI-related
session modules.  Defaults to undef.

=item * handle =>  DBI handle

Corresponds to the C<Handle> parameter passed to the DBI-related
session modules.  This cannot be set via the F<httpd.conf> file,
because it needs to be an I<actual Perl variable>, not the I<name> of
that variable.

lib/Apache/Session/Wrapper.pm  view on Meta::CPAN

=item * lock_data_source  =>  DSN

Corresponds to the C<LockDataSource> parameter passed to
C<Apache::Session::MySQL>.

=item * lock_user_name  =>  user name

Corresponds to the C<LockUserName> parameter passed to
C<Apache::Session::MySQL>.

=item * lock_password  =>  password

Corresponds to the C<LockPassword> parameter passed to
C<Apache::Session::MySQL>.  Defaults to undef.

=item * lock_handle  =>  DBI handle

Corresponds to the C<LockHandle> parameter passed to the DBI-related
session modules.  As with the C<handle> parameter, this cannot
be set via the F<httpd.conf> file.

t/01-basic.t  view on Meta::CPAN


    my $wrapper =
        eval { local $^W = 0;
               Apache::Session::Wrapper->new( class     => 'Flex',
                                              store     => 'MySQL',
                                              lock      => 'Null',
                                              generate  => 'MD5',
                                              serialize => 'Storable',
                                              data_source => 'foo',
                                              user_name   => 'bar',
                                              password    => 'baz',
                                            ) };
    unlike( $@, qr/parameters/, 'pass correct parameters for MySQL flex' );

    is( $wrapper->{params}{DataSource}, 'foo', 'DataSource is foo' );
    is( $wrapper->{params}{UserName}, 'bar', 'UserName is bar' );
    is( $wrapper->{params}{Password}, 'baz', 'Password is baz' );
}

{
    eval { local $^W = 0;
           Apache::Session::Wrapper->new( class       => 'Postgres',
                                          data_source => 'foo',
                                          user_name   => 'foo',
                                          password    => 'foo',
                                          commit      => 0,
                                        ) };
    unlike( $@, qr/parameters/, 'first param set for Pg' );
}

{
    my $dbh = bless {}, 'DBI';

    eval { local $^W = 0;
           Apache::Session::Wrapper->new( class  => 'Postgres',



( run in 0.463 second using v1.01-cache-2.11-cpan-49f99fa48dc )