Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help! What is: Undefined subroutine &main::dienice called at train.pl

Status
Not open for further replies.

Zas

Programmer
Oct 4, 2002
211
US
Undefined subroutine &main::dienice called at train.pl line 85.

#line 84
open(TRAIN, ">$lccname/train.txt") or dienice("Couldn't open file for writing!");
#line 85
print TRAIN "$nowtrain";
#line 86
close TRAIN;

wheres the error? Happieness is like peeing your pants.
Everyone can see it, but only you can feel the warmth.
 
The line above your 'bolded' one is the offending entity. Perl is telling YOU that it has no idea where to find the subroutine called "dienice". It looked all around the "main" namespace and it was not there.

Since this is probably a CGI script, I would advise changing "dienice" to "die", and adding this near the top of your script:

use CGI::Carp qw/fatalsToBrowser/;

This should take care of your problem.

--jim
 
heh- I had:

use CGI::Carp qw/fatalsToBrowser/;

at the top. thats how I saw the error. I just thought die was the same as dienice. So why exactly wasn't it opening? Or did it just see dienice and think "WHAT THE #E!!, I see something I don't know, lets close." Happieness is like peeing your pants.
Everyone can see it, but only you can feel the warmth.
 
you would have to add a subroutine to your program called "dienice" to create a special error page. Since it wasn't there, the script crapped out.

ex:
Code:
sub dienice {
    my($errorMsg) = @_;
    print "OOPSIE! SCRIPT CRAPPED OUT BUT NOT BECAUSE THERE WAS NO SUB CALLED DIENICE";
    print $errorMsg;
    exit;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top