Kjetil has asked for the wisdom of the Perl Monks concerning the following question:
I'm wondering, can I have the name of a constant, rather than the value, when the constant is a return value from a sub?
To quote specifically what I'm trying to do: I'm checking out some mail addresses with Mail::CheckUser, and I'd like to save the return code to my DB. I can get that by calling last_check()->{code}.
However, the names of the constants are much more instructive than the values (which are just numbers), so it is the name of the constants (e.g. CU_BAD_SYNTAX) that I want to save.
Is there an easy way to do this?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: The name of a constant
by broquaint (Abbot) on Apr 30, 2003 at 17:10 UTC | |
|
Re: The name of a constant
by BrowserUk (Patriarch) on Apr 30, 2003 at 16:56 UTC | |
|
Re: The name of a constant
by benn (Vicar) on Apr 30, 2003 at 16:58 UTC | |
|
Re: The name of a constant
by Mr. Muskrat (Canon) on Apr 30, 2003 at 17:03 UTC | |
|
Re: The name of a constant
by bobdeath (Scribe) on Apr 30, 2003 at 17:05 UTC |