File: Enclosure.pm

package info (click to toggle)
libxml-feed-perl 0.65%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 508 kB
  • sloc: perl: 1,162; xml: 682; makefile: 4
file content (72 lines) | stat: -rw-r--r-- 1,197 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package XML::Feed::Enclosure;
use strict;
use warnings;

our $VERSION = '0.65';

use base qw( Class::ErrorHandler );

sub wrap {
    my $class = shift;
    my($c) = @_;
    bless { %$c }, $class;
}
*new = \&wrap;

sub _var {
    my $enclosure = shift;
    my $var = shift;
    $enclosure->{$var} = shift if @_;
    $enclosure->{$var};
}

sub type   { shift->_var('type',   @_) }
sub length { shift->_var('length', @_) }
sub url    { shift->_var('url',    @_) }

1;
__END__

=head1 NAME

XML::Feed::Enclosure - Wrapper for enclosure objects

=head1 SYNOPSIS

    my ($enclosure) = $entry->enclosure;
    print $enclosure->type;

=head1 DESCRIPTION

I<XML::Feed::Enclosure> represents a content object in an I<XML::Feed::Entry>
entry in a syndication feed.

=head1 USAGE

=head2 wrap

Take params and turn them into a I<XML::Feed::Enclosure> object.

=head2 new

A synonym for I<wrap>.

=head2 $enclosure->url

The url of the object.

=head2 $enclosure->type

The MIME type of the item referred to in I<url>.

=head2 $enclosure->length

The length of object referred to in I<url>

=head1 AUTHOR & COPYRIGHT

Please see the I<XML::Feed> manpage for author, copyright, and license
information.

=cut