[Bps-public-commit] net-lighthouse branch, master, updated. 9145125842d9bd1b07b2581e02c272a787abf723

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Sep 2 01:06:11 EDT 2009


The branch, master has been updated
       via  9145125842d9bd1b07b2581e02c272a787abf723 (commit)
      from  b7087a074d850338d7b1bfcb4bc2e420004225c1 (commit)

Summary of changes:
 lib/Net/Lighthouse/Project/Milestone.pm |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 9145125842d9bd1b07b2581e02c272a787abf723
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Sep 2 13:05:58 2009 +0800

    make milestone->load load name too

diff --git a/lib/Net/Lighthouse/Project/Milestone.pm b/lib/Net/Lighthouse/Project/Milestone.pm
index 4c86ad0..ca773ef 100644
--- a/lib/Net/Lighthouse/Project/Milestone.pm
+++ b/lib/Net/Lighthouse/Project/Milestone.pm
@@ -31,8 +31,21 @@ __PACKAGE__->meta->make_immutable;
 
 sub load {
     my $self = shift;
-    validate_pos( @_, { type => SCALAR, regex => qr/^\d+$/ } );
+    validate_pos( @_, { type => SCALAR, regex => qr/^\d+|\w+$/ } );
     my $id = shift;
+
+    if ( $id !~ /^\d+$/ ) {
+
+        # so we got a title, let's find it
+        my ($milestone) = grep { $_->title eq $id } $self->list;
+        if ($milestone) {
+            $id = $milestone->id;
+        }
+        else {
+            die "can't find milestone $id in account " . $self->account;
+        }
+    }
+
     my $ua = $self->ua;
     my $url =
         $self->base_url

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list