line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bigtop; |
2
|
1
|
|
|
1
|
|
29062
|
use strict; use warnings; |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings::register; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
182
|
|
5
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
96
|
|
6
|
1
|
|
|
1
|
|
6
|
use File::Spec; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
421
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.38'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub write_file { |
11
|
0
|
|
|
0
|
1
|
|
my $file_name = shift; |
12
|
0
|
|
|
|
|
|
my $content = shift; |
13
|
0
|
|
0
|
|
|
|
my $no_overwrite = shift || 0; |
14
|
|
|
|
|
|
|
|
15
|
0
|
0
|
0
|
|
|
|
if ( $no_overwrite and -e $file_name ) { |
16
|
0
|
0
|
|
|
|
|
if ( warnings::enabled() ) { |
17
|
0
|
|
|
|
|
|
warnings::warn( "$file_name already exists, skipping it.\n" ); |
18
|
|
|
|
|
|
|
} |
19
|
0
|
|
|
|
|
|
return; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my $FILE; |
23
|
|
|
|
|
|
|
|
24
|
0
|
0
|
|
|
|
|
unless ( open $FILE, '>', $file_name ) { |
25
|
0
|
|
|
|
|
|
croak "Couldn't write to $file_name: $!\n"; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
print $FILE $content; |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
unless( close $FILE ) { |
31
|
0
|
|
|
|
|
|
croak "Trouble closing $file_name: $!\n"; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub make_module_path { |
36
|
0
|
|
|
0
|
1
|
|
my $module_dir = shift; |
37
|
0
|
|
|
|
|
|
my $module_name = shift; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my @sub_dirs = split /::/, $module_name; |
40
|
|
|
|
|
|
|
# loop through subdirs, so we can make all the intervening paths |
41
|
0
|
|
|
|
|
|
foreach my $subdir ( 'lib', @sub_dirs ) { |
42
|
0
|
|
|
|
|
|
$module_dir = File::Spec->catdir( $module_dir, $subdir ); |
43
|
0
|
|
|
|
|
|
mkdir $module_dir; |
44
|
|
|
|
|
|
|
# mkdir can fail for two reasons, either the dir already exists, |
45
|
|
|
|
|
|
|
# in which case we don't care. Or, the directory could not be |
46
|
|
|
|
|
|
|
# made, then caller will notice when trying to write files to it |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
if ( wantarray ) { |
50
|
0
|
|
|
|
|
|
return $module_dir, @sub_dirs; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
else { |
53
|
0
|
|
|
|
|
|
$module_dir; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=begin NICE_TRY |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub setup_template { |
60
|
|
|
|
|
|
|
my $class = shift; |
61
|
|
|
|
|
|
|
my $template_text = shift || $class->get_default_template(); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
return if ( $class->template_is_setup() ); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
warn "about to bind for $class"; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
eval { |
68
|
|
|
|
|
|
|
package $class; |
69
|
|
|
|
|
|
|
Inline->bind( |
70
|
|
|
|
|
|
|
TT => $template_text, |
71
|
|
|
|
|
|
|
POST_CHOMP => 1, |
72
|
|
|
|
|
|
|
TRIM_LEADING_SPACE => 0, |
73
|
|
|
|
|
|
|
TRIM_TRAILING_SPACE => 0, |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
}; |
76
|
|
|
|
|
|
|
die $@ if $@; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
$class->template_is_setup( 1 ); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=end NICE_TRY |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
__END__ |