stevieb has asked for the wisdom of the Perl Monks concerning the following question:
Is this a simple case of me not knowing about a write output or seriously overlooking something blatant?
I was reading that use re 'debug'; is lexically scoped, but after redirecting both STDERR and STDOUT to a file, I still get output to on my console. The scope works properly (as I don't see output for the latter regex check on either STD* outputs or files), but why is there output from re 'debug' showing up on my console even with the redirects?
What output is the debug command outputting to that I don't know about?
#!/usr/bin/perl use warnings; use strict; my $string = 'd"alice'; { use re 'debug'; open STDERR, '>', 'err.txt' or die $!; open STDOUT, '>', 'out.txt' or die $!; $string =~ s/\bd\"//g; } $string =~ /alice/;
Output to the console from the code above:
$ ./bound.pl Compiling REx "\bd\%"" Final program: 1: BOUND (2) 2: EXACT <d"> (4) 4: END (0) anchored "d%"" at 0 (checking anchored) stclass BOUND minlen 2
Full output without redirects or scoping the use statement:
Compiling REx "\bd\%"" Final program: 1: BOUND (2) 2: EXACT <d"> (4) 4: END (0) anchored "d%"" at 0 (checking anchored) stclass BOUND minlen 2 Matching REx "\bd\%"" against "d%"alice" Intuit: trying to determine minimum start position... doing 'check' fbm scan, [0..7] gave 0 Found anchored substr "d%"" at offset 0 (rx_origin now 0)... (multiline anchor test skipped) looking for class: start_shift: 0 check_at: 0 rx_origin: 0 endpos: 1 Does not contradict STCLASS... Intuit: Successfully guessed: match at offset 0 0 <> <d"alice> | 1:BOUND(2) 0 <> <d"alice> | 2:EXACT <d">(4) 2 <d"> <alice> | 4:END(0) Match successful! Matching REx "\bd\%"" against "alice" Intuit: trying to determine minimum start position... doing 'check' fbm scan, [2..7] gave -1 Did not find anchored substr "d%""... Match rejected by optimizer Freeing REx: "\bd\%""
Why is the beginning part of the output being written to the console, and the rest stored in my redirected err.txt file?
On v5.22.0 fwiw
-stevieb
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: use re 'debug';, scope, and output
by Anonymous Monk on Jul 14, 2015 at 01:20 UTC | |
by stevieb (Canon) on Jul 14, 2015 at 02:07 UTC | |
by Anonymous Monk on Jul 14, 2015 at 07:10 UTC | |
|
Re: use re 'debug';, scope, and output
by QM (Parson) on Jul 14, 2015 at 09:08 UTC | |
by Anonymous Monk on Jul 14, 2015 at 10:02 UTC |