Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
i am getting an error when my code is fine that is my database connectivity is fineeval { open($DBH, $dbh = DBI->connect('dbi:ODBC:driver=microsoft access driv +er (*.mdb);dbq=C:\main.mdb')) or die MyFileException->new("Unable to open file - $DBH"); }; if ($@) { # now $@ contains the exception object of type MyFileException # print "raman"; print $@->getErrorMessage(); # where getErrorMessage() is a method in MyFileException class }
Can't locate object method "getErrorMessage" via package "Can't locate object method "new" via package "MyFileException" (perhaps you forgot to load "MyFileException"?) at C:\Inetpub\wwwroot\amexpmo\login\amex\logprg2.cgi line 27. " (perhaps you forgot to load "Can't locate object method "new" via package "MyFileException" (perhaps you forgot to load "MyFileException"?) at C:\Inetpub\wwwroot\amexpmo\login\amex\logprg2.cgi line 27. "?) at C:\Inetpub\wwwroot\amexpmo\login\amex\logprg2.cgi line 34.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: exception handling
by xorl (Deacon) on Jun 09, 2005 at 12:57 UTC | |
|
Re: exception handling
by aukjan (Friar) on Jun 09, 2005 at 12:38 UTC |