line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::MicroMason::Functions; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
57
|
use strict; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
284
|
|
4
|
10
|
|
|
10
|
|
45
|
use vars qw( @ISA @EXPORT_OK ); |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
580
|
|
5
|
|
|
|
|
|
|
|
6
|
10
|
|
|
10
|
|
51
|
use Exporter; |
|
10
|
|
|
|
|
15
|
|
|
10
|
|
|
|
|
1886
|
|
7
|
|
|
|
|
|
|
@ISA = 'Exporter'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
@EXPORT_OK = ( |
10
|
|
|
|
|
|
|
'compile', # $code_ref = compile( $mason_text ); |
11
|
|
|
|
|
|
|
'compile_file', # $code_ref = compile_file( $filename ); |
12
|
|
|
|
|
|
|
'safe_compile', # $code_ref = safe_compile( $mason_text ); |
13
|
|
|
|
|
|
|
'safe_compile_file', # $code_ref = safe_compile_file( $filename ); |
14
|
|
|
|
|
|
|
'execute', # $result = execute( $filename, %args ); |
15
|
|
|
|
|
|
|
'execute_file', # $result = execute_file( $filename, %args ); |
16
|
|
|
|
|
|
|
'safe_execute', # $result = safe_execute( $mason_text, %args ); |
17
|
|
|
|
|
|
|
'safe_execute_file', # $result = safe_execute_file( $filename, %args ); |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
push @EXPORT_OK, map "try_$_", @EXPORT_OK; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
###################################################################### |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub Mason { |
25
|
|
|
|
|
|
|
() |
26
|
51
|
|
|
51
|
0
|
210
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub SafeMason { |
29
|
9
|
100
|
|
9
|
0
|
68
|
( -Safe, (ref($_[0]) =~ /Safe/) ? (safe => shift) : () ) |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub CatchingMason { |
33
|
13
|
|
|
13
|
0
|
85
|
( -CatchErrors ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub SafeCatchingMason { |
37
|
11
|
100
|
|
11
|
0
|
77
|
( -CatchErrors, -Safe, (ref($_[0]) =~ /Safe/) ? (safe => shift) : () ) |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
foreach my $sub (@EXPORT_OK ) { |
41
|
10
|
|
|
10
|
|
63
|
no strict 'refs'; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
1828
|
|
42
|
|
|
|
|
|
|
my $method = $sub; |
43
|
|
|
|
|
|
|
my $source = ( $method =~ s/_file// ) ? 'file' : 'text'; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $mason = "Mason"; |
46
|
|
|
|
|
|
|
$mason = "Catching$mason" if ( $method =~ s/try_// ); |
47
|
|
|
|
|
|
|
$mason = "Safe$mason" if ( $method =~ s/safe_// ); |
48
|
|
|
|
|
|
|
*{__PACKAGE__."::$sub"} = sub { |
49
|
84
|
100
|
|
84
|
|
126472
|
Text::MicroMason->new( &$mason ) |
50
|
|
|
|
|
|
|
->$method( (ref($_[0]) eq 'CODE') ? 'code' : $source => @_ ) |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
###################################################################### |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |