File Coverage

lib/PSGI/Hector/Base.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 2 3 66.6
total 22 23 95.6


line stmt bran cond sub pod time code
1             package PSGI::Hector::Base;
2              
3             =pod
4              
5             =head1 NAME
6              
7             PSGI::Hector::Base - Base Hector class
8              
9             =head1 SYNOPSIS
10              
11             my $r = $hector->getRequest();
12             my $params = $r->getParameters();
13              
14             =head1 DESCRIPTION
15              
16             Abstract class used in all other PSGI::Hector classes.
17              
18             =head1 METHODS
19              
20             =cut
21              
22 5     5   1462 use strict;
  5         9  
  5         111  
23 5     5   19 use warnings;
  5         6  
  5         573  
24             ###########################################################
25             sub new{
26 8     8 0 15 my $class = shift;
27 8         13 my $self = {
28             '_error' => undef
29             };
30 8         14 bless $self, $class;
31 8         14 return $self;
32             }
33             #########################################################
34              
35             =head2 setError($mesage)
36              
37             $obj->setError($message);
38              
39             Sets an error on the object, the message can be retrieved later.
40              
41             =cut
42              
43             #########################################################
44             sub setError{
45 1     1 1 437 my($self, $error) = @_;
46 1         4 $self->{'_error'} = $error;
47 1         1 return 1;
48             }
49             #########################################################
50              
51             =pod
52              
53             =head2 getError()
54              
55             $error = $obj->getError();
56              
57             Retrieve a previously set error message. This method is used to
58             determine the object's error state.
59              
60             =cut
61              
62             #########################################################
63             sub getError{
64 9     9 1 9 my $self = shift;
65 9         33 return $self->{'_error'};
66             }
67             ###########################################################
68              
69             =pod
70              
71             =head1 Notes
72              
73             =head1 Author
74              
75             MacGyveR
76              
77             Development questions, bug reports, and patches are welcome to the above address.
78              
79             =head1 See Also
80              
81             =head1 Copyright
82              
83             Copyright (c) 2017 MacGyveR. All rights reserved.
84              
85             This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
86              
87             =cut
88              
89             ##########################################################
90             return 1;