Greg Williams wrote:
> 
> At 14:23 -0700 2000/10/09, Joshua Chamas wrote:
> >$Request->QueryString->('foo')->Item() isn't valid perl syntax,
> >is it?
> 
> >perl -c
> $Request->QueryString->('foo')->Item()
> __END__
> - syntax OK

When I execute $Request->Form->('test')->Item()
on a real life code sample, even after building in 
support for $Request->Form('test')->Item(), I get
this error:

  Not a CODE reference at (eval 14) line 10.

I have seen this error before with this syntax...
is this really supposed to work?  I thought it
was not supposed to be supported by perl.  I saw
that it passed compilation, but perl saves some things
for runtime checking.  It works in VBScript because
that language has the notion of a default method for
an object class to cover these instances.

Note, with my current patch to the system, 
$Request->Form('something') no longer works when 
the config PerlSetVar CollectionItem 1 is set.  The
syntax that gets supported is $Request->Form('something')->Item() 
instead.  I was able to hack it so that
$Request->Form->Item('something') works either way.

When CollectionItem is set, reading Form like above
returns a bless ref to a hash like { Item => 'value' }
so that $Request->Form('something')->Item() could also
be written as $Request->Form('something')->{Item}

The config is used to maintain backwards compatibility
with regular faster $Request->Form('something') usage.  
$Request->{Form}{something} will continue to work 
in either case as well for the fastest access albeit
without any error checking that Form is a valid 
Collection for Request.

--Joshua

Reply via email to