Benchmark-Timer-Class

 view release on metacpan or  search on metacpan

Class.pm  view on Meta::CPAN

    # 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.236 second using v1.01-cache-2.11-cpan-87723dcf8b7 )