← Index
Performance Profile   « block view • line view • sub view »
For opac/opac-main.pl
  Run on Fri Jul 18 13:58:34 2008
Reported on Fri Jul 18 13:58:43 2008

File/usr/share/perl5/CGI/Session/Serialize/yaml.pm
Statements Executed17
Total Time0.0003 seconds

Subroutines — ordered by inclusive time then name
CallsInclusive
Time
Subroutine
10.00016CGI::Session::Serialize::yaml::freeze
00CGI::Session::Serialize::yaml::thaw

LineStmts.Exclusive
Time
Avg.Code
1package CGI::Session::Serialize::yaml;
2
330.000039e-06use strict;
# spent 0.00001s making 1 calls to strict::import
430.000180.00006use CGI::Session::ErrorHandler;
# spent 3e-06s making 1 calls to 1
5
611e-061e-06$CGI::Session::Serialize::yaml::VERSION = '4.20';
712e-062e-06@CGI::Session::Serialize::yaml::ISA = ( "CGI::Session::ErrorHandler" );
811e-061e-06our $Flavour;
9
10100unless($Flavour) {
1130.000060.00002 my $package = (grep { eval("use $_ (); 1;") } qw(YAML::Syck YAML))[0]
12 or die "Either YAML::Syck or YAML are required to use ", __PACKAGE__;
1311e-061e-06 $Flavour = $package;
14}
15
16
# spent 0.00016s within CGI::Session::Serialize::yaml::freeze which was called: # 1 times (0.00016s) by CGI::Session::flush at line 240 of /usr/share/perl5/CGI/Session.pm
sub freeze {
1711e-061e-06 my ($self, $data) = @_;
1810.000020.00002 return $Flavour->can('Dump')->($data);
# spent 0.00014s making 1 calls to YAML::Syck::Dump # spent 7e-06s making 1 calls to UNIVERSAL::can
19}
20
21
22sub thaw {
23 my ($self, $string) = @_;
24 return ($Flavour->can('Load')->($string))[0];
25}
26
2719e-069e-061;
28
29__END__;
30
31=pod
32
33=head1 NAME
34
35CGI::Session::Serialize::yaml - serializer for CGI::Session
36
37=head1 DESCRIPTION
38
39This library can be used by CGI::Session to serialize session data. It uses
40L<YAML|YAML>, or the faster C implementation, L<YAML::Syck|YAML::Syck>
41if it is available. YAML serializers exist not just for Perl but also other
42dynamic languages, such as PHP, Python, and Ruby, so storing session data
43in this format makes it easy to share session data across different languages.
44
45YAML is made to be friendly for humans to parse as well as other computer
46languages. It creates a format that is easier to read than the default
47serializer.
48
49=head1 METHODS
50
51=over 4
52
53=item freeze($class, \%hash)
54
55Receives two arguments. First is the class name, the second is the data to be serialized. Should return serialized string on success, undef on failure. Error message should be set using C<set_error()|CGI::Session::ErrorHandler/"set_error()">
56
57=item thaw($class, $string)
58
59Received two arguments. First is the class name, second is the I<YAML> data string. Should return thawed data structure on success, undef on failure. Error message should be set using C<set_error()|CGI::Session::ErrorHandler/"set_error()">
60
61=back
62
63=head1 SEE ALSO
64
65L<CGI::Session>, L<YAML>, L<YAML::Syck>.
66
67=cut