| 1 | package Pipe::Between::Object; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use 5.012001; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | require Exporter; | |||||||||
| 8 | |||||||||||
| 9 | 1 | 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 | 1 | our %EXPORT_TAGS = ( 'all' => [ qw( | |||||||||
| 19 | |||||||||||
| 20 | ) ] ); | ||||||||||
| 21 | |||||||||||
| 22 | 1 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |||||||||
| 23 | |||||||||||
| 24 | 1 | our @EXPORT = qw( | |||||||||
| 25 | |||||||||||
| 26 | ); | ||||||||||
| 27 | |||||||||||
| 28 | 1 | our $VERSION = '0.01'; | |||||||||
| 29 | |||||||||||
| 30 | |||||||||||
| 31 | # Preloaded methods go here. | ||||||||||
| 32 | |||||||||||
| 33 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 34 | 1 | my $class = shift; | |||||||||
| 35 | 1 | my $self = { | |||||||||
| 36 | data => [], | ||||||||||
| 37 | }; | ||||||||||
| 38 | 1 | return bless($self, $class); | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 2 | ▶ | sub count { | ||||||||
|
Subroutine
count: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 42 | 2 | my $self = shift; | |||||||||
| 43 | 2 | return 1 + $#{ $self->{data} }; | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | 6 | ▶ | sub push { | ||||||||
|
Subroutine
push: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 47 | 6 | my $self = shift; | |||||||||
| 48 | 6 | my $var = shift; | |||||||||
| 49 | 6 | push(@{ $self->{data} }, $var); | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 8 | ▶ | sub pull { | ||||||||
|
Subroutine
pull: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 53 | 8 | my $self = shift; | |||||||||
| 54 | 8 | ▶ | if(@{$self->{data}}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | 6 | return (shift(@{ $self->{data} }), 0); | |||||||||
| 56 | } | ||||||||||
| 57 | else { | ||||||||||
| 58 | 2 | return (undef, 1); | |||||||||
| 59 | } | ||||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | 1 | 1; | |||||||||
| 63 | __END__ | ||||||||||