line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::MicroMason::Functions; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
34
|
use strict; |
|
10
|
|
|
|
|
9
|
|
|
10
|
|
|
|
|
293
|
|
4
|
10
|
|
|
10
|
|
37
|
use vars qw( @ISA @EXPORT_OK ); |
|
10
|
|
|
|
|
11
|
|
|
10
|
|
|
|
|
413
|
|
5
|
|
|
|
|
|
|
|
6
|
10
|
|
|
10
|
|
29
|
use Exporter; |
|
10
|
|
|
|
|
10
|
|
|
10
|
|
|
|
|
1640
|
|
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
|
206
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub SafeMason { |
29
|
2
|
50
|
|
2
|
0
|
14
|
( -Safe, (ref($_[0]) =~ /Safe/) ? (safe => shift) : () ) |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub CatchingMason { |
33
|
13
|
|
|
13
|
0
|
68
|
( -CatchErrors ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub SafeCatchingMason { |
37
|
0
|
0
|
|
0
|
0
|
0
|
( -CatchErrors, -Safe, (ref($_[0]) =~ /Safe/) ? (safe => shift) : () ) |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
foreach my $sub (@EXPORT_OK ) { |
41
|
10
|
|
|
10
|
|
35
|
no strict 'refs'; |
|
10
|
|
|
|
|
10
|
|
|
10
|
|
|
|
|
1550
|
|
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
|
66
|
100
|
|
66
|
|
64465
|
Text::MicroMason->new( &$mason ) |
50
|
|
|
|
|
|
|
->$method( (ref($_[0]) eq 'CODE') ? 'code' : $source => @_ ) |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
###################################################################### |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |