1package Data::Localize::Util;
2use strict;
3use base qw(Exporter);
4use Data::Localize;
5our @EXPORT_OK = qw(_alias_and_deprecate);
6
7sub _alias_and_deprecate($$) {
8    my ($old, $new) = @_;
9
10    my ($pkg) = caller();
11    {
12        no strict 'refs';
13        my $code = \&{ $pkg . '::' . $new };
14        if (Data::Localize::DEBUG()) {
15            *{ $pkg . '::' . $old } = sub {
16                local $Carp::CarpLevel = $Carp::CarpLevel + 1;
17                Carp::cluck("Use of $old is deprecated. Please use $new instead");
18                $code->(@_);
19            };
20        } else {
21            *{$pkg . '::' . $old} = *{ $pkg . '::' . $new};
22        }
23    }
24}
25
261;
27
28__END__
29
30=head1 NAME
31
32Data::Localize::Util - Data::Localize Internal Utilities
33
34=head1 SYNOPSIS
35
36    # Used internally
37
38=cut
39