File Coverage

blib/lib/MySQL/Admin/Session.pm
Criterion Covered Total %
statement 28 28 100.0
branch 7 10 70.0
condition 7 12 58.3
subroutine 9 9 100.0
pod 4 4 100.0
total 55 63 87.3


line stmt bran cond sub pod time code
1             package MySQL::Admin::Session;
2 2     2   381 use strict;
  2         2  
  2         42  
3 2     2   5 use warnings;
  2         2  
  2         33  
4 2     2   502 use utf8;
  2         9  
  2         6  
5             require Exporter;
6 2     2   58 use vars qw( $session $DefaultClass @EXPORT @ISA $defaultconfig);
  2         2  
  2         161  
7             @MySQL::Admin::Session::EXPORT = qw(loadSession saveSession $session);
8 2     2   301 use MySQL::Admin::Config;
  2         2  
  2         578  
9             @MySQL::Admin::Session::ISA = qw(Exporter MySQL::Admin::Config);
10             $MySQL::Admin::Session::VERSION = '1.12';
11             $DefaultClass = 'MySQL::Admin::Session' unless defined $MySQL::Admin::Session::DefaultClass;
12             $defaultconfig = '/var/www/cgi-bin/config/session.pl';
13              
14             =head1 NAME
15              
16             MySQL::Admin::Session - store the sessions for MySQL::Admin
17              
18             =head1 SYNOPSIS
19              
20             see l
21              
22             =head1 DESCRIPTION
23              
24             session for MySQL::Admin.
25              
26             =head2 EXPORT
27              
28             loadConfig() saveSession() $session
29              
30             =head1 Public
31              
32             =head2 new
33              
34             =cut
35              
36             sub new {
37 4     4 1 7 my ($class, @initializer) = @_;
38 4         9 my $self = {};
39 4   33     16 bless $self, ref $class || $class || $DefaultClass;
40 4         11 return $self;
41             }
42              
43             =head2 loadSession
44              
45             load session via do from disk.
46              
47             =cut
48              
49             sub loadSession {
50 3     3 1 310 my ($self, @p) = getSelf(@_);
51 3 100       10 my $do = (defined $p[0]) ? $p[0] : $defaultconfig;
52 3 100       30 if (-e $do) { do $do; }
  1         59  
53             }
54              
55             =head2 saveSession
56              
57             =cut
58              
59             sub saveSession {
60 1     1 1 16 my ($self, @p) = getSelf(@_);
61 1 50       3 my $l = defined $p[0] ? $p[0] : $defaultconfig;
62 1         25 $self->SUPER::saveConfig($l, $session, 'session');
63             }
64              
65             =head1 Private
66              
67             =head2 getSelf
68              
69             =cut
70              
71             sub getSelf {
72 4 50 66 4 1 25 return @_ if defined($_[0]) && (!ref($_[0])) && ($_[0] eq 'MySQL::Admin::Session');
      66        
73 4 50 66     34 return (defined($_[0])
74             && (ref($_[0]) eq 'MySQL::Admin::Session'
75             || UNIVERSAL::isa($_[0], 'MySQL::Admin::Session')))
76             ? @_
77             : ($MySQL::Admin::Session::DefaultClass->new, @_);
78             }
79              
80             =head1 AUTHOR
81              
82             Dirk Lindner
83              
84             =head2 see Also
85              
86             L L L L L L
87              
88             =head1 LICENSE
89              
90             Copyright (C) 2005-2015 by Hr. Dirk Lindner
91              
92             This program is free software; you can redistribute it and/or
93             modify it under the terms of the GNU Lesser General Public License
94             as published by the Free Software Foundation;
95             This program is distributed in the hope that it will be useful,
96             but WITHOUT ANY WARRANTY; without even the implied warranty of
97             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98             GNU Lesser General Public License for more details.
99              
100             =cut
101              
102             1;