[Bps-public-commit] r17623 - in Net-Google-Code/trunk: lib/Net/Google/Code

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Jan 8 00:09:52 EST 2009


Author: sunnavy
Date: Thu Jan  8 00:09:51 2009
New Revision: 17623

Modified:
   Net-Google-Code/trunk/   (props changed)
   Net-Google-Code/trunk/lib/Net/Google/Code/IssueSearch.pm

Log:
 r18614 at sunnavys-mb:  sunnavy | 2009-01-08 13:02:11 +0800
 improve search method in IssueSearch


Modified: Net-Google-Code/trunk/lib/Net/Google/Code/IssueSearch.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/IssueSearch.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/IssueSearch.pm	Thu Jan  8 00:09:51 2009
@@ -43,6 +43,12 @@
 
 sub search {
     my $self = shift;
+    if ( scalar @_ ) {
+        my %args = @_;
+        $self->_can( $args{_can} ) if $defined $args{_can};
+        $self->_q( $args{_q} ) if $defined $args{_q};
+    }
+
     my $mech = $self->connection->mech;
     $self->connection->_fetch('/issues/list');
     $mech->submit_form(
@@ -62,6 +68,7 @@
     if ( $mech->title =~ /Issue\s+(\d+)/ ) {
 # only get one ticket
         @{$self->ids} = $1;
+        return 1;
     }
     elsif ( $mech->title =~ /Issues/ ) {
 # get a ticket list
@@ -105,10 +112,11 @@
                 }
             }
         }
-
+        return 1;
     }
     else {
         warn "no idea what the content like";
+        return
     }
 }
 
@@ -127,11 +135,18 @@
 
 =head1 INTERFACE
 
-=head2 search
+=head2 search ( _can => 'all', _q = 'foo' )
 
-=head2 ids
+search with values $self->_can and $self->_q if without arguments.
+if there're arguments for _can or _q, this call will set $self->_can or
+$self_q, then do the search.
 
-after search, this returns the ticket ids
+return true if search is successful, false on the other hand.
+
+
+=head2 ids
+this should be called after a successful search.
+returns issue ids as a arrayref.
 
 =head1 AUTHOR
 



More information about the Bps-public-commit mailing list