perl-asp mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Chamas <j...@chamas.com>
Subject Re: Accessing session data outside of mod_perl env
Date Sun, 18 Jan 2004 02:13:25 GMT
Fred Moyer wrote:
> Greetings,
> 
> I'm attempting to manipulate the $Application object from a cronjob and
> need some guidance.  I have a cron script which generates an object from
> data which I want to embed into the session.  I could write a handler
> that gets called via LWP from the cron and does the required session
> manipulation but I'm wondering if there's a more elegant solution. 
> Here's what I have so far in the cronjob:
> 
> use Apache::ASP;
> use Apache::ASP::Application;
> my $object = My::App->new();
> my $asp = Apache::ASP->new($a_request_object);
> $asp::Application->{'object'} = { object => $object };
> 
> So the question is what can I use for $a_request_object?  I'm using mp2
> so Apache::FakeRequest is out - any ideas?
> 

If you want a fake Apache request object, try Apache::ASP::CGI

To see how its used, you can check out the asp-perl script. Its not
really documented, but the obvious methods are pretty stable, as everything
from asp-perl to the t/*.t script depend on it.

I would recommend doing an lwp-request to a real script though, as then
you get to work with guaranteed APIs.

What I would really recommend is having some extra data file your cron job
writes to that can be initialize in Script_OnStart, and not stored in
$Application at all.  $Application usage for any really big data is probably
pretty slow & performance intensive.

If you are really brave, you can use MLDBM::Sync to access the files
in StateDir directly.  If you use MLDBM::Sync, this will be safe, if you
use MLDBM, it won't be.

Regards,

Josh
________________________________________________________________
Josh Chamas, Founder                   phone:925-552-0128
Chamas Enterprises Inc.                http://www.chamas.com
NodeWorks Link Checker                 http://www.nodeworks.com


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


Mime
View raw message