[Jifty-commit] r5397 - in Net-Jifty: .

Jifty commits jifty-commit at lists.jifty.org
Wed May 7 20:14:11 EDT 2008


Author: sartak
Date: Wed May  7 20:13:12 2008
New Revision: 5397

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

Log:
 r55323 at onn:  sartak | 2008-05-07 20:12:54 -0400
 get_model_spec


Modified: Net-Jifty/lib/Net/Jifty.pm
==============================================================================
--- Net-Jifty/lib/Net/Jifty.pm	(original)
+++ Net-Jifty/lib/Net/Jifty.pm	Wed May  7 20:13:12 2008
@@ -192,6 +192,13 @@
     documentation => "The cache for action specifications",
 );
 
+has model_specs => (
+    is            => 'rw',
+    isa           => 'HashRef[HashRef]',
+    default       => sub { {} },
+    documentation => "The model for action specifications",
+);
+
 =head2 BUILD
 
 Each L<Net::Jifty> object will do the following upon creation:
@@ -579,6 +586,25 @@
     return $self->action_specs->{$name};
 }
 
+=head2 get_model_spec model_name
+
+Returns the model spec (which columns it has).  The first request for a
+particular model will ask the server for the spec.  Subsequent requests will
+return it from the cache.
+
+=cut
+
+sub get_model_spec {
+    my $self = shift;
+    my $name = shift;
+
+    unless ($self->model_specs->{$name}) {
+        $self->model_specs->{$name} = $self->get("model/$name");
+    }
+
+    return $self->model_specs->{$name};
+}
+
 =head2 get_sid
 
 Retrieves the sid from the L<LWP::UserAgent> object.


More information about the Jifty-commit mailing list