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

sartak at bestpractical.com sartak at bestpractical.com
Mon Jan 21 00:42:44 EST 2008


Author: sartak
Date: Mon Jan 21 00:42:44 2008
New Revision: 10401

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

Log:
 r50574 at onn:  sartak | 2008-01-21 00:42:40 -0500
 Add id2loc, rename tasks2ids to loc2id


Modified: Net-Hiveminder/Changes
==============================================================================
--- Net-Hiveminder/Changes	(original)
+++ Net-Hiveminder/Changes	Mon Jan 21 00:42:44 2008
@@ -1,5 +1,9 @@
 Revision history for Net-Hiveminder
 
+0.03
+        Rename tasks2ids to loc2id
+        Add id2loc method
+
 0.02    Sat Jan 12 08 22:48:24
         Remove canonicalize_priority, Hiveminder does it for us.
         Add priority method

Modified: Net-Hiveminder/lib/Net/Hiveminder.pm
==============================================================================
--- Net-Hiveminder/lib/Net/Hiveminder.pm	(original)
+++ Net-Hiveminder/lib/Net/Hiveminder.pm	Mon Jan 21 00:42:44 2008
@@ -71,7 +71,7 @@
     my %email_of;
 
     for my $task (@_) {
-        my $locator = $LOCATOR->encode($task->{id});
+        my $locator = $self->id2loc($task->{id});
         my $display = "#$locator: $task->{summary}";
 
         # don't display start date if it's <= today
@@ -189,7 +189,7 @@
 sub read_task {
     my $self  = shift;
     my $loc   = shift;
-    my $id    = $self->tasks2ids($loc);
+    my $id    = $self->loc2id($loc);
 
     return $self->read(Task => id => $id);
 }
@@ -203,7 +203,7 @@
 sub update_task {
     my $self = shift;
     my $loc  = shift;
-    my $id   = $self->tasks2ids($loc);
+    my $id   = $self->loc2id($loc);
 
     return $self->update(Task => id => $id, @_);
 }
@@ -217,7 +217,7 @@
 sub delete_task {
     my $self = shift;
     my $loc  = shift;
-    my $id   = $self->tasks2ids($loc);
+    my $id   = $self->loc2id($loc);
 
     return $self->delete(Task => id => $id);
 }
@@ -336,18 +336,18 @@
     my $self = shift;
 
     for (@_) {
-        my $id = $self->tasks2ids($_);
+        my $id = $self->loc2id($_);
         $self->update('Task', id => $id, complete => 1);
     }
 }
 
-=head2 tasks2ids LOCATORS -> IDS
+=head2 loc2id LOCATORS -> IDS
 
 Transforms the given record locators (or tasks) to regular IDs.
 
 =cut
 
-sub tasks2ids {
+sub loc2id {
     my $self = shift;
 
     my @ids = map {
@@ -359,6 +359,25 @@
     return wantarray ? @ids : $ids[0];
 }
 
+sub tasks2ids {
+    Carp::carp "Net::Hiveminder->tasks2ids is deprecated, use loc2id instead.";
+    loc2id(@_);
+}
+
+=head2 id2loc IDS -> LOCATORS
+
+Transform the given IDs into record locators.
+
+=cut
+
+sub id2loc {
+    my $self = shift;
+
+    my @locs = map { $LOCATOR->encode($_) } @_;
+
+    return wantarray ? @locs : $locs[0];
+}
+
 =head1 SEE ALSO
 
 L<Jifty>, L<Net::Jifty>



More information about the Bps-public-commit mailing list