blib/lib/Acme/Bushisms.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 16 | 20 | 80.0 |
branch | n/a | ||
condition | n/a | ||
subroutine | 7 | 8 | 87.5 |
pod | 0 | 4 | 0.0 |
total | 23 | 32 | 71.8 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Acme::Bushisms; | ||||||
2 | $VERSION = '0.02'; | ||||||
3 | $arab = " \t"x8; | ||||||
4 | 0 | 0 | 0 | 0 | sub invade { local $_ = unpack "b*", pop; tr/01/ \t/; s/(.{9})/$1\n/g; $arab.$_ } | ||
0 | 0 | ||||||
0 | 0 | ||||||
0 | 0 | ||||||
5 | 1 | 1 | 0 | 3 | sub leave { local $_ = pop; s/^$arab|[^ \t]//g; tr/ \t/01/; pack "b*", $_ } | ||
1 | 659 | ||||||
1 | 12 | ||||||
1 | 164 | ||||||
6 | 1 | 1 | 0 | 6 | sub oil { $_[0] =~ /\S/ } | ||
7 | 1 | 1 | 0 | 34 | sub drill { $_[0] =~ /^$arab/ } | ||
8 | |||||||
9 | open 0 or print "Can't open '$0'\n" and exit; | ||||||
10 | $iraq = join "", <0>; | ||||||
11 | $iraq =~ s/.*^\s*use\s+Acme::Bushisms\s*;\n\n(?:.*?George.*?\n)?//sm; | ||||||
12 | local $SIG{__WARN__} = \&oil; | ||||||
13 | 1 | 1 | 1091 | do {eval leave $iraq; exit} unless oil $iraq && not drill $iraq; | |||
1 | 1 | 3959 | |||||
1 | 1 | 131 | |||||
1 | 4 | ||||||
1 | 336 | ||||||
1 | 1 | ||||||
1 | 26 | ||||||
14 | |||||||
15 | 1 | 1 | 1592 | use LWP::Simple qw($ua get); | |||
1 | 71270 | ||||||
1 | 8 | ||||||
16 | $ua ->timeout(10); | ||||||
17 | $lies = get("http://slate.msn.com/id/76886/"); | ||||||
18 | if (not defined $lies) { | ||||||
19 | $dubya =< | ||||||
20 | "I know the human being and fish can coexist peacefully." | ||||||
21 | --George W Bush, Saginaw, Mich., Sept. 29, 2000 | ||||||
22 | EOF | ||||||
23 | } | ||||||
24 | else { | ||||||
25 | ($bush) = $lies =~ /(<\/p> .*?\".*<\/p> )/sm; |
||||||
26 | $bush =~ s/\(\s*thank.*?\)//ismg; | ||||||
27 | $bush =~ s/<\/?[^p][^>]+>//g; | ||||||
28 | $bush =~ s/\&\w+\;//g; | ||||||
29 | $bush =~ s/("--|("|'|\s)[^\w\s\r\"\.\']{3,3})/"\n--George W Bush, /ig; | ||||||
30 | $bush =~ s/[^\w\s\r\"\.\']{3,3}/--/g; | ||||||
31 | @quotes = $bush =~ / +(\".*?) +/smg; |
||||||
32 | $dubya = $quotes[rand @quotes]; | ||||||
33 | $dubya = $dubya . "\n--George W Bush" | ||||||
34 | unless ($dubya =~ /--George/); | ||||||
35 | } | ||||||
36 | $dubya =~ s/\s+$//; | ||||||
37 | |||||||
38 | |||||||
39 | open 0, ">$0" or print "Cannot invade '$0'\n" and exit; | ||||||
40 | print {0} "use Acme::Bushisms;\n\n$dubya\n", invade $iraq and exit; | ||||||
41 | __END__ |