line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Widget; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
4
|
1
|
|
|
1
|
|
5
|
use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS $VERSION $AUTOLOAD); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
155
|
|
5
|
|
|
|
|
|
|
#use vars qw($VERSION $AUTOLOAD); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.15'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
require Exporter; |
10
|
|
|
|
|
|
|
@ISA = 'Exporter'; |
11
|
|
|
|
|
|
|
@EXPORT_OK = qw(AUTOLOAD); |
12
|
|
|
|
|
|
|
%EXPORT_TAGS = ( 'standard' => [qw(AUTOLOAD)] ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use overload |
15
|
1
|
|
|
|
|
9
|
'""' => \&asString, |
16
|
1
|
|
|
1
|
|
2573
|
fallback => 1; |
|
1
|
|
|
|
|
1965
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
1
|
|
|
1
|
0
|
39
|
my $class = shift; |
20
|
1
|
|
|
|
|
4
|
my $self = bless {}, $class; |
21
|
1
|
|
|
|
|
8
|
$self->_init(@_); |
22
|
1
|
|
|
|
|
3
|
return $self; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub import { |
26
|
2
|
|
|
2
|
|
10
|
my $exportset = $_[1]; |
27
|
2
|
|
|
|
|
6
|
my $to_package = ((caller)[0]); |
28
|
2
|
|
|
|
|
2
|
my $code = ''; |
29
|
|
|
|
|
|
|
|
30
|
2
|
50
|
|
|
|
54
|
return unless $exportset; |
31
|
|
|
|
|
|
|
|
32
|
0
|
0
|
0
|
|
|
|
if ($exportset eq ':html' or $exportset eq ':standard') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
$code = "*".$to_package."::AUTOLOAD = \\&AUTOLOAD_html"; |
34
|
|
|
|
|
|
|
} elsif ($exportset eq ':wml') { |
35
|
0
|
|
|
|
|
|
$code = "*".$to_package."::AUTOLOAD = \\&AUTOLOAD_wml"; |
36
|
|
|
|
|
|
|
} elsif ($exportset eq ':javascript') { |
37
|
0
|
|
|
|
|
|
$code = "*".$to_package."::AUTOLOAD = \\&AUTOLOAD_javascript"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
eval $code; |
41
|
0
|
0
|
|
|
|
|
die $@ if $@; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub AUTOLOAD_html { |
45
|
0
|
|
|
0
|
0
|
|
my ($pack,$func) = $AUTOLOAD =~ /(.+)::([^:]+)$/; |
46
|
0
|
|
|
|
|
|
$func =~ s/__/::/g; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $req = "CGI::Widget::$func"; |
49
|
0
|
0
|
|
|
|
|
eval "require $req" || die "couldn't find $req : $!"; |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
return CGI::Widget::html($func) unless $req->can('html'); |
52
|
0
|
|
|
|
|
|
return $req->html(@_); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub AUTOLOAD_wml { |
56
|
0
|
|
|
0
|
0
|
|
my ($pack,$func) = $AUTOLOAD =~ /(.+)::([^:]+)$/; |
57
|
0
|
|
|
|
|
|
$func =~ s/__/::/g; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $req = "CGI::Widget::$func"; |
60
|
0
|
0
|
|
|
|
|
eval "require $req" || die "couldn't find $req : $!"; |
61
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
return CGI::Widget::wml($func) unless $req->can('wml'); |
63
|
0
|
|
|
|
|
|
return $req->wml(@_); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub AUTOLOAD_javascript { |
67
|
0
|
|
|
0
|
0
|
|
my ($pack,$func) = $AUTOLOAD =~ /(.+)::([^:]+)$/; |
68
|
0
|
|
|
|
|
|
$func =~ s/__/::/g; |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my $req = "CGI::Widget::$func"; |
71
|
0
|
0
|
|
|
|
|
eval "require $req" || die "couldn't find $req : $!"; |
72
|
|
|
|
|
|
|
|
73
|
0
|
0
|
|
|
|
|
return CGI::Widget::javascript($func) unless $req->can('javascript'); |
74
|
0
|
|
|
|
|
|
return $req->javascript(@_); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub AUTOLOAD { |
78
|
0
|
|
|
0
|
|
|
my ($pack,$func) = $AUTOLOAD =~ /(.+)::([^:]+)$/; |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
$func =~ s/__/::/g; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my $req = "CGI::Widget::$func"; |
83
|
0
|
0
|
|
|
|
|
eval "require $req" || die "couldn't find $req : $!"; |
84
|
0
|
|
|
|
|
|
return $req->new(@_); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
0
|
|
|
sub DESTROY {} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub _init { |
90
|
0
|
|
|
0
|
|
|
my $self = shift; |
91
|
0
|
|
|
|
|
|
return 1; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
0
|
0
|
|
sub html { die "Looks like html() isn't defined in package ".shift; } |
95
|
0
|
|
|
0
|
0
|
|
sub wml { die "Looks like wml() isn't defined in package ".shift; } |
96
|
0
|
|
|
0
|
0
|
|
sub javascript { die "Looks like javascript() isn't defined in package ".shift; } |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub asString { |
99
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
100
|
0
|
|
|
|
|
|
return $self; #what did you expect from the base class? |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
104
|
|
|
|
|
|
|
__END__ |