Benchmark-Timer-Class

 view release on metacpan or  search on metacpan

Class.pm  view on Meta::CPAN

110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# in the first place.
my $routine = $AUTOLOAD;
# Strip off the package/module stuff at the start
$routine =~ s/.*:://;
# Dont pass on the DESTROY call
return if $routine eq 'DESTROY';
# Create a new Timer object if we dont already have one
if (!exists $self->{stats}) {
    $self->{stats} = new Benchmark::Timer();
}
# Start the timer, call the routine, then stop the timer.
# Finally return the results to the user.
my ($result,@results);
if (wantarray) {
    # User called a routine that required an array/hash return value
    $self->{stats}->start($routine);
    @results = $self->{timed_class}->$routine(@_);
    $self->{stats}->stop($routine);
    return @results;
} else {
    # User called a routine that required a scalar return value



( run in 0.641 second using v1.01-cache-2.11-cpan-179a2ef0c17 )