Done! For the record, I attached the final MethodMaker-derived code. Would you accept a small tip via PayPal (if so, what e-mail should I use)?
I'm going to see about submitting this for the MethodMaker maintainer.
-Dan#################################################################### ## CustomMethodMaker #################################################################### package CustomMethodMaker; use base ( 'Class::MethodMaker' ); use Carp; =head2 grouped_fields_inherit Works like grouped_fields, except that it also calls the parent class. =cut sub grouped_fields_inherit { my ($class, %args) = @_; my %methods; foreach (keys %args) { my @slots = @{$args{$_}}; $class->get_set(@slots); my $method_name = $_; my $caller = $class->find_target_class(); $methods{$_} = sub { my ( $self ) = @_; my @parent_slots = (); my $to_execute = "SUPER::$method_name"; # # Without $caller and eval, the following line causes this err +or: # # Can't locate auto/CustomMethodMaker/SUPER/[METHOD].al in @ +INC # @parent_slots = eval "package $caller; return \$self->SUPER::$ +method_name(\@_); 1" or die $@; return ( @parent_slots, @slots ); }; } $class->install_methods(%methods); } 1;
In reply to Re: Re5: Calling SUPER in MethodMaker-generated methods
by danb
in thread Calling SUPER in MethodMaker-generated methods
by danb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |