Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: right usage of #line ??

by jjmoka (Beadle)
on Sep 10, 2015 at 07:19 UTC ( [id://1141510]=note: print w/replies, xml ) Need Help??


in reply to Re: right usage of #line ??
in thread right usage of #line ??

I'm delighted of the feedback. Thanks. It's not my main activity but I'm investigating this topic by a while. Now I found some workaround (fixing #line) so that I can have a quite effective remote debugging session. But I'm interested to fix it definitely and understand the problem. Besides starting to add a first question on this site ( here ), I then provided a more detailed question here but I got no solution.

I'm just trying to use 2 old (and I so guess stable-enough) modules, mod_perl and Apache::DB. Even developed by the same author, Doug MacEachern, so I believe they should understand each other. I'm running them out of the box. MY code is only the 4 lines snipped shown, just to see them working as expected for the most simple case.

So the lab is this:

1. have Apache and mod_perl

2. have module Apache::DB

3. use the most simple httpd.conf. Mine is this

4. excute Apache in not-forking mode httpd  -X -DPERLDB -f simple.httpd.conf

5. point your browser to your snippet

6. go to your new fresh debug prompt, arisen magically in the shell of point 4

7. step-step-step-step ... till reaching the sub default_handler of mod_perl

(all will happen inside mod_perl, the file ModPerl::RegistryCooker )
A) sub default_handler { | B) |___| $rc = $self->convert_script_to_compiled_handler; | | | |___| .... C) | | my $line = $self->get_mark_line; D) | | my $eval = join '' ..... <------ the joi +n shown in my opening question above E) | | $rc = $self->compile(\$eval); | | |__ | | | .... F) | | | eval $$eval; <----- tr +anslated in return $self->error_check; | | | | | G) | | $self->cache_it; | H) | $rc = $self->run; | | .... I) | | eval { $cv->($r, @_) }; -------> JUM +P INTO USER CODE (here #line will not be understood)
I much appreciate the work of sir MacEachern, as it's a complex matter, but it shouldn't be such a pain to turn them on, after having simplifed your code to 4 lines (shebang, and print CGI header included!, ... so 2 lines). Why that #line is so difficult to understand ? Moreover as already linked (here again) , I found some different opinion on how it should be used so the fixed #line 1 in mod_perl code is on a different choice..... that incidentally does not work so well :)

Replies are listed 'Best First'.
Re^3: right usage of #line ??
by jjmoka (Beadle) on Sep 14, 2015 at 19:47 UTC
    I found a working solution. I post it here, in case others will join this page from Google, one day. Instead of trying to fix the #line issue, I decided to work around those evals. The 'evaled' code is not properly stored in Symbol Tables (much on this can be found also on this site). As the problem is always on the first entering file, I made a wrapper.pl of 2 lines, giving the problem to it, and having my code clean:
    require '/home/jjmoka/TEST/code/test2.pl' $DB::single=2;
    This worked both for the simplest example, and for my real production use case (with the proper path in the require).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1141510]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-20 00:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found