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

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed May 13 03:09:22 EDT 2009


Author: sunnavy
Date: Wed May 13 03:09:21 2009
New Revision: 19650

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

Log:
before actually load, try to check if id or name is set

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Download.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Download.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Download.pm	Wed May 13 03:09:21 2009
@@ -48,6 +48,8 @@
 sub load {
 	my $self = shift;
     my $name = shift || $self->name;
+    die "current object doesn't have name and load() is not passed a name either"
+      unless $name;
 	
 	# http://code.google.com/p/net-google-code/downloads/detail?name=Net-Google-Code-0.01.tar.gz
 	

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Issue.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Issue.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Issue.pm	Wed May 13 03:09:21 2009
@@ -37,11 +37,12 @@
 
 sub load {
     my $self = shift;
-    my ($id) = validate_pos( @_, { type => SCALAR } );
-    $self->state->{id} = $id;
+    my $id = shift || $self->id;
+    die "current object doesn't have id and load() is not passed an id either"
+      unless $id;
     my $content = $self->fetch( $self->base_url . "issues/detail?id=" . $id );
-    $self->parse($content);
-    return $id;
+    $self->state->{id} = $id;
+    return $self->parse($content);
 }
 
 sub parse {

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Wiki.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Wiki.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Wiki.pm	Wed May 13 03:09:21 2009
@@ -46,6 +46,7 @@
 
 sub load_source {
     my $self = shift;
+    die "current object doesn't have name" unless $self->name;
     my $source =
       $self->fetch( $self->base_svn_url . 'wiki/' . $self->name . '.wiki' );
     $self->source($source);
@@ -70,6 +71,8 @@
 sub load {
     my $self = shift;
     my $name = shift || $self->name;
+    die "current object doesn't have name and load() is not passed a name either"
+      unless $name;
 
     # http://code.google.com/p/net-google-code/wiki/TestPage
     my $content = $self->fetch( $self->base_url . 'wiki/' . $name );



More information about the Bps-public-commit mailing list