File Coverage

blib/lib/Atompub.pm
Criterion Covered Total %
statement 22 24 91.6
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 30 32 93.7


line stmt bran cond sub pod time code
1             package Atompub;
2              
3 9     9   108257 use warnings;
  9         21  
  9         284  
4 9     9   45 use strict;
  9         15  
  9         277  
5              
6 9     9   349 use 5.006;
  9         45  
  9         406  
7 9     9   9583 use version 0.74; our $VERSION = qv('0.3.7');
  9         34912  
  9         473  
8              
9 9     9   25278 use HTTP::Headers;
  9         136105  
  9         398  
10 9     9   11314 use HTTP::Request;
  9         238074  
  9         365  
11 9     9   27229 use HTTP::Response;
  9         90327  
  9         544  
12 9     9   17418 use XML::Atom;
  0            
  0            
13             use XML::Atom::Service 0.15.4;
14              
15             our %REQUEST_HEADERS = (
16             accept => 'Accept',
17             if_match => 'If-Match',
18             if_none_match => 'If-None-Match',
19             if_modified_since => 'If-Modified-Since',
20             if_unmodified_since => 'If-Unmodified-Since',
21             );
22              
23             our %RESPONSE_HEADERS = (
24             content_location => 'Content-Location',
25             etag => 'ETag',
26             location => 'Location',
27             );
28              
29             our %ENTITY_HEADERS = (
30             last_modified => 'Last-Modified',
31             slug => 'Slug',
32             );
33              
34             while (my($method, $header) = each %REQUEST_HEADERS) {
35             no strict 'refs'; ## no critic
36             *{"HTTP::Headers::$method"} = sub { shift->header($header, @_) }
37             unless HTTP::Headers->can($method);
38             *{"HTTP::Request::$method"} = sub { shift->header($header, @_)}
39             unless (HTTP::Request->can($method));
40             }
41              
42             while (my($method, $header) = each %RESPONSE_HEADERS) {
43             no strict 'refs'; ## no critic
44             *{"HTTP::Headers::$method"} = sub { shift->header($header, @_) }
45             unless HTTP::Headers->can($method);
46             *{"HTTP::Response::$method"} = sub { shift->header($header, @_) }
47             unless HTTP::Response->can($method);
48             }
49              
50             while (my($method, $header) = each %ENTITY_HEADERS) {
51             no strict 'refs'; ## no critic
52             *{"HTTP::Headers::$method"} = sub { shift->header($header, @_) }
53             unless HTTP::Headers->can($method);
54             *{"HTTP::Request::$method"} = sub { shift->header($header, @_) }
55             unless HTTP::Request->can($method);
56             *{"HTTP::Response::$method"} = sub { shift->header($header, @_) }
57             unless HTTP::Response->can($method);
58             }
59              
60             1; # Magic true value required at end of module
61             __END__
62              
63             =head1 NAME
64              
65             Atompub - Atom Publishing Protocol implementation
66              
67              
68             =head1 DESCRIPTION
69              
70             The Atom Publishing Protocol (Atompub) is a protocol for publishing and
71             editing Web resources described at L<http://www.ietf.org/rfc/rfc5023.txt>.
72              
73             L<Atompub> implements client L<Atompub::Client> and server L<Atompub::Server> for the protocol.
74             XML formats used in the protocol are implemented in L<XML::Atom> and
75             L<XML::Atom::Service>.
76             Catalyst extension L<Catalyst::Controller::Atompub> is also available.
77              
78             This module was tested in July2007InteropTokyo and November2007Interop,
79             and interoperated with other implementations.
80             See L<http://intertwingly.net/wiki/pie/July2007InteropTokyo> and
81             L<http://www.intertwingly.net/wiki/pie/November2007Interop> in detail.
82              
83              
84             =head1 METHODS of HTTP::Headers, HTTP::Request, and HTTP::Response
85              
86             Some accessors for the HTTP header fields, which are used in the Atom Publishing Protocol,
87             are imported into L<HTTP::Headers>, L<HTTP::Request>, and L<HTTP::Response>.
88             See L<http://www.ietf.org/rfc/rfc2616.txt> in detail.
89              
90              
91             =head2 $headers->accept([ $value ])
92              
93             An accessor for the I<Accept> header field.
94              
95             This method is imported into L<HTTP::Headers> and L<HTTP::Request>.
96              
97             =head2 $headers->if_match([ $value ])
98              
99             An accessor for the I<If-Match> header field.
100              
101             This method is imported into L<HTTP::Headers> and L<HTTP::Request>.
102              
103             =head2 $headers->if_none_match([ $value ])
104              
105             An accessor for the I<If-None-Match> header field.
106              
107             This method is imported into L<HTTP::Headers> and L<HTTP::Request>.
108              
109             =head2 $headers->if_modified_since([ $value ])
110              
111             An accessor for the I<If-Modified-Since> header field.
112             $value MUST be UTC epoch value, like C<1167609600>.
113              
114             This method is imported into L<HTTP::Headers> and L<HTTP::Request>.
115              
116             =head2 $headers->if_unmodified_since([ $value ])
117              
118             An accessor for the I<If-Unmodified-Since> header field.
119             $value MUST be UTC epoch value, like C<1167609600>.
120              
121             This method is imported into L<HTTP::Headers> and L<HTTP::Request>.
122              
123             =head2 $headers->content_location([ $value ])
124              
125             An accessor for the I<Content-Location> header field.
126              
127             This method is imported into L<HTTP::Headers> and L<HTTP::Response>.
128              
129             =head2 $headers->etag([ $value ])
130              
131             An accessor for the I<ETag> header field.
132              
133             This method is imported into L<HTTP::Headers> and L<HTTP::Response>.
134              
135             =head2 $headers->location([ $value ])
136              
137             An accessor for the I<Location> header field.
138              
139             This method is imported into L<HTTP::Headers> and L<HTTP::Response>.
140              
141             =head2 $headers->last_modified([ $value ])
142              
143             An accessor for the I<Last-Modified> header field.
144              
145             This method is imported into L<HTTP::Headers>, L<HTTP::Request>, and L<HTTP::Response>.
146              
147             =head2 $headers->slug([ $value ])
148              
149             An accessor for the I<Slug> header field.
150              
151             This method is imported into L<HTTP::Headers>, L<HTTP::Request>, and L<HTTP::Response>.
152              
153              
154             =head1 AUTHOR
155              
156             Takeru INOUE, E<lt>takeru.inoue _ gmail.comE<gt>
157              
158              
159             =head1 LICENCE AND COPYRIGHT
160              
161             Copyright (c) 2007, Takeru INOUE C<< <takeru.inoue _ gmail.com> >>.
162              
163             This module is free software; you can redistribute it and/or
164             modify it under the same terms as Perl itself. See L<perlartistic>.
165              
166              
167             =head1 DISCLAIMER OF WARRANTY
168              
169             BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
170             FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
171             OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
172             PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
173             EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
174             WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
175             ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
176             YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
177             NECESSARY SERVICING, REPAIR, OR CORRECTION.
178              
179             IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
180             WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
181             REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
182             LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
183             OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
184             THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
185             RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
186             FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
187             SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
188             SUCH DAMAGES.