File Coverage

blib/lib/Finance/CaVirtex/API/DefaultPackage.pm
Criterion Covered Total %
statement 22 23 95.6
branch 4 4 100.0
condition n/a
subroutine 7 8 87.5
pod 0 4 0.0
total 33 39 84.6


line stmt bran cond sub pod time code
1             package Finance::CaVirtex::API::DefaultPackage;
2             # This is just some defaults that most Packages will want to use as a base...
3              
4 1     1   15 use 5.014002;
  1         4  
  1         35  
5 1     1   5 use strict;
  1         2  
  1         25  
6 1     1   5 use warnings;
  1         2  
  1         41  
7              
8             our $VERSION = '0.01';
9              
10             # You will want to add these to the package that inherits this one...
11 1     1   5 use constant ATTRIBUTES => qw();
  1         2  
  1         265  
12 0     0 0 0 sub attributes { ATTRIBUTES }
13              
14 5     5 0 2269 sub new { (bless {} => shift)->init(@_) }
15             sub init {
16 5     5 0 10 my $self = shift;
17 5         16 my %args = @_;
18 5         21 foreach my $attribute ($self->attributes) {
19 10 100       49 $self->$attribute($args{$attribute}) if exists $args{$attribute};
20             }
21 5         27 return $self;
22             }
23              
24             # this method simply makes all the get/setter attribute methods below very tidy...
25             sub get_set {
26 86     86 0 106 my $self = shift;
27 86         773 my $attribute = ((caller(1))[3] =~ /::(\w+)$/)[0];
28 86 100       322 $self->{$attribute} = shift if scalar @_;
29 86         523 return $self->{$attribute};
30             }
31              
32             1;
33              
34             __END__