Best way to pass arguments to an Apache2::SubProcess?
am 03.02.2010 02:05:55 von Tosh Cooey
So my will has crumbled, mostly because I'm probably not very good at
the "resident in memory" part of mod_perl and I will be using
Apache2::SubProcess to fire off a sub-process.
There seems to be two easy ways to send data to my detached sub-process;
via an \@args or via $r->subprocess_env->set.
I would like to pass large data structures which I will JSON encode and
I'm wondering which of the above would be best for that, if any, and
what the limitations are of either.
Also, I was wondering, in the docs for Apache2::SubProcess in the
section about properly detaching the sub-process it has in the example:
$r->spawn_proc_prog ('/path/to/detach_script.pl', $args);
Is there a reason $args is used rather than \@args as outlined earlier
in the docs?
opt arg2: \@argv ( ARRAY ref )
Or is it possible to create an $args->[0..10] and pass that?
Thanks!
Tosh
--
McIntosh Cooey - Twelve Hundred Group LLC - http://www.1200group.com/
RE: Best way to pass arguments to an Apache2::SubProcess?
am 03.02.2010 02:11:38 von dihnen
Environment variables have size limits - you should pass it as the args ref=
erence because of that, and the fact that you're sending a pointer rather t=
han the whole data helps too, though the system is probably copying it some=
where in there you shouldn't have to worry about it.
The point they're inferring in the examples is that the second element is a=
list reference - not whether it's a referenced to a named list or not is i=
rrelevant.
David
-----Original Message-----
From: Tosh Cooey [mailto:tosh@1200group.com]=20
Sent: Tuesday, February 02, 2010 5:06 PM
To: modperl@perl.apache.org
Subject: Best way to pass arguments to an Apache2::SubProcess?
So my will has crumbled, mostly because I'm probably not very good at=20
the "resident in memory" part of mod_perl and I will be using=20
Apache2::SubProcess to fire off a sub-process.
There seems to be two easy ways to send data to my detached sub-process;=20
via an \@args or via $r->subprocess_env->set.
I would like to pass large data structures which I will JSON encode and=20
I'm wondering which of the above would be best for that, if any, and=20
what the limitations are of either.
Also, I was wondering, in the docs for Apache2::SubProcess in the=20
section about properly detaching the sub-process it has in the example:
$r->spawn_proc_prog ('/path/to/detach_script.pl', $args);
Is there a reason $args is used rather than \@args as outlined earlier=20
in the docs?
opt arg2: \@argv ( ARRAY ref )
Or is it possible to create an $args->[0..10] and pass that?
Thanks!
Tosh
--=20
McIntosh Cooey - Twelve Hundred Group LLC - http://www.1200group.com/
Re: Best way to pass arguments to an Apache2::SubProcess?
am 03.02.2010 16:36:36 von Tosh Cooey
Probably a stupid question but can't hurt to ask. In the docs they
consistently use @argv = qw(foo bar); Is there a reason for this, can
the args only be strings as semi-implied by somebody mentioning they
used JSON in another thread?
Or can I send $argv[0] = LARGE HASH ?
Thanks!
Tosh
Ihnen, David wrote:
> Environment variables have size limits - you should pass it as the args reference because of that, and the fact that you're sending a pointer rather than the whole data helps too, though the system is probably copying it somewhere in there you shouldn't have to worry about it.
>
> The point they're inferring in the examples is that the second element is a list reference - not whether it's a referenced to a named list or not is irrelevant.
>
> David
>
> -----Original Message-----
> From: Tosh Cooey [mailto:tosh@1200group.com]
> Sent: Tuesday, February 02, 2010 5:06 PM
> To: modperl@perl.apache.org
> Subject: Best way to pass arguments to an Apache2::SubProcess?
>
> So my will has crumbled, mostly because I'm probably not very good at
> the "resident in memory" part of mod_perl and I will be using
> Apache2::SubProcess to fire off a sub-process.
>
> There seems to be two easy ways to send data to my detached sub-process;
> via an \@args or via $r->subprocess_env->set.
>
> I would like to pass large data structures which I will JSON encode and
> I'm wondering which of the above would be best for that, if any, and
> what the limitations are of either.
>
> Also, I was wondering, in the docs for Apache2::SubProcess in the
> section about properly detaching the sub-process it has in the example:
>
> $r->spawn_proc_prog ('/path/to/detach_script.pl', $args);
>
> Is there a reason $args is used rather than \@args as outlined earlier
> in the docs?
>
> opt arg2: \@argv ( ARRAY ref )
>
> Or is it possible to create an $args->[0..10] and pass that?
>
> Thanks!
>
> Tosh
--
McIntosh Cooey - Twelve Hundred Group LLC - http://www.1200group.com/