perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hartmaier Alexander" <Alexander.Hartma...@t-systems.at>
Subject strange object oriented problem...
Date Mon, 27 Dec 2004 19:01:47 GMT
Hi list!

 

I started to use object oriented coding in (emb)perl on the 23rd ;-)

I just discovered a strange behaviour...

 

I define an array of object method names...

 

[-

  @colname = ( "name", "fk_device", "snmpid", "snmpid_rtt", "type",
"speed", "mtu", "ipaddr", "ipnetmask", "description");

-]

 

A couple plain html lines later I have

 

[$ foreach $col ( @colname ) $]

      [$ if ($obj_int_nac->$col ne $obj_int_scan->$col) $]

        <tr class="light">

          <td class="dark">[+ $col +]</td>

          <td>[+ $obj_int_nac->$col +]</td>

          <td>[+ $obj_int_scan->$col +]</td>

        </tr>

      [$ endif $]

    [$ endforeach $]

 

This workaround code works:

 

[$ foreach $col ( @colname ) $]

      [-

        $col_name = $col;

        $nac  = $obj_int_nac->$col;

        $scan = $obj_int_scan->$col;

      -]

      [$ if ($nac ne $scan) $]

        <tr class="light">

          <td class="dark">[+ $col_name +]</td>

          <td>[+ $nac +]</td>

          <td>[+ $scan +]</td>

        </tr>

      [$ endif $]

    [$ endforeach $]

 

The variable $col gets overwritten after the '[$ if ($obj_int_nac->$col
ne $obj_int_scan->$col) $]' by a counter starting with '0'.

The result is an error that the method '0' is unknown for the object
'$obj_int_nac'...

 

Any ideas?

 

With kind regards

Alexander Hartmaier

 

T-Systems Austria GesmbH

Rennweg 97-99 1030 Wien

 

phone: +43 57057-4320

fax: +43 57057-95-4320

mobile: +43 676 8642 4320

mail: alexander.hartmaier@t-systems.at

internet: http://www.t-systems.at <http://www.t-systems.at/> 

 

 


*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Hinweis: Dieses E-mail kann vertrauliche und geschützte Informationen enthalten.
Sollten Sie nicht der beabsichtigte Empfänger sein, verständigen Sie bitte den Absender und
löschen Sie dieses E-mail dann sofort.

Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then delete this e-mail
immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*

Mime
View raw message