| 1 | package Acme::Takahashi::Method; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | our $VERSION = sprintf "%d.%02d", q$Revision: 0.1 $ =~ /(\d+)/g; | |||||||||||
| 6 | 1 | our $DEBUG = 0; | |||||||||||
| 7 | |||||||||||||
| 8 | 0 | ▶ | sub make_slide{ | ||||||||||
|
Subroutine
make_slide: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||
| 9 | 0 | my ($src, $columns, $rows) = @_; | |||||||||||
| 10 | 0 | ▶ | open my $in, "<:raw", $src or die "$src:$!"; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 11 | 0 | my $counter = 0; | |||||||||||
| 12 | 0 | my $vspace = "\n" x ($rows/2 - 1); | |||||||||||
| 13 | 0 | ▶ | while(defined(my $line = <$in>)){ | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 14 | 0 | ▶ | $line =~ q/^use Acme::Takahashi::Method/ and next; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 15 | 0 | $line =~ s/#.*//; | |||||||||||
| 16 | 0 | ▶ | $line =~ /^$/ and next; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 17 | 0 | my $slide = "$src." . $counter++; | |||||||||||
| 18 | 0 | ▶ | $DEBUG and warn $slide; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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 | ▶ | open my $out, ">:raw", $slide or die "$slide : $!"; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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 | 0 | ▶ | sub do_slides{ | ||||||||||
|
Subroutine
do_slides: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 32 | 0 | my $src = shift; | |||||||||||
| 33 | 0 | do qq($src); | |||||||||||
| 34 | } | ||||||||||||
| 35 | |||||||||||||
| 36 | 0 | ▶ | sub clobber{ | ||||||||||
|
Subroutine
clobber: not called CC=2 SCAR=13.7
Pod
undocumented
| |||||||||||||
| 37 | 0 | my ($src, $columns, $rows) = @_; | |||||||||||
| 38 | 1 | ▶ | use Config; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 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 | ▶ | open my $out, ">:raw", $src or die "$src : $!"; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 45 | 0 | print $out "#!", $thisperl, | |||||||||||
| 46 | $vspace, $hspace, $line, $vspace, $next, "\n"; | ||||||||||||
| 47 | 0 | close $out; | |||||||||||
| 48 | } | ||||||||||||
| 49 | |||||||||||||
| 50 | 0 | ▶ | sub show_slides{ | ||||||||||
|
Subroutine
show_slides: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||
| 51 | 0 | my ($src, $nslides) = @_; | |||||||||||
| 52 | 0 | for my $slide ($src, map { "$src.$_" } (0 .. $nslides-1)){ | |||||||||||
| 53 | 0 | system "clear"; | |||||||||||
| 54 | 0 | ▶ | open my $in, "<:raw", $slide or die "$slide : $!"; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 55 | 0 | print <$in>; | |||||||||||
| 56 | 0 | close $in; | |||||||||||
| 57 | 0 | my $key = getc; | |||||||||||
| 58 | } | ||||||||||||
| 59 | 0 | system "clear"; | |||||||||||
| 60 | } | ||||||||||||
| 61 | |||||||||||||
| 62 | 0 | ▶ | sub import{ | ||||||||||
|
Subroutine
import: not called CC=8 SCAR=42.8
| |||||||||||||
| 63 | 0 | my $pkg = shift; | |||||||||||
| 64 | 0 | my %arg = @_; | |||||||||||
| 65 | #use Data::Dumper; | ||||||||||||
| 66 | #print Dumper \%args; | ||||||||||||
| 67 | 0 | ▶ | my $columns = $arg{columns} || 80; | ||||||||||
|
Condition0%0/2
$arg{'columns'} || 80
MC/DC0%0/1
$arg{'columns'} || 80
$arg{'columns'}
Truth table0%0/2
A
A= $arg{'columns'}
| |||||||||||||
| 68 | 0 | ▶ | my $rows = $arg{rows} || 24; | ||||||||||
|
Condition0%0/2
$arg{'rows'} || 24
MC/DC0%0/1
$arg{'rows'} || 24
$arg{'rows'}
Truth table0%0/2
A
A= $arg{'rows'}
| |||||||||||||
| 69 | 0 | ▶ | my $show_slide = !$arg{noslideshow} || 1; | ||||||||||
|
Condition0%0/2
!$arg{'noslideshow'} || 1
MC/DC0%0/1
!$arg{'noslideshow'} || 1
!$arg{'noslideshow'}
Truth table0%0/2
not(A)
A= !$arg{'noslideshow'}
| |||||||||||||
| 70 | 0 | ▶ | $arg{debug} and $DEBUG = 1; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 71 | 0 | my $nslides = make_slide($0, $columns, $rows); | |||||||||||
| 72 | 0 | ▶ | clobber($0, $columns, $rows) unless $arg{noclobber}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 73 | 0 | ▶ | show_slides($0, $nslides) if $show_slide; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 74 | 0 | ▶ | do_slides($0) unless $arg{noexec}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 75 | 0 | exit; | |||||||||||
| 76 | } | ||||||||||||
| 77 | |||||||||||||
| 78 | 1 | 1; | |||||||||||
| 79 | __END__ | ||||||||||||