| Dancer documentation | Contained in the Dancer distribution. |
Dancer::Deprecation - handle deprecation messages
Dancer::Deprecation->deprecated(
feature => 'sub_name',
version => '1.3000',
reason => '...',
);
List of possible parameters:
You can call the method with no arguments, and a default message using informations from caller will be build for you.
This module is free software and is distributed under the same terms as Perl itself.
This module has been written by Alexis Sukrieh <sukria@sukria.net>
| Dancer documentation | Contained in the Dancer distribution. |
package Dancer::Deprecation; use strict; use warnings; use Carp qw/croak carp/; sub deprecated { my ($class, %args) = @_; my ( $package, undef, undef, $sub ) = caller(1); unless ( defined $args{feature} ) { $args{feature} = $sub; } my $deprecated_at = defined $args{version} ? $args{version} : undef; my $msg; if ( defined $args{message} ) { $msg = $args{message}; } else { $msg = "$args{feature} has been deprecated"; } $msg .= " since version $deprecated_at" if defined $deprecated_at; $msg .= ". " . $args{reason} if defined $args{reason}; croak($msg) if $args{fatal}; carp($msg); } 1;