NAME

Clownfish::CFC::Binding::Perl::Subroutine - Abstract base binding for a Clownfish::CFC::Function.

SYNOPSIS

# Abstract base class.

DESCRIPTION

This class is used to generate binding code for invoking Clownfish's functions and methods across the Perl/C barrier.

METHODS

new

my $binding = $subclass->SUPER::new(
    param_list         => $param_list,           # required
    alias              => 'pinch',               # required
    class_name         => 'Crustacean::Claw',    # required
    use_labeled_params => 1,                     # default: false
);

Abstract constructor.

  • param_list - A Clownfish::CFC::ParamList.

  • alias - The local, unqualified name for the Perl subroutine that will be used to invoke the function.

  • class_name - The name of the Perl class that the subroutine belongs to.

  • use_labeled_params - True if the binding should take hash-style labeled parameters, false if it should take positional arguments.

xsub_def

Abstract method which must return C code (not XS code) defining the Perl XSUB.

get_class_name use_labeled_params

Accessors.

perl_name

Returns the fully-qualified perl sub name.

c_name

Returns the fully-qualified name of the C function that implements the XSUB.

c_name_list

Returns a string containing the names of arguments to feed to bound C function, joined by commas.

params_hash_def

Return Perl code initializing a package-global hash where all the keys are the names of labeled params. The hash's name consists of the the binding's perl_name() plus "_PARAMS".