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

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu May 21 00:39:56 EDT 2009


Author: sunnavy
Date: Thu May 21 00:39:55 2009
New Revision: 19745

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

Log:
add id attr for attachment: it is the aid=(...) in attachment's url

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Attachment.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Attachment.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Attachment.pm	Thu May 21 00:39:55 2009
@@ -3,9 +3,10 @@
 with 'Net::Google::Code::Role::Fetchable', 'Net::Google::Code::Role::HTMLTree';
 use Scalar::Util qw/blessed/;
 
-has 'name'    => ( isa => 'Str', is => 'rw' );
-has 'url'     => ( isa => 'Str', is => 'rw' );
-has 'size'    => ( isa => 'Str', is => 'rw' );
+has 'name' => ( isa => 'Str', is => 'rw' );
+has 'url'  => ( isa => 'Str', is => 'rw' );
+has 'size' => ( isa => 'Str', is => 'rw' );
+has 'id'   => ( isa => 'Int', is => 'rw' );
 
 sub parse {
     my $self = shift;
@@ -40,6 +41,9 @@
         $self->size($size);
 
         $self->url( $td->find_by_tag_name('a')->attr('href') );
+        if ( $self->url =~ /aid=([-\d]+)/ ) {
+            $self->id( $1 );
+        }
     }
 
     return 1;
@@ -114,6 +118,8 @@
 
 =item url
 
+=item id
+
 =back
 
 =head1 AUTHOR



More information about the Bps-public-commit mailing list