Re: PerlSetVar revisited

2000-05-12 Thread Stas Bekman


Doug MacEachern wrote:

  OK, if this is the case, I'd prefer to have only one variable type -- an
  array - so $r-dir_config will always return a list. So if it's a
  sigular value, it'll be the first element. If you want it to be a hash
  -- you can have it as well. This makes thing simple and even eliminates
  the need for PerlSetVar, you can have only PerlAddVar for everything. 
 
 my @values = $r-dir_config-get('Key');
 and
 my %hash = $r-dir_config-get('Key');
 
 already does that, regardless of using PerlSetVar or PerlAddVar. 
 although, PerlSetVar would end up with odd number of elements for %hash. 

Well, it doesn't work for me. It returns a stringified version of the ref
to a hash or an array. I think you have already mentioned this before, I
thought it was changed since than.

Perl

  my %hash = qw(a b c d);
  push @{ $Location{"/perl"}-{PerlSetVar} }, [ hashkey = \%hash ];

  my @arr = qw(e f g h);
  push @{ $Location{"/perl"}-{PerlSetVar} }, [ arrkey = \@arr ];

/Perl

In the code:

  my @values = $r-dir_config-get('arrkey');
  my %hash   = $r-dir_config-get('hashkey');

returns a stringified:

values: ARRAY(0x82ee120)
hash:   HASH(0x82ee090)

which cannot be dereferenced.

Do I miss something?


__
Stas Bekman | JAm_pH--Just Another mod_perl Hacker
http://stason.org/  | mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]  | http://perl.orghttp://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
--




Re: PerlSetVar revisited

2000-05-12 Thread Stas Bekman

On Fri, 12 May 2000, Doug MacEachern wrote:

 On Fri, 12 May 2000, Stas Bekman wrote:
 
  
  Doug MacEachern wrote:
  
OK, if this is the case, I'd prefer to have only one variable type -- an
array - so $r-dir_config will always return a list. So if it's a
sigular value, it'll be the first element. If you want it to be a hash
-- you can have it as well. This makes thing simple and even eliminates
the need for PerlSetVar, you can have only PerlAddVar for everything. 
   
   my @values = $r-dir_config-get('Key');
   and
   my %hash = $r-dir_config-get('Key');
   
   already does that, regardless of using PerlSetVar or PerlAddVar. 
   although, PerlSetVar would end up with odd number of elements for %hash. 
  
  Well, it doesn't work for me. It returns a stringified version of the ref
  to a hash or an array. I think you have already mentioned this before, I
  thought it was changed since than.
  
  Perl
  
my %hash = qw(a b c d);
push @{ $Location{"/perl"}-{PerlSetVar} }, [ hashkey = \%hash ];
  
my @arr = qw(e f g h);
push @{ $Location{"/perl"}-{PerlSetVar} }, [ arrkey = \@arr ];
  
  /Perl
 
 why do you expect that to work?  PerlSetVar is TAKE2, so those references
 are stringified (watch the output with MOD_PERL_TRACE s).  you can't test
 the multi-value dir_config-get without the PerlAddVar patch i posted
 anyhow, unless you add at request time like the example below.
 
 my $r = shift;
 
 $r-send_http_header;
 
 for (qw(one two)) {
 $r-dir_config-add(Test = $_);
 }
 
 my @vars = $r-dir_config-get('Test');
 
 print "@vars\n";

Oh, the patch... I've missed this detail, sorry.
I understand that it'll enter the soon to be released 1.24, right?

__
Stas Bekman | JAm_pH--Just Another mod_perl Hacker
http://stason.org/  | mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]  | http://perl.orghttp://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
--





Re: PerlSetVar revisited

2000-05-12 Thread Doug MacEachern

 Oh, the patch... I've missed this detail, sorry.
 I understand that it'll enter the soon to be released 1.24, right?

not sure if it'll be in 1.24 yet.