X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fabbrev.pl;h=eac0053ce759b3b5c08cbea09246e7bf3ca964f3;hb=b41aadf259cf55858c5ab0386356cdbe2dc49a6b;hp=5859a7be48d8f0376fe231b94b8557c86d6d742c;hpb=a687059cbaf2c6fdccb5e0fae2aee80ec15625a8;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/abbrev.pl b/lib/abbrev.pl index 5859a7b..eac0053 100644 --- a/lib/abbrev.pl +++ b/lib/abbrev.pl @@ -4,19 +4,36 @@ ;# ... ;# $long = $foo{$short}; +# +# This library is no longer being maintained, and is included for backward +# compatibility with Perl 4 programs which may require it. +# This legacy library is deprecated and will be removed in a future +# release of perl. +# +# In particular, this should not be used as an example of modern Perl +# programming techniques. +# +# Suggested alternative: Text::Abbrev +# + package abbrev; +warn( "The 'abbrev.pl' legacy library is deprecated and will be" + . " removed in the next major release of perl. Please use the" + . " Text::Abbrev module instead." ); + sub main'abbrev { local(*domain) = @_; shift(@_); @cmp = @_; + local($[) = 0; foreach $name (@_) { @extra = split(//,$name); $abbrev = shift(@extra); $len = 1; foreach $cmp (@cmp) { next if $cmp eq $name; - while (substr($cmp,0,$len) eq $abbrev) { + while (@extra && substr($cmp,0,$len) eq $abbrev) { $abbrev .= shift(@extra); ++$len; }