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

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu May 21 01:14:39 EDT 2009


Author: sunnavy
Date: Thu May 21 01:14:39 2009
New Revision: 19747

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

Log:
add load method for Attachment, also content and content_type attr for Attachment

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 01:14:39 2009
@@ -3,10 +3,12 @@
 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 'id'   => ( isa => 'Int', 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' );
+has 'content'      => ( isa => 'Str', is => 'rw' );
+has 'content_type' => ( isa => 'Str', is => 'rw' );
 
 sub parse {
     my $self = shift;
@@ -69,9 +71,11 @@
     return @attachments;
 }
 
-sub content {
+sub load {
     my $self = shift;
-    return $self->fetch( $self->url );
+    my $content = $self->fetch( $self->url );
+    $self->content( $content );
+    $self->content_type( $self->mech->response->header( 'Content-Type' ) );
 }
 
 no Moose;
@@ -120,6 +124,10 @@
 
 =item id
 
+=item content
+
+=item content_type
+
 =back
 
 =head1 AUTHOR



More information about the Bps-public-commit mailing list