File Coverage

blib/lib/Net/Amazon/Request/BrowseNode.pm
Criterion Covered Total %
statement 16 17 94.1
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 23 25 92.0


line stmt bran cond sub pod time code
1             ######################################################################
2             package Net::Amazon::Request::BrowseNode;
3             ######################################################################
4 1     1   734 use warnings;
  1         3  
  1         32  
5 1     1   6 use strict;
  1         2  
  1         34  
6 1     1   6 use base qw(Net::Amazon::Request);
  1         2  
  1         245  
7              
8              
9             ##################################################
10             sub new {
11             ##################################################
12 1     1 1 33 my($class, %options) = @_;
13              
14 1         9 $class->_assert_options_defined(\%options,
15             qw(browsenode));
16              
17 1         9 $class->_convert_option(\%options,
18             'browsenode',
19             'BrowseNode',
20             \&_assert_node_is_numeric);
21              
22 1         9 my $self = $class->SUPER::new(%options);
23              
24 1         10 $self->_convert_itemsearch();
25              
26 0         0 bless $self, $class; # reconsecrate
27             }
28              
29             ##
30             ## 'PRIVATE' FUNCTIONS
31             ##
32              
33             # _assert_node_is_numeric( OPTIONS, KEY )
34             #
35             # Takes a reference to a hash of OPTIONS and makes sure
36             # that the browse node id keyed by KEY is numeric.
37             #
38             # Returns if all is well, dies otherwise.
39             #
40             sub _assert_node_is_numeric {
41 1     1   2 my ($options, $key) = @_;
42              
43 1 50       6 die "Browse Node ID must be numeric."
44             if ( $options->{$key} =~ /\D/ );
45             }
46              
47              
48             1;
49              
50             __END__