our
$AUTOLOAD
;
sub
AUTOLOAD {
my
$self
=
shift
;
my
$method_name
=
$AUTOLOAD
;
unless
(
ref
$self
) {
my
$basic_type_name
=
$self
;
$basic_type_name
=~ s/^SPVM:://;
$method_name
=~ s/^.*:://;
Carp::confess(
"The \"$method_name\" method in the \"$basic_type_name\" class is not found"
);
}
$method_name
=~ s/^SPVM:://;
$method_name
=~ s/^BlessedObject::Class:://;
my
$ret
=
$self
->__api->call_method(
$self
,
$method_name
,
@_
);
return
$ret
;
}
1;
=head1 Name
SPVM::BlessedObject::Class - SPVM Class
=head1 Description
The object of C<SPVM::BlessedObject::Class> class holds an instance of an SPVM class.
=head1 Usage
my
$point
= SPVM::Point->new;
$point
->set_x(4);
my
$x
=
$point
->x;
$point
->clear;
=head1 Instance Methods
=head2 AUTOLOAD
my
$ret
=
$blessed_object_class
->foo(
@args
);
my
$ret
=
$blessed_object_class
->SPVM::MyClass::foo(
@args
);
Calls an SPVM instance method using L<SPVM::ExchangeAPI/
"call_method"
>
with
the arguments, and returns the
return
value.
The static instance method call is allowed.
If the class or the method is not found, an exception is thrown.
If the invocant cannnot be assigned to the class of the static method call, an exception is thrown.
Examples:
my
$point
= Point->new;
$point
->set_x(4);
my
$x
=
$point
->x;
$point
->clear;
=head1 Copyright & License
Copyright (c) 2023 Yuki Kimoto
MIT License