You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by "Joel W. Reed" <jr...@support.ddiworld.com> on 2001/10/18 20:11:22 UTC

$Application->Contents("Foo") and CollectionItem config

Joshua,

there appears to be an inconsistency in the Win32 PerlScript
layer that causes problems with Apache::ASP compatibility.

if i store something in global.asa into $Application

use strict; 
use vars qw( $Application $Server); # needed for win32-PerlScript with use strict

sub Application_OnStart { 
	my $csum = "foo";
	$Application->Contents->SetProperty('Item', 'Checksum', $csum)
}

then try to access it in somepage.asp, only these stmts. work

	$Application->Contents('Checksum')
	$Application->Contents->Item('Checksum')

the one syntax which doesn't work is:

  tried:  $Application->Contents('Checksum')->Item()
	(which works for $Request and $Response)

  error:  PerlScript Error error '80004005' 
	  (in cleanup) Can't call method "Item" without a package or object reference 

but this (with PerlSetVar CollectionItem 1) is the one
syntax you really need to work for cross platform 
compatibility. 

for some reason it seems $Application behaves differently
than $Request and $Response. is there anything that can
be done in Apache::ASP to support this inconsistency for
the sake of compatibility?

thanks,
jr

-- 
------------------------------------------------------------------------
Joel W. Reed                                                412-257-3881
--------------All the simple programs have been written.----------------



Re: $Application->Contents("Foo") and CollectionItem config

Posted by "Joel W. Reed" <jr...@support.ddiworld.com>.
On Oct 18, jreed@support.ddiworld.com contorted a few electrons to say...
asp> the one syntax which doesn't work is:
asp> 
asp>   tried:  $Application->Contents('Checksum')->Item()
asp> 	(which works for $Request and $Response)
asp> 
asp>   error:  PerlScript Error error '80004005' 
asp> 	  (in cleanup) Can't call method "Item" without a package or object reference 
asp> 
asp> but this (with PerlSetVar CollectionItem 1) is the one
asp> syntax you really need to work for cross platform 
asp> compatibility. 
asp> 
asp> for some reason it seems $Application behaves differently
asp> than $Request and $Response. is there anything that can
asp> be done in Apache::ASP to support this inconsistency for
asp> the sake of compatibility?

i guess the fix would be something like:

--- /usr/lib/perl5/site_perl/5.6.0/Apache/ASP.pm.orig	Thu Oct 18 14:23:40 2001
+++ /usr/lib/perl5/site_perl/5.6.0/Apache/ASP.pm	Thu Oct 18 14:22:45 2001
@@ -4496,6 +4496,16 @@ sub GetSession {
     }
 }
 
+sub Contents { 
+    my($self, $key) = @_;
+
+    if(defined $key) {
+	$self->Item($key)->Item(); # weird hack for compatibility
+    } else {
+	$self;
+    }
+}
+
 1;
 
 # Session Object


-- 
------------------------------------------------------------------------
Joel W. Reed                                                412-257-3881
--------------All the simple programs have been written.----------------



Re: $Application->Contents("Foo") and CollectionItem config

Posted by "Joel W. Reed" <jr...@support.ddiworld.com>.
On Oct 18, joshua@chamas.com contorted a few electrons to say...
Joshua> Hey Joel, long time, no port!  OK I'm sure I can apply
Joshua> something like the patch you submitted for the
Joshua> 
Joshua>   $Application->Contents('Checksum')->Item()
Joshua> 
Joshua> functionality while under CollectionItem config, but I am 
Joshua> not sure that I can get this to work at the same time
Joshua> 
Joshua>   $Application->Contents('Checksum')
Joshua> 
Joshua> Is this OK?  Do you just need the former, & not the latter.
Joshua> Does the latter even work for you under PerlScript?

all this compatibility stuff makes my head spin. good thing
i'm going on vacation this weekend. anyway

with CollectionItem = 1, which of course i use since we support
nix/windows platforms, i have the following problem

1). the only way to read something out of $Application seems
to be $Application->Contents('Checksum') on windows/perlscript

2). with CollectionItem = 1 on though Application->Contents('Checksum')
just gives the CollectionItem hash on Apache::ASP. PROBLEM!!!

3). so, unfortunately, for compatibility Apache::ASP would
need to return the value (see my patch), not the hash when:

	CollectionItem = 1

		and

	$Application->Contents('Foo') is called

4). $Request and $Response do not exhibit this oddity. i've never
tried $Session so i can't comment on it.

thanks joshua - bug for bug we'll match perlscript!

jr

-- 
------------------------------------------------------------------------
Joel W. Reed                                                412-257-3881
--------------All the simple programs have been written.----------------



Re: $Application->Contents("Foo") and CollectionItem config

Posted by Joshua Chamas <jo...@chamas.com>.
"Joel W. Reed" wrote:
> 
> then try to access it in somepage.asp, only these stmts. work
> 
>         $Application->Contents('Checksum')
>         $Application->Contents->Item('Checksum')
> 
> the one syntax which doesn't work is:
> 
>   tried:  $Application->Contents('Checksum')->Item()
>         (which works for $Request and $Response)
> 
>   error:  PerlScript Error error '80004005'
>           (in cleanup) Can't call method "Item" without a package or object reference
> 
> but this (with PerlSetVar CollectionItem 1) is the one
> syntax you really need to work for cross platform
> compatibility.
> 

Hey Joel, long time, no port!  OK I'm sure I can apply
something like the patch you submitted for the

  $Application->Contents('Checksum')->Item()

functionality while under CollectionItem config, but I am 
not sure that I can get this to work at the same time

  $Application->Contents('Checksum')

Is this OK?  Do you just need the former, & not the latter.
Does the latter even work for you under PerlScript?

Thanks,

Josh

_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks Founder                       Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

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