- Timestamp:
- 05/23/13 00:54:34 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BookmarkApp.pm
r26 r27 236 236 if ($field) { 237 237 # respond with just the requested field as plain text 238 my $value = eval { $bookmark->$field }; 239 if ($@) { 240 if ($@ =~ /Can't locate object method/) { 241 $self->header_props( 242 -type => 'text/plain', 243 -charset => 'UTF-8', 244 -status => 404, 245 ); 246 return qq{"$field" is not a valid bookmark data field}; 247 } else { 248 die $@; 249 } 250 } 238 251 $self->header_props( 239 252 -type => 'text/plain', 240 253 -charset => 'UTF-8', 241 254 ); 242 my $value = $bookmark->{$field};243 255 return ref $value eq 'ARRAY' ? join(',', @{ $value }) : $value; 244 256 } else { … … 248 260 -charset => 'UTF-8', 249 261 ); 250 return decode_utf8( encode_json($bookmark));262 return decode_utf8(JSON->new->utf8->convert_blessed->encode($bookmark)); 251 263 } else { 252 264 # display the bookmark form for this bookmark 253 265 $bookmark->{exists} = 1; 254 $bookmark->{created} = "Created " . localtime($bookmark-> {ctime});255 $bookmark->{created} .= '; Updated ' . localtime($bookmark-> {mtime}) unless $bookmark->{ctime} == $bookmark->{mtime};266 $bookmark->{created} = "Created " . localtime($bookmark->ctime); 267 $bookmark->{created} .= '; Updated ' . localtime($bookmark->mtime) unless $bookmark->ctime == $bookmark->mtime; 256 268 $self->header_props( 257 269 -type => 'text/html',
Note: See TracChangeset
for help on using the changeset viewer.