Changeset 66 in bookmarks for trunk/Bookmark.pm


Ignore:
Timestamp:
02/04/14 15:21:17 (10 years ago)
Author:
peter
Message:
  • the bookmark.tt template takes a hash or object named bookmark as its only variable
  • moved the calculation of a human-readable timestamp and the ISO timestamps for the WayBack machine from the BookmarkController class into the Bookmark class as methods (created, updated, created_iso, and updated_iso
  • moved the exists flag into the Bookmark class as an attribute
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Bookmark.pm

    r46 r66  
    22 
    33use Moose; 
     4use HTTP::Date qw{time2isoz}; 
    45 
    56has id    => ( is => 'ro' ); 
     
    1516has tags  => ( is => 'rw' ); 
    1617has bookmark_uri => ( is => 'rw' ); 
     18has exists => ( is => 'ro' ); 
     19 
     20sub created { scalar localtime $_[0]->ctime } 
     21sub updated { scalar localtime $_[0]->mtime } 
     22sub created_iso { (my $iso = time2isoz($_[0]->ctime)) =~ s/\D//g; return $iso; } 
     23sub updated_iso { (my $iso = time2isoz($_[0]->ctime)) =~ s/\D//g; return $iso; } 
    1724 
    1825sub BUILD { 
Note: See TracChangeset for help on using the changeset viewer.