Andrew Main (Zefram)

NAME

Sub::Mutate - examination and modification of subroutines

SYNOPSIS

        use Sub::Metadata qw(
                sub_body_type
                sub_closure_role
                sub_is_lvalue
                sub_is_constant
                sub_is_method mutate_sub_is_method
                sub_is_debuggable mutate_sub_is_debuggable
                sub_prototype mutate_sub_prototype
        );

        $type = sub_body_type($sub);
        $type = sub_closure_role($sub);
        if(sub_is_lvalue($sub)) { ...
        if(sub_is_constant($sub)) { ...
        if(sub_is_method($sub)) { ...
        mutate_sub_is_method($sub, 1);
        if(sub_is_debuggable($sub)) { ...
        mutate_sub_is_debuggable($sub, 0);
        $proto = sub_prototype($sub);
        mutate_sub_prototype($sub, $proto);

        use Sub::WhenBodied qw(when_sub_bodied);

        when_sub_bodied($sub, sub { mutate_sub_foo($_[0], ...) });

DESCRIPTION

This module is a backward-compatibility wrapper repackaging functions that are now supplied by other modules. It is deprecated to use this module: you should instead get the functions directly from Sub::Metadata or Sub::WhenBodied as appropriate.

FUNCTIONS

sub_body_type(SUB)
sub_closure_role(SUB)
sub_is_lvalue(SUB)
sub_is_constant(SUB)
sub_is_method(SUB)
mutate_sub_is_method(SUB, NEW_METHODNESS)
sub_is_debuggable(SUB)
mutate_sub_is_debuggable(SUB, NEW_DEBUGGABILITY)
sub_prototype(SUB)
mutate_sub_prototype(SUB, NEW_PROTOTYPE)

These functions are supplied by Sub::Metadata. You should use that module directly. See that module for documentation.

when_sub_bodied(SUB, ACTION)

This function is supplied by Sub::WhenBodied. You should use that module directly. See that module for documentation.

SEE ALSO

Sub::Metadata, Sub::WhenBodied

AUTHOR

Andrew Main (Zefram) <zefram@fysh.org>

COPYRIGHT

Copyright (C) 2009, 2010, 2011, 2013, 2015 Andrew Main (Zefram) <zefram@fysh.org>

LICENSE

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.