in reply to cgi code line message

Here is a solution that involves a minimal edit to your existing code:

open( FILE, "$file" ) || error_message( "File can not be opened: Line __LINE__.\n" );

But when debugging CGI scripts, CGI::Carp can be much more useful, and would enable you to use die while dumping fatal error messages to the browser.

Update:
Dumb mistake here: __LINE__ doesn't interpolate (nor should it). See my followup: Re^3: cgi code line message. Apologies!


Dave

Replies are listed 'Best First'.
Re^2: cgi code line message
by Murcia (Monk) on Jun 06, 2005 at 07:54 UTC
    sorry; but I tried your code and it did not work ... error_message( "File can not be opened: Line ". __LINE__. "\n" ); to be correct ... thanks a lot!

      My dumb mistake. Forgot that __LINE__ doesn't (and shouldn't) interpolate. Here ya go...

      error_message( "File cannot be opened: Line " . __LINE__ . "\n" );

      Looks like you already figured it out though. Hope you find it helpful!


      Dave