File Coverage

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