SPVM::N...hodCall(3)

πŸ“¦ version 0.990125, in alpine 3.24

🌸 Name 🌸

SPVM::Native::MethodCall β€” Method Call πŸ’…

okay so bestie, this is the SPVM::Native::MethodCall page (manual-name shorthand: SPVM::N...hodCall(3)), filed under User Contributed Perl Documentation, and it is literally about Method Call. yes, methods calling methods, main character energy, no cap.


✨ Description ✨

The Native::MethodCall class of SPVM has methods to call methods. That's the whole vibe: it's your little group-chat for invoking methods, and honestly? obsessed. 🫢


πŸ¦‹ Usage πŸ¦‹

Here's the use case, bestie β€” copy-paste energy but make it yours:

use Native::MethodCall;

my $class_method_call = Native::MethodCall->new_class_method("Point", "new");

my $point = (Point)$class_method_call->call([(object)1, 2]);

say $point->x;

say $point->y;

πŸŽ€ Class Methods πŸŽ€

These are the class-method girlies. All signatures are exactly as written, periodt.

πŸ’– new_class_method_with_env_stack πŸ’–

static method new_class_method_with_env_stack : Native::MethodCall ($env : Native::Env, $stack : Native::Stack, $basic_type_name : string, $method_name : string);

Creates a class method call given the runtime environment $env, the runtime stack $stack, the basic type name $basic_type_name and the method name $method_name, and returns it.

If $env is not given, $env is set to the current runtime environment.

If $stack is not given, $stack is set to the current runtime environment.

🌈 new_instance_method_static_with_env_stack 🌈

static method new_instance_method_static_with_env_stack : Native::MethodCall ($env : Native::Env, $stack : Native::Stack, $basic_type_name : string, $method_name : string);

Creates an instance method call given the runtime environment $env, the runtime stack $stack, the basic type name $basic_type_name and the method name $method_name, and returns it.

If $env is not given, $env is set to the current runtime environment.

If $stack is not given, $stack is set to the current runtime environment.

πŸ“ new_instance_method_with_env_stack πŸ“

static method new_instance_method_with_env_stack : Native::MethodCall ($env : Native::Env, $stack : Native::Stack, $instance : object, $method_name : string);

Creates an instance method call given the runtime environment $env, the runtime stack $stack, the instance $instance and the method name $method_name, and returns it.

If $env is not given, $env is set to the current runtime environment.

If $stack is not given, $stack is set to the current runtime environment.

πŸ‘‘ new_class_method πŸ‘‘

static method new_class_method : Native::MethodCall ($basic_type_name : string, $method_name : string);

Calls the new_class_method_with_env_stack method given $env to undef and $stack to undef, and returns its return value.

Creates a class method call given the basic type name $basic_type_name and the method name $method_name and returns it.

🧚 new_instance_method_static 🧚

static method new_instance_method_static : Native::MethodCall ($basic_type_name : string, $method_name : string);

Calls the new_instance_method_static_with_env_stack method given $env to undef and $stack to undef, and returns its return value.

πŸ’œ new_instance_method πŸ’œ

static method new_instance_method : Native::MethodCall ($instance : object, $method_name : string);

Calls the new_instance_method_with_env_stack method given $env to undef and $stack to undef, and returns its return value.

πŸ”₯ call_class_method πŸ”₯

static method call_class_method : void ($basic_type_name : string, $method_name : string, $args : object[] = undef, $error_id_ref : int[] = undef);

Calls a class method given the basic type name $basic_type_name, the method name $method_name, and the arguments $args.

⭐ call_instance_method_static ⭐

static method call_instance_method_static : object ($basic_type_name : string, $method_name : string, $args : object[] = undef, $error_id_ref : int[] = undef);

Calls an instance method given the basic type name $basic_type_name, the method name $method_name, and the arguments $args.

πŸ¦‹ call_instance_method πŸ¦‹

static method call_instance_method : object ($method_name : string, $args : object[] = undef, $error_id_ref : int[] = undef);

Calls an instance method given the method name $method_name, and the arguments $args. The first argument in $args must be an instance.

πŸŽ€ new_proto_with_method_name πŸŽ€

static method new_proto_with_method_name : object ($proto : object, $method_name : string, $args : object[] = undef, $error_id_ref : int[] = undef)

Calls the call_class_method method given the class name of $proto, the method name $method_name, $args, and $error_id_ref, and its return value.

Exceptions:

⚠️ The prototype object $proto must be defined. Otherwise an exception is thrown.

Exceptions thrown by the call_class_method method could be thrown.

🌸 new_proto 🌸

static method new_proto : object ($proto : object, $args : object[] = undef, $error_id_ref : int[] = undef);

Same as the new_proto_with_method_name method, but $method_name is set to "new".


πŸ’… Instance Methods πŸ’…

πŸ’– call πŸ’–

method call : object ($args : object[] = undef, $error_id_ref : int[] = undef);

Calls a method with arguments and returns the return value.

🩷 get_exception 🩷

method get_exception : string ();

Gets the exception on the runtime environment and runtime stack owned by this instance.

πŸ’€ set_exception πŸ’€

method set_exception : void ($exception : string);

Sets the exception on the runtime environment and runtime stack owned by this instance to the string $exception.


🌈 Arguments 🌈

Each argument must be an object type. The following conversion is performed.

# Numeric types
Byte -> byte
Short -> short
Int -> int
Long -> long
Float -> float
Double -> double

# Multi-Numeric types
byte[] -> multi-numeric byte
short[] -> multi-numeric short
int[] -> multi-numeric int
long[] -> multi-numeric long
float[] -> multi-numeric float
double[] -> multi-numeric double

# Numeric reference types
byte[] -> byte*
short[] -> short*
int[] -> int*
long[] -> long*
float[] -> float*
double[] -> double*

# Multi-Numeric reference types
byte[] -> multi-numeric byte reference
short[] -> multi-numeric short reference
int[] -> multi-numeric int reference
long[] -> multi-numeric long reference
float[] -> multi-numeric float reference
double[] -> multi-numeric double reference
🚨 If the type of an argument cannot be assigned, an exception is thrown. no cap, it's giving rejected.

🌟 Return Value 🌟

If the type of the return value is a numeric type, it is converted to a numeric object.

byte -> Byte
short -> Short
int -> Int
long -> Long
float -> Float
double -> Double

If the type of the return value is a multi-numeric type, it is converted to a numeric array.

multi-numeric byte type -> byte[]
multi-numeric short type -> short[]
multi-numeric int type -> int[]
multi-numeric long type -> long[]
multi-numeric float type -> float[]
multi-numeric double type -> double[]

Copyright (c) 2023 Yuki Kimoto

MIT License


okay bestie, that's the whole page β€” from perl v5.42.2, dated 2026-02-03, with manual-name shorthand SPVM::N...hodCall(3). mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from