f



why doesn't this eval print ?

  eval 'print "hello world"';

main::(x.pl:4): eval 'print "hello world"';
  DB<1> n
main::((eval 8)[x.pl:4]:1):     print "hello world"
  DB<1>


*DOH!* Where IS it!?

-Homer

0
MisterPerl (19)
5/19/2006 12:32:45 PM
comp.lang.perl.misc 33233 articles. 2 followers. brian (1246) is leader. Post Follow

2 Replies
452 Views

Similar Articles

[PageSpeed] 14

Mr P wrote:

> eval 'print "hello world"';
>
> main::(x.pl:4): eval 'print "hello world"';
>   DB<1> n
> main::((eval 8)[x.pl:4]:1):     print "hello world"
>   DB<1>
>
>
> *DOH!* Where IS it!?
>
> -Homer

Did you hit 'n' again to execute the last line of code ? It works as
expected for me using Active state 5.8.7

C:\develop\NiallPerlScripts>perl -d eval1.pl

Loading DB routines from perl5db.pl version 1.28
Editor support available.

Enter h or `h h' for help, or `perldoc perldebug' for more help.

main::(eval1.pl:1):     eval 'print "hello world"';
SetConsoleMode failed, LastError=|6| at
C:/Perl/site/lib/Term/ReadKey.pm line 26
5.
 at C:/Perl/site/lib/Term/ReadLine/readline.pm line 1415
        readline::readline('  DB<1> ') called at
C:/Perl/site/lib/Term/ReadLine/
Perl.pm line 12

Term::ReadLine::Perl::readline('Term::ReadLine::Perl=ARRAY(0x18d537c)',
'  DB<1> ') called at C:/Perl/lib/perl5db.pl line 6367
        DB::readline('  DB<1> ') called at C:/Perl/lib/perl5db.pl line
2203
        DB::DB called at eval1.pl line 1
  DB<1> n
main::((eval 10)[eval1.pl:1]:1):        print "hello world"
  DB<1> n
hello worldDebugged program terminated.  Use q to quit or R to restart,
  use O inhibit_exit to avoid stopping after program termination,
  h q, h R or h O to get additional info.
  DB<1>

0
niall
5/19/2006 2:42:24 PM
Homer:

> *DOH!* Where IS it!?

Perl uses buffered output. So, while running under the debugger,
the output may delayed until the program terminates. So look
again at the _entire_ debugger output.

You may consider to add

$| = 1;

as first line in your code. This will force to immediately put
out all data, without buffering.

Greetings, Ferry

-- 
Ing. Ferry Bolhar
Municipality of Vienna, Department 14
A-1010 Vienna / AUSTRIA
E-mail: bol@adv.magwien.gv.at


0
Ferry
5/19/2006 3:47:06 PM
Reply: