Steve Simmons wrote:
>
> Summary:
>
> There is no circumstance in which I have had to do `no strict.'
>
I have had a need for symbolic references - unless you want to do 'eval'
which could be worse...
Basically, I am parsing messages, where every message has a distinct
numbe rof logical fields that I want to store into an object. A
fragment of the message-description table:
'AMQ9506' => [ "Channel '($channel_patt)' has ended because",
"Channel" ],
'AMQ9508' => [ "The connection attempt to queue manager '(.*?)'
failed with reason code ($reason_patt)\\.",
"QMgr", "Reason" ],
'AMQ9509' => [ "The attempt to open either the queue or queue manager
object '(.*?)' on queue manager '($qmgr_patt)' failed with reason code
($reason_patt)\\.",
"Object", "QMgr", "Reason" ],
'AMQ9510' => [ "The attempt to get messages from queue
'($qname_patt)' on queue manager '($qmgr_patt)' failed with reason code
($reason_patt)\\.",
"QName", "QMgr", "Reason" ],
Now, I run every message by the description, and then I need to store
$1, $2, $3, etc into the "appropriate" object field. If you want to do
this without hard-coding for $1, $2, $3, $4 etc and without doing an
eval, you need symbolic references - the part of the foreach() loop that
does this contains "no strict 'refs'".
If you want to do this in a B&D fashion, you will end up with
$match_result->ExtractPattern(1) for $1, which is pretty nasty.
Hildo