H
howa
Hello,
Is it possible to wrap a non-extistence function of an object, to
another function?
E.g.
package Test;
sub new {
my ( $class ) = @_;
my $self = undef;
bless $self, $class;
return $self;
}
sub call {
my ($self, $fn) = @_;
print $fn . " is called ";
}
1;
my $obj = Test->new();
$obj->foo(a,b,c)
# will become $obj->call("foo", a, b, c);
$obj->bar(d,e,f);
# will become $obj->call("bar", d, e, f);
Thanks.
Is it possible to wrap a non-extistence function of an object, to
another function?
E.g.
package Test;
sub new {
my ( $class ) = @_;
my $self = undef;
bless $self, $class;
return $self;
}
sub call {
my ($self, $fn) = @_;
print $fn . " is called ";
}
1;
my $obj = Test->new();
$obj->foo(a,b,c)
# will become $obj->call("foo", a, b, c);
$obj->bar(d,e,f);
# will become $obj->call("bar", d, e, f);
Thanks.