[Bps-public-commit] r19842 - Net-Google-Code/trunk/lib/Net/Google/Code/Issue

jesse at bestpractical.com jesse at bestpractical.com
Tue Jun 2 20:19:30 EDT 2009


Author: jesse
Date: Tue Jun  2 20:19:29 2009
New Revision: 19842

Modified:
   Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Search.pm

Log:
Added the ability to sort the results of an issue search on the server side.
Sadly, google doesn't actually give me what I want here.

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Search.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Search.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Search.pm	Tue Jun  2 20:19:29 2009
@@ -40,6 +40,13 @@
     default => '',
 );
 
+
+has 'sort' => (
+    isa => 'Str',
+    is => 'rw',
+    default => ''
+);
+
 has 'results' => (
     isa     => 'ArrayRef[Net::Google::Code::Issue]',
     is      => 'rw',
@@ -65,19 +72,17 @@
         $self->_can( $args{_can} ) if defined $args{_can};
         $self->_q( $args{_q} )     if defined $args{_q};
         $self->limit( $args{limit} ) if defined $args{limit};
+        $self->sort( $args{sort} ) if defined $args{sort};
         $self->load_after_search( $args{load_after_search} )
           if defined $args{load_after_search};
     }
 
-    $self->fetch( $self->base_url . 'issues/list' );
     my $mech = $self->mech;
-    $mech->submit_form(
-        form_number => 2,
-        fields      => {
-            'can' => $self->_can,
-            'q'   => $self->_q,
-        }
-    );
+    $self->fetch( $self->base_url
+            . 'issues/list'
+            . '?can=' . $self->_can
+            . ';sort=' .$self->sort 
+            . ';q=' .   $self->_q );
     die "Server threw an error " . $mech->response->status_line . 'when search'
       unless $mech->response->is_success;
 
@@ -130,12 +135,14 @@
 
 =over 4
 
-=item search ( _can => 'all', _q = 'foo' )
+=item search ( _can => 'all', _q = 'foo', sort => '-modified' )
 
 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.
 
+If a "sort" argument is specified, that will be passed to google code's issue list. Generally, these are composed of "+" or "-" followed by a column name.
+
 return true if search is successful, false on the other hand.
 
 =item project



More information about the Bps-public-commit mailing list