| 1 | package XML::Atom::Ext::OpenSearch; | ||
| 2 | |||
| 3 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 3 | ▶ | use base qw( XML::Atom::Base ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 3 | ▶ | use XML::Atom::Feed; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 3 | ▶ | use XML::Atom::Ext::OpenSearch::Query; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 3 | our $VERSION = '0.03'; | |
| 12 | |||
| 13 | =head1 NAME | ||
| 14 | |||
| 15 | XML::Atom::Ext::OpenSearch - XML::Atom extension for OpenSearch data | ||
| 16 | |||
| 17 | =head1 SYNOPSIS | ||
| 18 | |||
| 19 | use XML::Atom::Feed; | ||
| 20 | use XML::Atom::Ext::OpenSearch; | ||
| 21 | |||
| 22 | my $feed = XML::Atom::Feed->new; | ||
| 23 | $feed->totalResults( $total ); | ||
| 24 | |||
| 25 | =head1 DESCRIPTION | ||
| 26 | |||
| 27 | This module is an extension to XML::Atom which will let you read and write | ||
| 28 | feeds that use OpenSearch data. OpenSearch provides some extra elements | ||
| 29 | to serialize search results as an Atom feed. See | ||
| 30 | the specification (http://www.opensearch.org/Specifications/OpenSearch/1.1) | ||
| 31 | for more information. | ||
| 32 | |||
| 33 | =head1 METHODS | ||
| 34 | |||
| 35 | =head2 totalResults( $results ) | ||
| 36 | |||
| 37 | =head2 startIndex( $index ) | ||
| 38 | |||
| 39 | =head2 itemsPerPage( $items ) | ||
| 40 | |||
| 41 | =head2 Query( ) | ||
| 42 | |||
| 43 | In list context, returns all query elements in the document. In scalar | ||
| 44 | context, returns the first query element found. | ||
| 45 | |||
| 46 | =head2 add_Query( $object ) | ||
| 47 | |||
| 48 | =cut | ||
| 49 | |||
| 50 | 3 | ▶ | BEGIN { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 51 | 3 | XML::Atom::Feed->mk_elem_accessors( | |
| 52 | qw(totalResults startIndex itemsPerPage), | ||
| 53 | [ XML::Atom::Namespace->new( | ||
| 54 | "opensearch" => q{http://a9.com/-/spec/opensearch/1.1/} | ||
| 55 | ) | ||
| 56 | ] | ||
| 57 | ); | ||
| 58 | |||
| 59 | 3 | XML::Atom::Feed->mk_object_list_accessor( | |
| 60 | Query => 'XML::Atom::Ext::OpenSearch::Query' ); | ||
| 61 | } | ||
| 62 | |||
| 63 | =head2 element_ns( ) | ||
| 64 | |||
| 65 | Returns the opensearch namespace, C<http://a9.com/-/spec/opensearch/1.1>. | ||
| 66 | |||
| 67 | =cut | ||
| 68 | |||
| 69 | 4 | ▶ | sub element_ns { |
|
Subroutine
element_ns: called CC=1 SCAR=0.0
Pod
documented
| |||
| 70 | 4 | return XML::Atom::Namespace->new( | |
| 71 | "opensearch" => q{http://a9.com/-/spec/opensearch/1.1/} ); | ||
| 72 | } | ||
| 73 | |||
| 74 | =head1 AUTHOR | ||
| 75 | |||
| 76 | Brian Cassidy E<lt>bricas@cpan.orgE<gt> | ||
| 77 | |||
| 78 | =head1 COPYRIGHT AND LICENSE | ||
| 79 | |||
| 80 | Copyright 2007-2011 by Brian Cassidy | ||
| 81 | |||
| 82 | This library is free software; you can redistribute it and/or modify | ||
| 83 | it under the same terms as Perl itself. | ||
| 84 | |||
| 85 | =head1 SEE ALSO | ||
| 86 | |||
| 87 | =over 4 | ||
| 88 | |||
| 89 | =item * L<XML::Atom> | ||
| 90 | |||
| 91 | =back | ||
| 92 | |||
| 93 | =cut | ||
| 94 | |||
| 95 | 3 | 1; | |