http://www.perlmonks.org?node_id=632901

aels has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I need to test the use of Apache2::SubProcess to execute an external command from a web page.
To create a small test case I use the following:
#!/usr/bin/perl -w use strict; use CGI qw/:standard/; use Apache2::SubProcess (); my $out; my $r = shift; my $command = "/bin/echo 123 > /tmp/test"; print header; print "<p>"; print "test"; print "</p>"; $out = $r->spawn_proc_prog($command); print end_html;
But when I execute this, I get:
Can't call method "spawn_proc_prog" on an undefined value at /srv/www/cgi-bin/pstest.pl line 15

Any ideas what I am doing wrong.
Thank you in advance.