in reply to Re^2: Reset the effect of #line
in thread Reset the effect of #line

Oh well, not putting __FILE__ in the directive won't work there, my bad :).

Could you eval your generated code instead? You do get the original filename back when you exit the eval scope:

#line 10 Foo warn; eval <<"BAZ"; #line 100 Bar warn; BAZ warn;
Warning: something's wrong at Foo line 10. Warning: something's wrong at Bar line 100. Warning: something's wrong at Foo line 15.