You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Brooklyn Linux Solutions <ru...@mrbrklyn.com> on 2001/06/01 18:25:46 UTC

Auto Derefencing in an Anchor?


Hello

I'm having a strange behavior with embperl which has taken me by suprise.
I that a sql uery which is returning a an array of array reference.

I wanted to use the return value as an argument in an anchor:

I made an error and forgot to dereference it correctly and the result
should
have produced an output like ARRAY(0X8888)

It does this outside of the anchor, but inside the anchor it seems to be
referencing

This is the code on the server side:

$archives = $obj->records('Select distinct logfile from postings') or warn
"$!";
-]
SIZE OF archive [+ scalar(@$archives) +] [+ $$archives[1]+]<P>
[- 
@archive = map{ $$_[0] =~ s/^log10(\d)(\d{2})/$2-200$1/; $_ } @$archives;
-]
Array [+ @archive +] [+ $archive[0][0] +]
<TABLE border=3><TR><TD><A HREF="http://www2.mrbrklyn.com/appl/fairuse/bydate.html?month=[+
$archive[$row] +]">  [+ $archive[$row] +]</A> </TD></TR></TABLE>


This is the output on the Browser:

SIZE OF archive 2 ARRAY(0x83b292c)<P>
Array 2 05-2001
<TABLE border=3><TR><TD><A HREF="http://www2.mrbrklyn.com/appl/fairuse/bydate.html?month=05-2001=">
 ARRAY(0x838fcb8)</A> </TD></TR><TR><TD><A
HREF="http://www2.mrbrklyn.com/appl/fairuse/bydate.html?month=06-2001="> 
ARRAY(0x83b292c)</A> </TD></TR></TABLE>
</TD>
</TR>
</TABLE>


I see no trace of anything in the embperl.log:
[29336]SRC: Line 52: <TR><TD><A HREF="http://www2.mrbrklyn.com/appl/fairuse/bydate.html?month=[+
$archive[$row] +]">  [+ $archive[$row] +]</A> </TD></TR></TABLE>
[29336]CMD:  Cmd = 'tr'
[29336]SRC: Line 52: <TD><A HREF="http://www2.mrbrklyn.com/appl/fairuse/bydate.html?month=[+
$archive[$row] +]">  [+ $archive[$row] +]</A> </TD></TR></TABLE>
[29336]SRC: Line 52: <A HREF="http://www2.mrbrklyn.com/appl/fairuse/bydate.html?month=[+
$archive[$row] +]">  [+ $archive[$row] +]</A> </TD></TR></TABLE>
[29336]CMD:  Cmd = 'a'
[29336]SRC:                                                   [+
$archive[$row] +]
[29336]EVAL<  $archive[$row]
[29336]TAB:  get TabRow = 1, Used = 3
[29336]EVAL> ARRAY(0x83b21a4)
[29336]TAB:  nResult = 1
[29336]SRC: Line 52: [+ $archive[$row] +]</A> </TD></TR></TABLE>
[29336]EVAL<  $archive[$row]
[29336]TAB:  get TabRow = 1, Used = 4
[29336]EVAL> ARRAY(0x83b21a4)
[29336]TAB:  nResult = 1
[29336]SRC: Line 52: </A> </TD></TR></TABLE>
[29336]SRC: Line 52: </TD></TR></TABLE>
[29336]SRC: Line 52: </TR></TABLE>
[29336]CMD:  Cmd = '/tr'
[29336]TAB:  r -> nTabMode=17 nResult=1 nRow=1 Used=4 nCol=0 Used=0 nCnt=1
Used=0
[29336]SRC: Line 52: </TABLE>
[29336]CMD:  Cmd = '/table'
[29336]TAB:  r -> nTabMode=17 nResult=1 nRow=1 Used=4 nCol=1 Used=0 nCnt=2
Used=0
[29336]SRC: Line 52: <TR><TD><A HREF="http://www2.mrbrklyn.com/appl/fairuse/bydate.html?month=[+
$archive[$row] +]">  [+ $archive[$row] +]</A> </TD></TR></TABLE>
[29336]CMD:  Cmd = 'tr'
[29336]SRC: Line 52: <TD><A HREF="http://www2.mrbrklyn.com/appl/fairuse/bydate.html?month=[+
$archive[$row] +]">  [+ $archive[$row] +]</A> </TD></TR></TABLE>
[29336]SRC: Line 52: <A HREF="http://www2.mrbrklyn.com/appl/fairuse/bydate.html?month=[+
$archive[$row] +]">  [+ $archive[$row] +]</A> </TD></TR></TABLE>


So - I give up.

How is this happening?

Ruben

-- 
Brooklyn Linux Solutions
http://www.mrbrklyn.com
http://www.brooklynonline.com

1-718-382-5752


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Auto Derefencing in an Anchor?

Posted by Gerald Richter <ri...@ecos.de>.
> 
> Why did you allow the references to automatically dereference in the
> Anchor?
> 

As show in the example, you can use it to easily pass parameters:

  [-
  $A = { A => 1, B => 2 } ;  # Hashreference
  @A = (X, 9, Y, 8, Z, 7)
  -]


  <A HREF="http://localhost/tests?[+ $A  +]">  
  <A HREF="http://localhost/tests?[+ \@A +]">

is expanded by Embperl to 


  <A HREF="http://localhost/tests?A=1&B=2">
  <A HREF="http://localhost/tests?X=9&Y=8&Z=7">


So in case of of array X, Y and Z get passed to the next page

Gerald



-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Auto Derefencing in an Anchor?

Posted by Brooklyn Linux Solutions <ru...@mrbrklyn.com>.
Thanks Gerald.

Why did you allow the references to automatically dereference in the
Anchor?

Ruben
-- 
Brooklyn Linux Solutions
http://www.mrbrklyn.com
http://www.brooklynonline.com

1-718-382-5752

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Auto Derefencing in an Anchor?

Posted by Gerald Richter <ri...@ecos.de>.
Hello
> 
> I'm having a strange behavior with embperl which has taken me by suprise.
> I that a sql uery which is returning a an array of array reference.
> 
> I wanted to use the return value as an argument in an anchor:
> 
> I made an error and forgot to dereference it correctly and the result
> should
> have produced an output like ARRAY(0X8888)
> 
> It does this outside of the anchor, but inside the anchor it seems to be
> referencing
> 

Yes, this is the intented behaviour and is documented here:

http://perl.apache.org/embperl/Embperl.pod.4.html#a

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------





---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org