1XML::Atom::Entry(3) User Contributed Perl Documentation XML::Atom::Entry(3)
2
3
4
6 XML::Atom::Entry - Atom entry
7
9 use XML::Atom::Entry;
10 my $entry = XML::Atom::Entry->new;
11 $entry->title('My Post');
12 $entry->content('The content of my post.');
13 my $xml = $entry->as_xml;
14 my $dc = XML::Atom::Namespace->new(dc => 'http://purl.org/dc/elements/1.1/');
15 $entry->set($dc, 'subject', 'Food & Drink');
16
18 XML::Atom::Entry->new([ $stream ])
19 Creates a new entry object, and if $stream is supplied, fills it with
20 the data specified by $stream.
21
22 Automatically handles autodiscovery if $stream is a URI (see below).
23
24 Returns the new XML::Atom::Entry object. On failure, returns "undef".
25
26 $stream can be any one of the following:
27
28 · Reference to a scalar
29
30 This is treated as the XML body of the entry.
31
32 · Scalar
33
34 This is treated as the name of a file containing the entry XML.
35
36 · Filehandle
37
38 This is treated as an open filehandle from which the entry XML can
39 be read.
40
41 $entry->content([ $content ])
42 Returns the content of the entry. If $content is given, sets the
43 content of the entry. Automatically handles all necessary escaping.
44
45 $entry->author([ $author ])
46 Returns an XML::Atom::Person object representing the author of the
47 entry, or "undef" if there is no author information present.
48
49 If $author is supplied, it should be an XML::Atom::Person object
50 representing the author. For example:
51
52 my $author = XML::Atom::Person->new;
53 $author->name('Foo Bar');
54 $author->email('foo@bar.com');
55 $entry->author($author);
56
57 $entry->link
58 If called in scalar context, returns an XML::Atom::Link object
59 corresponding to the first <link> tag found in the entry.
60
61 If called in list context, returns a list of XML::Atom::Link objects
62 corresponding to all of the <link> tags found in the entry.
63
64 $entry->add_link($link)
65 Adds the link $link, which must be an XML::Atom::Link object, to the
66 entry as a new <link> tag. For example:
67
68 my $link = XML::Atom::Link->new;
69 $link->type('text/html');
70 $link->rel('alternate');
71 $link->href('http://www.example.com/2003/12/post.html');
72 $entry->add_link($link);
73
74 $entry->get($ns, $element)
75 Given an XML::Atom::Namespace element $ns and an element name $element,
76 retrieves the value for the element in that namespace.
77
78 This is useful for retrieving the value of elements not in the main
79 Atom namespace, like categories. For example:
80
81 my $dc = XML::Atom::Namespace->new(dc => 'http://purl.org/dc/elements/1.1/');
82 my $subj = $entry->get($dc, 'subject');
83
84 $entry->getlist($ns, $element)
85 Just like $entry->get, but if there are multiple instances of the
86 element $element in the namespace $ns, returns all of them. get will
87 return only the first.
88
90 Please see the XML::Atom manpage for author, copyright, and license
91 information.
92
93
94
95perl v5.12.3 2009-04-24 XML::Atom::Entry(3)