Index: trunk/bin/bkmk
===================================================================
--- trunk/bin/bkmk	(revision 119)
+++ trunk/bin/bkmk	(revision 120)
@@ -6,5 +6,5 @@
 
 use YAML;
-use Getopt::Long;
+use Getopt::Long qw{GetOptions GetOptionsFromArray :config pass_through};
 
 use Bookmarks;
@@ -12,5 +12,4 @@
 GetOptions(
     'file|f=s' => \my $DBNAME,
-    'title=s' => \my $TITLE,
 );
 
@@ -19,6 +18,6 @@
 
 my $bookmarks = Bookmarks->new({
-    dbname => $dbname,
-});
+        dbname => $dbname,
+    });
 
 my $command = shift;
@@ -30,5 +29,5 @@
         load_bookmarks($src_file) if $src_file;
     },
-    
+
     get => sub {
         my $identifier = shift;
@@ -36,6 +35,10 @@
         print $bookmark ? Dump($bookmark->to_hashref) : "Not Found\n";
     },
-    
+
     add => sub {
+        GetOptionsFromArray(
+            \@_,
+            'title=s' => \my $TITLE,
+        );
         my ($uri, @tags) = @_;
         my $title = defined $TITLE ? $TITLE : fetch_title($uri);
@@ -47,6 +50,6 @@
         my @tags = @_;
         my $resources = $bookmarks->search({
-            tags => \@tags
-        });
+                tags => \@tags
+            });
         # TODO: list by tags, date, etc.
         # TODO: coordinate this commandline script with the CGI app
@@ -80,4 +83,36 @@
         $dump_file ? YAML::DumpFile($dump_file, $dump) : print Dump($dump);
     },
+
+    # scanning for current status
+    scan => sub {
+        GetOptionsFromArray(
+            \@_,
+            'csv'       => \my $CSV,
+            'timeout=i' => \my $TIMEOUT,
+        );
+
+        require LWP::UserAgent;
+        require Text::CSV;
+
+        $TIMEOUT ||= 10;
+
+        my $ua = LWP::UserAgent->new;
+        $ua->timeout($TIMEOUT);
+
+        my $csv = Text::CSV->new;
+
+        for my $bookmark (@{ $bookmarks->search->results }) {
+            printf "%3d %s\n", $bookmark->id, $bookmark->uri unless $CSV;
+            my $response = $ua->head($bookmark->uri);
+            printf "   -> %s\n", $response->status_line unless $CSV;
+            $csv->combine(
+                $bookmark->id,
+                $bookmark->uri,
+                $response->code,
+                $response->message,
+            );
+            print $csv->string . "\n" if $CSV;
+        }
+    },
 );
 
Index: trunk/scan
===================================================================
--- trunk/scan	(revision 119)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-use Bookmarks;
-use LWP::UserAgent;
-use Text::CSV;
-use Getopt::Long;
-
-GetOptions(
-    'csv' => \my $CSV,
-    'timeout=i' => \my $TIMEOUT,
-);
-
-my $DBFILE = shift or die "Usage: $0 <dbfile>";
-
-$TIMEOUT ||= 10;
-
-my $bookmarks = Bookmarks->new({
-    dbname => $DBFILE,
-});
-
-my $ua = LWP::UserAgent->new;
-$ua->timeout($TIMEOUT);
-
-my $csv = Text::CSV->new;
-
-for my $bookmark (@{ $bookmarks->search->results }) {
-    printf "%3d %s\n", $bookmark->id, $bookmark->uri unless $CSV;
-    my $response = $ua->head($bookmark->uri);
-    printf "   -> %s\n", $response->status_line unless $CSV;
-    $csv->combine(
-        $bookmark->id,
-        $bookmark->uri,
-        $response->code,
-        $response->message,
-    );
-    print $csv->string . "\n" if $CSV;
-}
