NAME

Sub::Deprecate - Assists in providing deprecation notices to subs

VERSION

Version 0.01

SYNOPSIS

Quick summary of what the module does.

Perhaps a little code snippet.

		use experimental 'signatures';
    use Sub::Deprecate qw(sub_rename_with sub_trigger_once_with);

    sub foo { 7 };
		sub_trigger_once_with( __PACKAGE__, 'foo', sub ($target) { warn "Triggered!" } );
		# foo() # will trigger cb event


		sub fancy_new { 7 }
		sub_rename_with( __PACKAGE__, 'old_and_deprecated', 'fancy_new', sub ($old, $new) { warn "sub old_and_deprecated is deprecated" } );
		old_and_deprecated() # will warn and redirect to fancy_new
    ...

EXPORT

A list of functions that can be exported. You can delete this section if you don't export anything, such as for a purely object-oriented module.

SUBROUTINES/METHODS

sub_rename_with($pkg, $from, $to, &cb($from,$to))

Allows you to rename a function. Typically this is done when an old and deprecated function is moved elsewhere and you wish to retain the old name. A further callback can be provided which will received the name of the old function, and the new function.

sub_trigger_once_with($pkg, $target, &cb($target))

Allows you to trigger a callback when a remote function is called.

AUTHOR

Evan Carroll, <me at evancarroll.com>

BUGS

Please report any bugs or feature requests to bug-sub-deprecate at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Sub-Deprecate. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Sub::Deprecate

You can also look for information at:

ACKNOWLEDGEMENTS

This module was inspired by the blog post here https://phoenixtrap.com/2021/06/29/gradual-method-renaming-in-perl/ by Mark Gardner.

LICENSE AND COPYRIGHT

This software is Copyright (c) 2021 by Evan Carroll.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)