line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Takahashi::Method; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
964
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
587
|
|
5
|
|
|
|
|
|
|
our $VERSION = sprintf "%d.%02d", q$Revision: 0.1 $ =~ /(\d+)/g; |
6
|
|
|
|
|
|
|
our $DEBUG = 0; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub make_slide{ |
9
|
0
|
|
|
0
|
0
|
|
my ($src, $columns, $rows) = @_; |
10
|
0
|
0
|
|
|
|
|
open my $in, "<:raw", $src or die "$src:$!"; |
11
|
0
|
|
|
|
|
|
my $counter = 0; |
12
|
0
|
|
|
|
|
|
my $vspace = "\n" x ($rows/2 - 1); |
13
|
0
|
|
|
|
|
|
while(defined(my $line = <$in>)){ |
14
|
0
|
0
|
|
|
|
|
$line =~ q/^use Acme::Takahashi::Method/ and next; |
15
|
0
|
|
|
|
|
|
$line =~ s/#.*//; |
16
|
0
|
0
|
|
|
|
|
$line =~ /^$/ and next; |
17
|
0
|
|
|
|
|
|
my $slide = "$src." . $counter++; |
18
|
0
|
0
|
|
|
|
|
$DEBUG and warn $slide; |
19
|
0
|
|
|
|
|
|
my $hspace = " " x (($columns - length($line))/2); |
20
|
0
|
|
|
|
|
|
my $next = sprintf(qq(do "$src.%d";), $counter); |
21
|
0
|
|
|
|
|
|
my $page = "# $counter"; |
22
|
0
|
|
|
|
|
|
my $pagespace = " " x ($columns - length($next) - length($page)); |
23
|
0
|
0
|
|
|
|
|
open my $out, ">:raw", $slide or die "$slide : $!"; |
24
|
0
|
|
|
|
|
|
print $out |
25
|
|
|
|
|
|
|
$vspace, $hspace, $line, $vspace, $next, $pagespace, $page, "\n"; |
26
|
0
|
|
|
|
|
|
close $out; |
27
|
|
|
|
|
|
|
} |
28
|
0
|
|
|
|
|
|
return $counter; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub do_slides{ |
32
|
0
|
|
|
0
|
0
|
|
my $src = shift; |
33
|
0
|
|
|
|
|
|
do qq($src); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub clobber{ |
37
|
0
|
|
|
0
|
0
|
|
my ($src, $columns, $rows) = @_; |
38
|
1
|
|
|
1
|
|
25
|
use Config; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
540
|
|
39
|
0
|
|
|
|
|
|
my $vspace = "\n" x ($rows/2 - 1); |
40
|
0
|
|
|
|
|
|
my $line = "# $src"; |
41
|
0
|
|
|
|
|
|
my $hspace = " " x (($columns - length($line))/2); |
42
|
0
|
|
|
|
|
|
my $next = qq(do "$src.0";); |
43
|
0
|
|
|
|
|
|
my $thisperl = $Config{perlpath}; |
44
|
0
|
0
|
|
|
|
|
open my $out, ">:raw", $src or die "$src : $!"; |
45
|
0
|
|
|
|
|
|
print $out "#!", $thisperl, |
46
|
|
|
|
|
|
|
$vspace, $hspace, $line, $vspace, $next, "\n"; |
47
|
0
|
|
|
|
|
|
close $out; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub show_slides{ |
51
|
0
|
|
|
0
|
0
|
|
my ($src, $nslides) = @_; |
52
|
0
|
|
|
|
|
|
for my $slide ($src, map { "$src.$_" } (0 .. $nslides-1)){ |
|
0
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
system "clear"; |
54
|
0
|
0
|
|
|
|
|
open my $in, "<:raw", $slide or die "$slide : $!"; |
55
|
0
|
|
|
|
|
|
print <$in>; |
56
|
0
|
|
|
|
|
|
close $in; |
57
|
0
|
|
|
|
|
|
my $key = getc; |
58
|
|
|
|
|
|
|
} |
59
|
0
|
|
|
|
|
|
system "clear"; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub import{ |
63
|
0
|
|
|
0
|
|
|
my $pkg = shift; |
64
|
0
|
|
|
|
|
|
my %arg = @_; |
65
|
|
|
|
|
|
|
#use Data::Dumper; |
66
|
|
|
|
|
|
|
#print Dumper \%args; |
67
|
0
|
|
0
|
|
|
|
my $columns = $arg{columns} || 80; |
68
|
0
|
|
0
|
|
|
|
my $rows = $arg{rows} || 24; |
69
|
0
|
|
0
|
|
|
|
my $show_slide = !$arg{noslideshow} || 1; |
70
|
0
|
0
|
|
|
|
|
$arg{debug} and $DEBUG = 1; |
71
|
0
|
|
|
|
|
|
my $nslides = make_slide($0, $columns, $rows); |
72
|
0
|
0
|
|
|
|
|
clobber($0, $columns, $rows) unless $arg{noclobber}; |
73
|
0
|
0
|
|
|
|
|
show_slides($0, $nslides) if $show_slide; |
74
|
0
|
0
|
|
|
|
|
do_slides($0) unless $arg{noexec}; |
75
|
0
|
|
|
|
|
|
exit; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
__END__ |