File Coverage

blib/lib/PONAPI/Constants.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 15 15 100.0


line stmt bran cond sub pod time code
1             # ABSTRACT: Constants used by PONAPI::DAO and PONAPI repositories
2             package PONAPI::Constants;
3              
4 8     8   48 use strict;
  8         18  
  8         228  
5 8     8   42 use warnings;
  8         18  
  8         834  
6              
7             my $constants;
8             BEGIN {
9 8     8   40 $constants = {
10             PONAPI_UPDATED_EXTENDED => 100,
11             PONAPI_UPDATED_NORMAL => 101,
12             PONAPI_UPDATED_NOTHING => 102,
13             };
14              
15 8         47 require constant; constant->import($constants);
  8         557  
16 8         48 require Exporter; our @ISA = qw(Exporter);
  8         87  
17 8         649 our @EXPORT = ( keys %$constants,
18             qw/
19             %PONAPI_UPDATE_RETURN_VALUES
20             /,
21             );
22             }
23              
24             our (%PONAPI_UPDATE_RETURN_VALUES);
25              
26             $PONAPI_UPDATE_RETURN_VALUES{+PONAPI_UPDATED_EXTENDED} = 1;
27             $PONAPI_UPDATE_RETURN_VALUES{+PONAPI_UPDATED_NORMAL} = 1;
28             $PONAPI_UPDATE_RETURN_VALUES{+PONAPI_UPDATED_NOTHING} = 1;
29              
30             1;
31              
32             __END__
33              
34             =pod
35              
36             =encoding UTF-8
37              
38             =head1 NAME
39              
40             PONAPI::Constants - Constants used by PONAPI::DAO and PONAPI repositories
41              
42             =head1 VERSION
43              
44             version 0.002006
45              
46             =head1 SYNOPSIS
47              
48             use PONAPI::Constants;
49             sub update {
50             ...
51              
52             return $updated_more_rows_than_requested
53             ? PONAPI_UPDATED_EXTENDED
54             : PONAPI_UPDATED_NORMAL;
55             }
56              
57             =head1 EXPORTS
58              
59             =head2 PONAPI_UPDATED_NORMAL
60              
61             The update-like operation did as requested, as no more.
62              
63             =head2 PONAPI_UPDATED_EXTENDED
64              
65             The update-like operation did B<more> than requested; maybe it added rows,
66             or updated another related table.
67              
68             =head2 PONAPI_UPDATED_NOTHING
69              
70             The update-like operation was a no-op. This can happen in a SQL implementation
71             when modifying a resource that doesn't exist, for example.
72              
73             =head1 AUTHORS
74              
75             =over 4
76              
77             =item *
78              
79             Mickey Nasriachi <mickey@cpan.org>
80              
81             =item *
82              
83             Stevan Little <stevan@cpan.org>
84              
85             =item *
86              
87             Brian Fraser <hugmeir@cpan.org>
88              
89             =back
90              
91             =head1 COPYRIGHT AND LICENSE
92              
93             This software is copyright (c) 2016 by Mickey Nasriachi, Stevan Little, Brian Fraser.
94              
95             This is free software; you can redistribute it and/or modify it under
96             the same terms as the Perl 5 programming language system itself.
97              
98             =cut