If I create my hard coded setters and getters in module Page.pm, the problem don't arise. If I use my Autoload.pm the problem arise. ps. I modified the title in "Problem with Class and AUTOLOAD with GTK"package Autoload; use Locale::TextDomain ("kapello.it.$main::PROGRAM"); use Exporter; @ISA = qw (Exporter); @EXPORT = qw(AUTOLOAD); use Carp; sub AUTOLOAD{ my ($self, $newval) = @_; # Costruisco il metodo get if ($AUTOLOAD =~ /.*::get_(\w+)/){ my $property_name = $1; my $ref = ref($self->{$property_name}); if ($ref eq 'ARRAY'){ *{$AUTOLOAD} = sub { @{$self->{$property_name}} }; return @{$self->{$property_name}}; } else{ *{$AUTOLOAD} = sub { $self->{$property_name} }; return $self->{$property_name}; } } # Costruisco il metodo set if ($AUTOLOAD =~ /.*::set_(\w+)/){ my $property_name = $1; *{$AUTOLOAD} = sub { $self->{$property_name} = $newval }; return $self->{$property_name} = $newval; } # Deve esserci un errore croak __"Il metodo: $AUTOLOAD non è disponibile."; } 1;
In reply to Re^2: Problem with Class
by kapello
in thread Problem with Class and AUTOLOAD with GTK
by kapello
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |