Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
move $? to Perl5::Terms
  • Loading branch information
FROGGS committed May 21, 2013
1 parent 01aa6d2 commit c799910
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
4 changes: 0 additions & 4 deletions lib/Perl5/Actions.nqp
Expand Up @@ -1483,10 +1483,6 @@ class Perl5::Actions is HLL::Actions does STDActions {
$V5DEBUG && say("special_variable:sym<\$.>($/)");
}

method special_variable:sym<$?>($/) {
$V5DEBUG && say("special_variable:sym<\$?>($/)");
}

method name($/) {
$V5DEBUG && say("name($/)"); }

Expand Down
2 changes: 2 additions & 0 deletions lib/Perl5/English.pm
Expand Up @@ -13,6 +13,8 @@ sub EXPORT(|) {
use v5;
$ex{'$SUBSCRIPT_SEPARATOR'} = $;; # XXX do binding instead of assignment
$ex{'$SUBSEP'} = $;;
$ex{'$OUTPUT_AUTOFLUSH'} = $|;
$ex{'$CHILD_ERROR'} = $?;
}
%ex
}
4 changes: 0 additions & 4 deletions lib/Perl5/Grammar.nqp
Expand Up @@ -2318,10 +2318,6 @@ grammar Perl5::Grammar is HLL::Grammar does STD5 {
<sym> | '$INPUT_LINE_NUMBER' | '$NR'
}

token special_variable:sym<$?> {
<sym> | '$CHILD_ERROR'
}

token special_variable:sym<${ }> {
<!before { 1; }>
}
Expand Down
2 changes: 2 additions & 0 deletions lib/Perl5/Terms.pm
Expand Up @@ -11,6 +11,7 @@ my $OUTPUT_AUTOFLUSH_P := Proxy.new(
FETCH => method () { $OUTPUT_AUTOFLUSH },
STORE => method ($n) { $OUTPUT_AUTOFLUSH = $n; try $*OUT.autoflush( ?$n ); } # XXX there is no IO::Handle.autoflush (yet)
);
my $CHILD_ERROR = 0;

sub EXPORT(|) {
my %ex;
Expand All @@ -20,6 +21,7 @@ sub EXPORT(|) {
%ex<$]> := $VERSION_FLOAT;
%ex<$;> := $SUBSCRIPT_SEPARATOR;
%ex<$|> := $OUTPUT_AUTOFLUSH_P;
%ex<$?> := $CHILD_ERROR;

# Because Perl6 already has variables like $/ and $! built in, we can't ex-/import them directly.
# So we need an accessor, the grammar token '$/' can use, and a way to support the English module.
Expand Down

0 comments on commit c799910

Please sign in to comment.