in reply to Moose and AUTOLOAD

Would $rs->$field_name() do what you want? It's not especially Moose-ish but it's fairly standard Perl reflection.

-- Ken

Replies are listed 'Best First'.
Re^2: Moose and AUTOLOAD
by rootcho (Pilgrim) on Nov 04, 2010 at 15:32 UTC
    nice :) thanx for the idea

    ;( wont help cause I hold the current row of data in $rs->{row} ... so it has to be $rs->{row}{field_name}
      my $method = $$rs{row}{field_name}; my $rv = $object->$method();

      or

      my ($rv) = map { $object->$_() } $$rs{row}{field_name};

      or

      use List::Util qw( first ); # core since Perl 5.7.3 my $rv = first { $object->$_() } $$rs{row}{field_name};

      or

      $object->$_() for $$rs{row}{field_name};, if you don't need to save its return value.