File Coverage

blib/lib/Win32/ASP/Extras.pm
Criterion Covered Total %
statement 27 38 71.0
branch 0 8 0.0
condition n/a
subroutine 6 8 75.0
pod 2 2 100.0
total 35 56 62.5


line stmt bran cond sub pod time code
1             ###########################################################################
2             #
3             # Win32::ASP::Extras - a extension to Win32::ASP that provides more methods
4             #
5             # Author: Toby Everett
6             # Revision: 1.01
7             # Last Change: Placed all the code in Win32::ASP::Extras, added load time
8             # code to patch into the Win32::ASP namespace
9             ###########################################################################
10             # Copyright 1999, 2000 Toby Everett. All rights reserved.
11             #
12             # This file is distributed under the Artistic License. See
13             # http://www.ActiveState.com/corporate/artistic_license.htm or
14             # the license that comes with your perl distribution.
15             #
16             # For comments, questions, bugs or general interest, feel free to
17             # contact Toby Everett at teverett@alascom.att.com
18             ##########################################################################
19 1     1   2036 use Data::Dumper;
  1         11288  
  1         79  
20            
21 1     1   8 use strict;
  1         2  
  1         51  
22            
23             package Win32::ASP::Extras;
24 1     1   5 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
  1         6  
  1         95  
25            
26             BEGIN {
27 1     1   5 require Exporter;
28 1         925 require AutoLoader;
29            
30 1     1   4 use vars qw( @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS );
  1         2  
  1         90  
31            
32 1         1607 @ISA = qw(Exporter AutoLoader);
33 1         3 @EXPORT = qw( );
34 1         2 %EXPORT_TAGS = ( );
35 1         2 @EXPORT_OK = qw ( );
36 1         49 Exporter::export_ok_tags( ); # Add all strict vars to @EXPORT_OK
37            
38             {
39 1     1   5 no strict;
  1         1  
  1         62  
  1         2  
40 1         2 foreach my $i (qw(Set Get FormatURL _FormatURL QueryStringList Redirect MyURL
41             CreatePassURLPair GetPassURL PassURLPair StampPage)) {
42 11         12 *{"Win32::ASP::$i"} = *{$i};
  11         214  
  11         36  
43             }
44             }
45             }
46            
47             $VERSION='1.01';
48            
49             #Get and Set have to be preloaded because they use a shared, lexically scoped hash for
50             #memoization
51            
52             {
53            
54             my %memo;
55            
56             sub Set {
57 0     0 1   my($name, $thing) = @_;
58            
59 0           $main::Session->{$name} = Data::Dumper->Dump([$thing], ['thing']);
60 0 0         exists $memo{$name} and delete $memo{$name};
61             }
62            
63             sub Get {
64 0     0 1   my($name) = @_;
65            
66 0 0         unless (exists $memo{$name}) {
67 0 0         my $string = $main::Session->{$name} or return;
68 0           my $thing;
69 0           eval($string);
70 0 0         $@ and return;
71 0           $memo{$name} = $thing;
72             }
73 0           return $memo{$name};
74             }
75            
76             }
77            
78             # Autoload methods go after =cut, and are processed by the autosplit program.
79            
80             1;
81             __END__