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

Jifty commits jifty-commit at lists.jifty.org
Wed May 7 23:49:37 EDT 2008


Author: sartak
Date: Wed May  7 23:49:36 2008
New Revision: 5416

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

Log:
 r55416 at onn:  sartak | 2008-05-07 23:49:31 -0400
 Allow _moosify_columns to return methods


Modified: Net-Jifty/lib/Net/Jifty.pm
==============================================================================
--- Net-Jifty/lib/Net/Jifty.pm	(original)
+++ Net-Jifty/lib/Net/Jifty.pm	Wed May  7 23:49:36 2008
@@ -969,7 +969,7 @@
 
     # retrieve and massage spec from the server..
     my $spec = $self->get_model_spec($model);
-    my @attributes = $self->_moosify_columns($spec);
+    my ($attributes, $methods) = $self->_moosify_columns($spec);
 
     if ($class->can('meta')) {
         $class->meta->make_mutable;
@@ -978,13 +978,14 @@
     my $meta = Moose::Meta::Class->create(
         $class,
         superclasses => ['Net::Jifty::Record'],
-        attributes   => \@attributes,
+        attributes   => $attributes,
         methods      => {
+            %$methods,
             _net_jifty_model_class_created => sub { 1 },
         },
     );
 
-    for my $attribute (@attributes) {
+    for my $attribute (@$attributes) {
         my $name   = $attribute->name;
         my $reader = $attribute->get_read_method;
         my $writer = $attribute->get_write_method;
@@ -1011,6 +1012,7 @@
     my $self = shift;
     my $model_spec = shift;
     my @attributes;
+    my @methods;
 
     for my $column (keys %$model_spec) {
         next if $column eq 'id'; # already taken care of
@@ -1044,7 +1046,7 @@
         push @attributes, Moose::Meta::Attribute->new($column, %opts);
     }
 
-    return @attributes;
+    return (\@attributes, \@methods);
 }
 
 my %types = (


More information about the Jifty-commit mailing list