[Bps-public-commit] r10403 - in Net-Hiveminder: lib/Net

sartak at bestpractical.com sartak at bestpractical.com
Mon Jan 21 01:09:43 EST 2008


Author: sartak
Date: Mon Jan 21 01:09:43 2008
New Revision: 10403

Modified:
   Net-Hiveminder/   (props changed)
   Net-Hiveminder/Changes
   Net-Hiveminder/lib/Net/Hiveminder.pm

Log:
 r50620 at onn:  sartak | 2008-01-21 01:09:39 -0500
 loc2id can now take task-hashes


Modified: Net-Hiveminder/Changes
==============================================================================
--- Net-Hiveminder/Changes	(original)
+++ Net-Hiveminder/Changes	Mon Jan 21 01:09:43 2008
@@ -4,6 +4,7 @@
         Rename tasks2ids to loc2id
         Add id2loc method
         You can pass arguments to display_tasks. See its POD for how, and what
+        loc2id can now take task-hashes
 
 0.02    Sat Jan 12 08 22:48:24
         Remove canonicalize_priority, Hiveminder does it for us.

Modified: Net-Hiveminder/lib/Net/Hiveminder.pm
==============================================================================
--- Net-Hiveminder/lib/Net/Hiveminder.pm	(original)
+++ Net-Hiveminder/lib/Net/Hiveminder.pm	Mon Jan 21 01:09:43 2008
@@ -372,7 +372,7 @@
     }
 }
 
-=head2 loc2id LOCATORS -> IDS
+=head2 loc2id (LOCATOR|TASK)s -> IDs
 
 Transforms the given record locators (or tasks) to regular IDs.
 
@@ -383,8 +383,14 @@
 
     my @ids = map {
         my $locator = $_;
-        $locator =~ s/^#+//; # remove leading #
-        $LOCATOR->decode($locator);
+
+        # they passed in a hashref, so almost certainly a real task
+        ref($locator) eq 'HASH'
+            ? $locator->{id}
+            : do {
+                $locator =~ s/^#+//; # remove leading #
+                $LOCATOR->decode($locator);
+            };
     } @_;
 
     return wantarray ? @ids : $ids[0];
@@ -395,7 +401,7 @@
     loc2id(@_);
 }
 
-=head2 id2loc IDS -> LOCATORS
+=head2 id2loc IDs -> LOCATORs
 
 Transform the given IDs into record locators.
 



More information about the Bps-public-commit mailing list