Index: /trunk/Bookmark.pm
===================================================================
--- /trunk/Bookmark.pm	(revision 65)
+++ /trunk/Bookmark.pm	(revision 66)
@@ -2,4 +2,5 @@
 
 use Moose;
+use HTTP::Date qw{time2isoz};
 
 has id    => ( is => 'ro' );
@@ -15,4 +16,10 @@
 has tags  => ( is => 'rw' );
 has bookmark_uri => ( is => 'rw' );
+has exists => ( is => 'ro' );
+
+sub created { scalar localtime $_[0]->ctime }
+sub updated { scalar localtime $_[0]->mtime }
+sub created_iso { (my $iso = time2isoz($_[0]->ctime)) =~ s/\D//g; return $iso; }
+sub updated_iso { (my $iso = time2isoz($_[0]->ctime)) =~ s/\D//g; return $iso; }
 
 sub BUILD {
Index: /trunk/BookmarkController.pm
===================================================================
--- /trunk/BookmarkController.pm	(revision 65)
+++ /trunk/BookmarkController.pm	(revision 66)
@@ -119,7 +119,9 @@
         $template->process(
             'bookmark.tt',
-            {
-                uri   => $self->request->param('uri'),
-                title => $self->request->param('title') || '',
+            { 
+                bookmark => {
+                    uri   => $self->request->param('uri'),
+                    title => $self->request->param('title') || '',
+                },
             },
             \my $output,
@@ -337,14 +339,8 @@
         } else {
             # display the bookmark form for this bookmark
-            # TODO: these should probably be methods on the Bookmark class
-            $bookmark->{exists} = 1;
-            $bookmark->{created} = localtime($bookmark->ctime);
-            $bookmark->{updated} = localtime($bookmark->mtime);
-            ($bookmark->{created_iso} = time2isoz($bookmark->ctime)) =~ s/\D//g;
-            ($bookmark->{updated_iso} = time2isoz($bookmark->mtime)) =~ s/\D//g;
             my $template = Template->new;
             $template->process(
                 'bookmark.tt',
-                $bookmark,
+                { bookmark => $bookmark },
                 \my $output,
             );
Index: /trunk/Bookmarks.pm
===================================================================
--- /trunk/Bookmarks.pm	(revision 65)
+++ /trunk/Bookmarks.pm	(revision 66)
@@ -63,4 +63,5 @@
     return Bookmark->new({
         %$bookmark,
+        exists   => 1,
         tags     => [ $self->get_tags({ uri => $bookmark->{uri} }) ],
         base_uri => $self->base_uri,
Index: /trunk/bookmark.tt
===================================================================
--- /trunk/bookmark.tt	(revision 65)
+++ /trunk/bookmark.tt	(revision 66)
@@ -1,5 +1,5 @@
 <html>
   <head>
-    <title>Bookmark: [% title or uri %]</title>
+    <title>Bookmark: [% bookmark.title or bookmark.uri %]</title>
     <style type="text/css">
 body, th, td {
@@ -21,17 +21,17 @@
     <div>
       <h1>
-      [% UNLESS exists %]
+      [% UNLESS bookmark.exists %]
         <strong>New bookmark:</strong>
       [% END %]
-      <a href="[% uri | html %]" target="_blank">[% title or uri %]</a>
+      <a href="[% bookmark.uri | html %]" target="_blank">[% bookmark.title or bookmark.uri %]</a>
       </h1>
-      [% IF exists %]
+      [% IF bookmark.exists %]
         <p class="timestamps">
-	  Bookmark created <a href="http://web.archive.org/web/[% created_iso %]/[% uri %]" title="Nearest Wayback Machine Link" target="_blank">[% created %]</a>[% IF mtime != ctime %]; updated
-	  <a href="http://web.archive.org/web/[% updated_iso %]/[% uri %]" title="Nearest Wayback Machine Link" target="_blank">[% updated %]</a>[% END %]
+	  Bookmark created <a href="http://web.archive.org/web/[% bookmark.created_iso %]/[% bookmark.uri %]" title="Nearest Wayback Machine Link" target="_blank">[% bookmark.created %]</a>[% IF bookmark.mtime != bookmark.ctime %]; updated
+	  <a href="http://web.archive.org/web/[% bookmark.updated_iso %]/[% bookmark.uri %]" title="Nearest Wayback Machine Link" target="_blank">[% bookmark.updated %]</a>[% END %]
         </p>
-        [% IF tags.size %]
+        [% IF bookmark.tags.size %]
           <p class="tags">Tagged as:
-            [% FOREACH tag IN tags %]
+            [% FOREACH tag IN bookmark.tags %]
               <a href=".?tag=[% tag %]" class="tag" target="_blank" onclick="if (opener && !opener.closed) { opener.location = this.href; return false; }">[% tag %]</a>
             [% END %]
@@ -44,5 +44,5 @@
             <th>URI:</th>
             <td>
-              <input type="text" name="uri" value="[% uri | html %]" size="80"/>
+              <input type="text" name="uri" value="[% bookmark.uri | html %]" size="80"/>
             </td>
           </tr>
@@ -50,5 +50,5 @@
             <th>Title:</th>
             <td>
-              <input type="text" name="title" value="[% title | html %]" size="80"/>
+              <input type="text" name="title" value="[% bookmark.title | html %]" size="80"/>
             </td>
           </tr>
@@ -56,5 +56,5 @@
             <th>Tags:</th>
             <td>
-              <input type="text" name="tags" value="[% tags.join(' ') | html %]" size="80"/>
+              <input type="text" name="tags" value="[% bookmark.tags.join(' ') | html %]" size="80"/>
             </td>
           </tr>
