File Coverage

blib/lib/IPC/Run3/ProfArrayBuffer.pm
Criterion Covered Total %
statement 18 18 100.0
branch 1 2 50.0
condition n/a
subroutine 6 6 100.0
pod 2 2 100.0
total 27 28 96.4


line stmt bran cond sub pod time code
1 3     3   13172 use strict;
  3         8  
  3         178  
2 3     3   18 use warnings;
  3         14  
  3         646  
3             package IPC::Run3::ProfArrayBuffer;
4              
5             our $VERSION = 0.049;
6              
7             =head1 NAME
8              
9             IPC::Run3::ProfArrayBuffer - Store profile events in RAM in an array
10              
11             =head1 SYNOPSIS
12              
13             =head1 DESCRIPTION
14              
15             =head1 METHODS
16              
17             =over
18              
19             =item C<< IPC::Run3::ProfArrayBuffer->new() >>
20              
21             =cut
22              
23             sub new {
24 3 50   3 1 405923 my $class = ref $_[0] ? ref shift : shift;
25              
26 3         15 my $self = bless { @_ }, $class;
27              
28 3         22 $self->{Events} = [];
29              
30 3         11 return $self;
31             }
32              
33             =item C<< $buffer->app_call(@events) >>
34              
35             =item C<< $buffer->app_exit(@events) >>
36              
37             =item C<< $buffer->run_exit(@events) >>
38              
39             The three above methods push the given events onto the stack of recorded
40             events.
41              
42             =cut
43              
44             for my $subname ( qw(app_call app_exit run_exit) ) {
45 3     3   24 no strict 'refs';
  3         6  
  3         528  
46             *{$subname} = sub {
47 7     7   398 push @{shift->{Events}}, [ $subname => @_ ];
  7         3349  
48             };
49             }
50              
51             =item get_events
52              
53             Returns a list of all the events. Each event is an ARRAY reference
54             like:
55              
56             [ "app_call", 1.1, ... ];
57              
58             =cut
59              
60             sub get_events {
61 5     5 1 205 my $self = shift;
62 5         13 @{$self->{Events}};
  5         39  
63             }
64              
65             =back
66              
67             =head1 LIMITATIONS
68              
69             =head1 COPYRIGHT
70              
71             Copyright 2003, R. Barrie Slaymaker, Jr., All Rights Reserved
72              
73             =head1 LICENSE
74              
75             You may use this module under the terms of the BSD, Artistic, or GPL licenses,
76             any version.
77              
78             =head1 AUTHOR
79              
80             Barrie Slaymaker Ebarries@slaysys.comE
81              
82             =cut
83              
84             1;