File Coverage

blib/lib/EBook/EPUB/Manifest/Item.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             # Copyright (c) 2009, 2010 Oleksandr Tymoshenko <gonzo@bluezbox.com>
2             # All rights reserved.
3              
4             # Redistribution and use in source and binary forms, with or without
5             # modification, are permitted provided that the following conditions
6             # are met:
7             # 1. Redistributions of source code must retain the above copyright
8             # notice, this list of conditions and the following disclaimer.
9             # 2. Redistributions in binary form must reproduce the above copyright
10             # notice, this list of conditions and the following disclaimer in the
11             # documentation and/or other materials provided with the distribution.
12              
13             # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14             # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15             # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16             # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17             # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18             # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19             # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20             # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21             # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22             # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23             # SUCH DAMAGE.
24             package EBook::EPUB::Manifest::Item;
25 1     1   2862 use Moose;
  0            
  0            
26              
27             has [qw/id href media_type/] => ( isa => 'Str', is => 'rw' );
28              
29             sub encode
30             {
31             my ($self, $writer) = @_;
32             $writer->emptyTag("item",
33             id => $self->id(),
34             href => $self->href(),
35             'media-type' => $self->media_type(),
36             );
37             }
38              
39             no Moose;
40             __PACKAGE__->meta->make_immutable;
41              
42             1;
43              
44             __END__
45              
46             =head1 NAME
47              
48             EBook::EPUB::Manifest::Item
49              
50             =head1 SYNOPSIS
51              
52             Item for E<lt>manifestE<gt> element of OPF file. Each describes a document, an
53             image file, a style sheet, or other component that is considered part of the
54             publication
55              
56             =head1 SUBROUTINES/METHODS
57              
58             =over 4
59              
60             =item new(%opts)
61              
62             %opts is an anonymous hash that might containe followig keys:
63              
64             id
65             href
66             media_type
67              
68             =item encode($xmlwriter)
69              
70             Encode object to XML form using XML::Writer instance
71              
72             =item id([$id])
73              
74             Get/set ID of OPS Content Document to which item refers
75              
76             =item href([$href])
77              
78             Get/set URI of OPS Content Document to which item refers
79              
80             =item media_type([$media_type])
81              
82             Get/set item’s MIME media type.
83              
84             =back
85              
86             =head1 AUTHOR
87              
88             Oleksandr Tymoshenko, E<lt>gonzo@bluezbox.comE<gt>
89              
90             =head1 BUGS
91              
92             Please report any bugs or feature requests to E<lt>gonzo@bluezbox.comE<gt>
93              
94             =head1 LICENSE AND COPYRIGHT
95              
96             Copyright 2009, 2010 Oleksandr Tymoshenko.
97              
98             L<http://bluezbox.com>
99              
100             This module is free software; you can redistribute it and/or
101             modify it under the terms of the BSD license. See the F<LICENSE> file
102             included with this distribution.
103