-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Anthony Gardner wrote:
> Can s.o. explain what is wrong with the following code
> ....
>
> $r->pnotes('KEY' => push( @{ $ar }, $some_val ) );
>
> because, when it comes to getting the value from
> pnotes later with .... $r->pnotes(KEY), it returns the
> number of elements in the array and not the array ref.
push returns the number of array's elements. And this gets stored in the
'KEY' of pnotes. Nothing wrong here.
> I've had to write ......
>
> my $ar = $r->pnotes('KEY') || [];
> push( @{ $ar }, $debug_str );
> $r->pnotes( 'KEY' => $ar );
http://perl.apache.org/docs/2.0/api/Apache2/RequestUtil.html#C_pnotes_
$old_val = $r->pnotes($key => $val);
$val = $r->pnotes($key);
$hash_ref = $r->pnotes();
So
push @{ $r->pnotes()->{'KEY'} }
should do what you want.
The abofe doc is for mod_perl2, but as far as I see, the same applies
for mod_perl 1 as well.
dam
- --
Damyan Ivanov 0x9725F63B Creditreform Bulgaria
[EMAIL PROTECTED] http://www.creditreform.bg/
phone: +359(2)928-2611, 929-3993 fax: +359(2)920-0994
mob. +359(88)856-6067 ICQ 3028500 [EMAIL PROTECTED]/Gaim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDKqBlHqjlqpcl9jsRAtFaAJ4zrkS2BCirN8s5jQYWjOGVi4o0SwCgnT/l
rtNpyRgQIYpZdP3T97Bo5u8=
=rvA/
-----END PGP SIGNATURE-----