$rest = $$text;
# insert spaces in place of tabs
- $rest =~ s#.*#
- my $line = $&;
- 1 while $line =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;
+ $rest =~ s#(.+)#
+ my $line = $1;
+ 1 while $line =~ s/(\t+)/' ' x ((length($1) * 8) - $-[0] % 8)/e;
$line;
#eg;
Exporter::export_ok_tags('ALL');
+##
+## These shenanagins are to avoid using $& in perl5.6+
+##
+my $GetMatchedText = ($] < 5.006) ? eval 'sub { $& } '
+ : eval 'sub {
+ substr($_[0], $-[0], $+[0] - $-[0])
+ }';
+
+
# PROTOTYPES
sub _match_bracketed($$$$$$);
if (!defined $rdel)
{
- $rdelspec = $&;
+ $rdelspec = &$GetMatchedText($$textref);
+
unless ($rdelspec =~ s/\A([[(<{]+)($XMLNAME).*/ quotemeta "$1\/$2". revbracket($1) /oes)
{
_failmsg "Unable to construct closing tag to match: $rdel",
elsif (ref($func) eq 'Text::Balanced::Extractor')
{ @bits = $field = $func->extract($$textref) }
elsif( $$textref =~ m/\G$func/gc )
- { @bits = $field = defined($1) ? $1 : $& }
+ { @bits = $field = defined($1) ? $1 : &$GetMatchedText($$textref) }
+ # substr() on previous line is "$&", without the pain
$pref ||= "";
if (defined($field) && length($field))
{