Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hash problem.
by azatoth (Curate) on May 16, 2001 at 15:48 UTC | |
Secondly, always use warnings; or the -w switch, which can help pre-empt problems like the one you are currently experiencing. Azatoth a.k.a Captain Whiplash Make Your Die Messages Full of Wisdom! Get YOUR PerlMonks Stagename here! Want to speak like a Londoner? | [reply] [d/l] |
|
Re: Hash problem.
by DeaconBlues (Monk) on May 16, 2001 at 17:21 UTC | |
It is difficult for me to reproduce your problem because your code is not generalized in any way. I do not have Lotus Notes. However I have run into this error many times. I recently read a wonderful suggestion to safequard against this error. First suggestion is to turn on warnings and diagnostics for testing. This shows you as much information about your error as possible.{leave the strict pragma on!}
So here is an simple example of the error:
You can not deference a reference that is not defined. But you can deference a reference to an empty object. Like this:
And here is the wonderful suggestion I read in the Effective Perl Programming Book p.125 by Hall with merlyn. If you can't intialize your hash reference, have the expression default to an empty anonymous hash reference. Like this:
I apologize if this comment was too general and was not helpful in solving your problem Man I love that book! -DeaconBlues | [reply] [d/l] [select] |
|
Re: Hash problem.
by davorg (Chancellor) on May 16, 2001 at 15:52 UTC | |
When you "preview" a node you get the message: If something looked unlike you expected it to you might need to check out Writeup Formatting Tips Which part of that didn't you understand? --<http://www.dave.org.uk>
"Perl makes the fun jobs fun | [reply] |
|
Re: Hash problem.
by t'mo (Pilgrim) on May 16, 2001 at 19:21 UTC | |
As far as the original error goes ("Can't use an undefined value as a HASH reference at line 49"), it looks like your problem is this: Aside from that, I've just got a few general comments. Give the code below, which is a modified copy of what you originally had:
I had these observations, suggestions, etc. All of them should be taken with a grain of salt, however, given that I've never done any Lotus Notes programming via Perl.
Finally, I'd recommend a closer look at your Notes documentation. I found an example in my Notes docs that "shows how you can use a While loop and GetNextDocument to access every document in a view". You may find that example enlightening. p.s. -- get a PerlMonks account, log in, stick around... you'll like it here. :-) | [reply] [d/l] [select] |
|
Re: Hash problem.
by Anonymous Monk on May 16, 2001 at 15:53 UTC | |
| [reply] [d/l] |
| |