Changeset 19 in bookmarks
- Timestamp:
- 05/21/13 13:48:46 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BookmarkApp.pm
r17 r19 7 7 8 8 use Encode; 9 use HTTP::Date qw{time2isoz}; 9 10 use JSON; 10 11 use Bookmarks; … … 88 89 }) 89 90 ); 91 } elsif ($format eq 'xbel') { 92 require XML::XBEL; 93 #TODO: conditional support; if XML::XBEL is not present, return a 5xx response 94 95 my $xbel = XML::XBEL->new; 96 97 $xbel->new_document({ 98 title => 'Bookmarks' . ($tag ? " tagged as $tag" : ''), 99 }); 100 101 for my $bookmark (@resources) { 102 my $cdatetime = time2isoz $bookmark->{ctime}; 103 my $mdatetime = time2isoz $bookmark->{mtime}; 104 # make the timestamps W3C-correct 105 s/ /T/ foreach ($cdatetime, $mdatetime); 106 107 $xbel->add_bookmark({ 108 href => $bookmark->{uri}, 109 title => $bookmark->{title}, 110 desc => 'Tags: ' . join(', ', @{ $bookmark->{tags} }), 111 added => $cdatetime, 112 #XXX: are we sure that modified is the mtime of the bookmark or the resource? 113 modified => $mdatetime, 114 }); 115 } 116 117 $self->header_props( 118 -type => 'application/xml', 119 -charset => 'UTF-8', 120 ); 121 122 return $xbel->toString; 90 123 } else { 91 124 $self->header_props(
Note: See TracChangeset
for help on using the changeset viewer.