use vars qw($VERSION);
use Carp;
-$VERSION = '2.07';
+$VERSION = '2.09';
# LOAD FILTERING MODULE...
return $status if $status<0;
$_ = filter_blocks($_,$offset);
$_ = "# line $offset\n" . $_ if $offset; undef $offset;
- # print STDERR $_;
return $status;
}
my @pos = Text::Balanced::_match_quotelike(\$source,qr/\s*/,1,0);
if (defined $pos[0])
{
- $text .= " " . substr($source,$pos[2],$pos[18]-$pos[2]);
+ $text .= " " if $pos[0] < $pos[2];
+ $text .= substr($source,$pos[2],$pos[18]-$pos[2]);
next component;
}
if ($source =~ m/\G\s*($pod_or_DATA)/gc) {
@pos = Text::Balanced::_match_variable(\$source,qr/\s*/);
if (defined $pos[0])
{
- $text .= " " . substr($source,$pos[0],$pos[4]-$pos[0]);
+ $text .= " " if $pos[0] < $pos[2];
+ $text .= substr($source,$pos[0],$pos[4]-$pos[0]);
next component;
}
$text .= $1."if (Switch::case";
if (@pos = Text::Balanced::_match_codeblock(\$source,qr/\s*/,qr/\{/,qr/\}/,qr/\{/,qr/\}/,undef)) {
my $code = substr($source,$pos[0],$pos[4]-$pos[0]);
- $text .= " sub" if is_block $code;
- $text .= " " . filter_blocks($code,line(substr($source,0,$pos[0]),$line)) . ")";
+ $text .= " " if $pos[0] < $pos[2];
+ $text .= "sub " if is_block $code;
+ $text .= filter_blocks($code,line(substr($source,0,$pos[0]),$line)) . ")";
}
elsif (@pos = Text::Balanced::_match_codeblock(\$source,qr/\s*/,qr/[[(]/,qr/[])]/,qr/[[({]/,qr/[])}]/,undef)) {
my $code = filter_blocks(substr($source,$pos[0],$pos[4]-$pos[0]),line(substr($source,0,$pos[0]),$line));
$code =~ s {^\s*[(]\s*m\b} { ( qr} ||
$code =~ s {^\s*[(]\s*/} { ( qr/} ||
$code =~ s {^\s*[(]\s*qw} { ( \\qw};
- $text .= " $code)";
+ $text .= " " if $pos[0] < $pos[2];
+ $text .= "$code)";
}
elsif ($Perl6 && do{@pos = Text::Balanced::_match_variable(\$source,qr/\s*/)}) {
my $code = filter_blocks(substr($source,$pos[0],$pos[4]-$pos[0]),line(substr($source,0,$pos[0]),$line));
$code =~ s {^\s*%} { \%} ||
$code =~ s {^\s*@} { \@};
- $text .= " $code)";
+ $text .= " " if $pos[0] < $pos[2];
+ $text .= "$code)";
}
elsif ( @pos = Text::Balanced::_match_quotelike(\$source,qr/\s*/,1,0)) {
my $code = substr($source,$pos[2],$pos[18]-$pos[2]);
$code =~ s {^\s*m} { qr} ||
$code =~ s {^\s*/} { qr/} ||
$code =~ s {^\s*qw} { \\qw};
- $text .= " $code)";
+ $text .= " " if $pos[0] < $pos[2];
+ $text .= "$code)";
}
elsif ($Perl5 && $source =~ m/\G\s*(([^\$\@{])[^\$\@{]*)(?=\s*{)/gc
|| $Perl6 && $source =~ m/\G\s*([^;{]*)()/gc) {
=head1 VERSION
-This document describes version 2.07 of Switch,
-released May 15, 2002.
+This document describes version 2.09 of Switch,
+released June 12, 2002.
=head1 SYNOPSIS
Perl 6 will provide a built-in switch statement with essentially the
same semantics as those offered by Switch.pm, but with a different
-pair of keywords. In Perl 6 C<switch> with be spelled C<given>, and
+pair of keywords. In Perl 6 C<switch> will be spelled C<given>, and
C<case> will be pronounced C<when>. In addition, the C<when> statement
will not require switch or case values to be parenthesized.