ExtUti...nction(3pm)

πŸ¦‹ ExtUtils::XSpp::Node::Function πŸ¦‹

okay so bestie, welcome to the manual page for ExtUtils::XSpp::Node::Function β€” that's the Perl module in the User Contributed Perl Documentation crew, and it's literally the node representing a function. yes queen, we're doing object-oriented parsing today πŸ’…


✨ NAME ✨

ExtUtils::XSpp::Node::Function β€” a Node representing a function 🫢


🌸 DESCRIPTION 🌸

so this is an ExtUtils::XSpp::Node subclass, and what it does is represent a single function declaration. like, one (1) function. for example:

int foo();

that's it. that's the vibe. πŸŽ€

but here's the part that's giving main character energy: ExtUtils::XSpp::Node::Method inherits from this class. so everything you read in here? applies equally to method nodes. no cap. every single thing. ⭐


πŸ’– METHODS πŸ’–

new

Creates a new ExtUtils::XSpp::Node::Function. fresh out the box, iconic, brand new ✨

here are the named parameters you can pass:

  • cpp_name β€” the C++ name of the function
  • perl_name β€” the Perl name of the function (defaults to the same as cpp_name)
  • arguments β€” can be a reference to an array of ExtUtils::XSpp::Node::Argument objects
  • ret_type β€” the (C++) return type of the function

and additionally, there are several optional decorators for a function declaration (go peek at ExtUtils::XSpp for a whole list of them, iykyk). you can pass these to the constructor as:

  • code
  • cleanup
  • postcall
  • catch β€” ⚠️ this one is special: it must be a reference to an array of class names. not optional, not negotiable, it's just how she is πŸ’€

resolve_typemaps

Fetches the ExtUtils::XSpp::Typemap object for the return type and for the arguments, from the typemap registry, and stores a reference to those objects. collecting her little typemap babies 🧺

resolve_exceptions

Fetches the ExtUtils::XSpp::Exception object for the %catch directives associated with this function. catching exceptions like catching feelings 😭

add_exception_handlers

Adds a list of exception names to the list of exception handlers. this is mainly called by a class' add_methods method. important caveat bestie: if the function is hard-wired to have no exception handlers, then any extra handlers from the class are ignored. periodt. πŸ™ˆ

Returns a string with a C++ method declaration for the node. yes, she prints. we love a productive queen πŸ‘‘

perl_function_name

Returns the name of the Perl function to generate.

is_method

Returns whether the object at hand is a method. for an ExtUtils::XSpp::Node::Function object this is hard-wired to be false β€” nope, not a method, sorry β€” but it gets overridden in the ExtUtils::XSpp::Node::Method sub-class. glow up 🌈

has_argument_with_length

Returns true if the function has any argument that uses the XS length feature. length check passed, slay βœ…


πŸŽ€ ACCESSORS πŸŽ€

cpp_name

Returns the C++ name of the function.

perl_name

Returns the Perl name of the function (defaults to same as C++).

set_perl_name

Sets the Perl name of the function. little rename moment πŸ’…

arguments

Returns the internal array reference of ExtUtils::XSpp::Node::Argument objects that represent the function arguments.

ret_type

Returns the C++ return type.

code

Returns the %code decorator if any.

set_code

Sets the implementation for the method call (equivalent to using %code); takes the code as an array reference containing the lines.

cleanup

Returns the %cleanup decorator if any.

postcall

Returns the %postcall decorator if any.

catch

Returns the set of exception types that were associated with the function via %catch. (that's an array reference, for the record)

aliases

Returns a hashref of name => position function name aliases (see %alias and the perlxs ALIAS keyword). 🚨 does not include the main function name β€” that one is the main character, she's above aliases fr fr.

set_static

Sets the "static"-ness attribute of the function. can be either:

  • undef (i.e. not static)
  • package_static
  • class_static

pick your fighter πŸ₯Š

package_static

Returns whether the function is package static. a package static function can be invoked as:

My::Package::Function( ... );

class_static

Returns whether the function is class static. a class static function can be invoked as:

My::Package->Function( ... );

ret_typemap

Returns the typemap for the return value of the function.

set_ret_typemap( typemap )

Sets the typemap for the return value of the function.

arg_typemap( index )

Returns the typemap for one function arguments.

set_arg_typemap( index, typemap )

Sets the typemap for one function argument.


πŸ’– reminder bestie: ExtUtils::XSpp::Node::Method inherits all of this. every accessor, every method, all of it. so if you're here for methods, you're in the right place, you didn't take a wrong turn 🫢

and that's the whole page!! πŸŽ‰ this was written by the User Contributed Perl Documentation girlies over at perl v5.40.1, dated 2026-07-03 β€” yes the future, yes she's ahead of her time, and she ate. 🌟 bye bestie, go build something iconic πŸ’œ

πŸ“¦ where this page comes from