The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Log::Any::Plugin::Util - Utilities for Log::Any::Plugin classes

VERSION

version 0.001

DESCRIPTION

These functions are only of use to authors of Log::Any::Plugin classes.

Users should see Log::Any::Plugin instead.

FUNCTIONS

around ( $class, $method_name, &new_method )

Applies an 'around' method modifier to the given method. Semantics are very similar to the 'around' method modifier in Moose.

Throws an exception if no method by that name exists.

  • $class

    Name of class containing the method.

  • $method_name

    Name of method to be modified.

  • &new_method

    Coderef of the new method. Arguments are passed the same as a Moose 'around' modifier: ($old_method, $self, @args)

before ( $class, $method_name, &new_method )

Applies a 'before' method modifier to the given method. Semantics are very similar to the 'before' method modifier in Moose.

Simply installs the new method if no method by that name exists.

  • $class

    Name of class containing the method.

  • $method_name

    Name of method to be modified.

  • &new_method

    Coderef of the new method. Arguments are passed the same as a Moose 'before' modifier: ($self, @args)

after ( $class, $method_name, &new_method )

Applies a 'after' method modifier to the given method. Semantics are very similar to the 'after' method modifier in Moose.

Simply installs the new method if no method by that name exists.

  • $class

    Name of class containing the method.

  • $method_name

    Name of method to be modified.

  • &new_method

    Coderef of the new method. Arguments are passed the same as a Moose 'after' modifier: ($self, @args)

get_old_method ( $class, $method_name )

Returns a coderef of the existing method in the class, or undef if none exists. Exactly the same semantics as $class->can($method_name).

set_new_method ( $class, $method_name, &new_method )

Replaces the given method with the new version.

  • $class

    Name of class containing the method.

  • $method_name

    Name of method to be modified.

  • &new_method

    Coderef of the new method. Unlike 'around', this method takes exactly the same parameters as the original method: ($self, @args)

get_class_name ( $name )

Creates a fully-qualified class name from the abbreviated class name rules in Log::Any::Plugin.

  • $name

    Either a namespace suffix, or a fully-qualified class name prefixed with '+'.

SEE ALSO

Log::Any::Plugin

ACKNOWLEDGEMENTS

Thanks to Strategic Data for sponsoring the development of this module.

AUTHOR

Stephen Thirlwall <sdt@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Stephen Thirlwall.

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