| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# $Id$ |
|
2
|
|
|
|
|
|
|
####################################################################### |
|
3
|
|
|
|
|
|
|
# housekeeping |
|
4
|
|
|
|
|
|
|
####################################################################### |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Object::Exercise::Common; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require 5.6.2; |
|
9
|
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
|
27
|
use strict; |
|
|
5
|
|
|
|
|
10
|
|
|
|
5
|
|
|
|
|
273
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
5
|
|
|
5
|
|
5159
|
use IO::Handle; |
|
|
5
|
|
|
|
|
34022
|
|
|
|
5
|
|
|
|
|
291
|
|
|
13
|
5
|
|
|
5
|
|
6530
|
use Data::Dumper; |
|
|
5
|
|
|
|
|
56005
|
|
|
|
5
|
|
|
|
|
465
|
|
|
14
|
5
|
|
|
5
|
|
53
|
use Symbol qw( qualify_to_ref ); |
|
|
5
|
|
|
|
|
13
|
|
|
|
5
|
|
|
|
|
1901
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
######################################################################## |
|
17
|
|
|
|
|
|
|
# package variables |
|
18
|
|
|
|
|
|
|
######################################################################## |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = 1.00; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
######################################################################## |
|
23
|
|
|
|
|
|
|
# utility subs & variables shared among Object::Execute & friends. |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my %exportz = |
|
26
|
|
|
|
|
|
|
( |
|
27
|
|
|
|
|
|
|
log_message => |
|
28
|
|
|
|
|
|
|
sub |
|
29
|
|
|
|
|
|
|
{ |
|
30
|
|
|
|
|
|
|
# note that re-opening STDERR will re-direct the commant. |
|
31
|
|
|
|
|
|
|
# there usually aren't enough log messages to make the |
|
32
|
|
|
|
|
|
|
# {IO} operation significant over the execution. |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
local $Data::Dumper::Purity = 0; |
|
35
|
|
|
|
|
|
|
local $Data::Dumper::Terse = 1; |
|
36
|
|
|
|
|
|
|
local $Data::Dumper::Indent = 1; |
|
37
|
|
|
|
|
|
|
local $Data::Dumper::Deparse = 1; |
|
38
|
|
|
|
|
|
|
local $Data::Dumper::Sortkeys = 1; |
|
39
|
|
|
|
|
|
|
local $Data::Dumper::Deepcopy = 0; |
|
40
|
|
|
|
|
|
|
local $Data::Dumper::Quotekeys = 0; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
local $, = "\n"; |
|
43
|
|
|
|
|
|
|
local $\ = "\n"; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
*STDERR{ IO }->printflush( map { ref $_ ? Dumper $_ : $_ } @_ ); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
() |
|
48
|
|
|
|
|
|
|
}, |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# these are set in Exercise::import, used in |
|
51
|
|
|
|
|
|
|
# Execute & Benchmark. |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
continue => \( my $a = '' ), |
|
54
|
|
|
|
|
|
|
verbose => \( my $b = '' ), |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub import |
|
58
|
|
|
|
|
|
|
{ |
|
59
|
12
|
|
|
12
|
|
576
|
my $caller = caller; |
|
60
|
12
|
|
|
|
|
25
|
my $package = __PACKAGE__; |
|
61
|
|
|
|
|
|
|
|
|
62
|
12
|
50
|
|
|
|
119
|
shift if $_[0] eq $package; |
|
63
|
|
|
|
|
|
|
|
|
64
|
12
|
100
|
|
|
|
82
|
warn "Bogus $package: no arguments" unless @_; |
|
65
|
|
|
|
|
|
|
|
|
66
|
12
|
|
|
|
|
29
|
for( @_ ) |
|
67
|
|
|
|
|
|
|
{ |
|
68
|
31
|
50
|
|
|
|
109
|
my $export = $exportz{ $_ } |
|
69
|
|
|
|
|
|
|
or die "Bogus $package: unknown export '$_'"; |
|
70
|
|
|
|
|
|
|
|
|
71
|
31
|
|
|
|
|
104
|
my $ref = qualify_to_ref $_, $caller; |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# install as ref to subref, which avoids installing |
|
74
|
|
|
|
|
|
|
# this as a subroutine, its a scalar subref in the caller. |
|
75
|
|
|
|
|
|
|
|
|
76
|
31
|
100
|
|
|
|
781
|
*$ref |
|
77
|
|
|
|
|
|
|
= 'CODE' eq ref $export |
|
78
|
|
|
|
|
|
|
? \$export |
|
79
|
|
|
|
|
|
|
: $export |
|
80
|
|
|
|
|
|
|
; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1 |
|
84
|
12
|
|
|
|
|
10429
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# keep require happy |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1 |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
__END__ |