File Coverage

blib/lib/Pipe/Between/Object.pm
Criterion Covered Total %
statement 25 25 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 0 4 0.0
total 34 38 89.4


line stmt bran cond sub pod time code
1             package Pipe::Between::Object;
2              
3 1     1   21564 use 5.012001;
  1         5  
  1         37  
4 1     1   6 use strict;
  1         1  
  1         30  
5 1     1   11 use warnings;
  1         12  
  1         491  
6              
7             require Exporter;
8              
9             our @ISA = qw(Exporter);
10              
11             # Items to export into callers namespace by default. Note: do not export
12             # names by default without a very good reason. Use EXPORT_OK instead.
13             # Do not simply export all your public functions/methods/constants.
14              
15             # This allows declaration use Pipe::Between::Object ':all';
16             # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
17             # will save memory.
18             our %EXPORT_TAGS = ( 'all' => [ qw(
19            
20             ) ] );
21              
22             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
23              
24             our @EXPORT = qw(
25            
26             );
27              
28             our $VERSION = '0.01';
29              
30              
31             # Preloaded methods go here.
32              
33             sub new {
34 1     1 0 12 my $class = shift;
35 1         5 my $self = {
36             data => [],
37             };
38 1         6 return bless($self, $class);
39             }
40              
41             sub count {
42 2     2 0 1004 my $self = shift;
43 2         4 return 1 + $#{ $self->{data} };
  2         19  
44             }
45              
46             sub push {
47 6     6 0 1341 my $self = shift;
48 6         7 my $var = shift;
49 6         8 push(@{ $self->{data} }, $var);
  6         18  
50             }
51              
52             sub pull {
53 8     8 0 3562 my $self = shift;
54 8 100       12 if(@{$self->{data}}) {
  8         21  
55 6         10 return (shift(@{ $self->{data} }), 0);
  6         33  
56             }
57             else {
58 2         5 return (undef, 1);
59             }
60             }
61            
62             1;
63             __END__