in reply to mod_perl lib problem

Does the modules directory in your Apache2 directory in fact contain mod_perl.so and mod_apreq2.so?

Did you install Bundle::Apache2? If not,
perl -MCPAN -e "install Bundle::Apache2"

Where did you put the code snippet you cite, and how did you invoke it?

Best thing to do would be to get a copy of "mod_perl2 User's Guide" by Stas Bekman and Jim Brandt:
http://www.amazon.com/gp/offer-listing/0977920119/ref=dp_olp_used?ie=UTF8&qid=1253169502&sr=1-1&condition=used

cmac

Replies are listed 'Best First'.
Re^2: mod_perl lib problem
by daveklingler (Initiate) on Sep 17, 2009 at 13:43 UTC
    Hi cmac. Thanks very much for your reply.

    The modules directory does in fact contain mod_perl.so and mod_apreq2.so.

    I had not installed Bundle::Apache2. I did so, but the situation did not change.

    The code snippet was placed in cgi-bin, and invoked as http://localhost/cgi-bin/test.cgi. The full file contents are:

    -------------------------------------------------------- #!/usr/bin/perl use Apache2::Upload; $req = Apache2::Request->new($r); $upload = $req->upload("foo"); $size = $upload->size; # three methods to get at the upload's contents ... slurp, fh, io $upload->slurp($slurp_data); read $upload->fh, $fh_data, $size; ok $slurp_data eq $fh_data; my $io = $upload->io; print while <$io>; --------------------------------------------------------
    voronwae
      After adding the LoadModules to your httpd.conf file, you should have restarted Apache. The output from that will be in your error_log file, before the error messages that you posted originally. What does the signature line (the last output line from the restart) say?

      Upload seems a strange place to start your adventures with mod_perl, but probably that's what you're interested in. Most people would start with a small script that just output an HTML or text page (or using a CGI program that they already have). Then you can branch out into uploading.

      Typically, one adds several more things to httpd.conf in addition to the LoadModule lines. If you're don't want to get the recommended book, try the following page and click on the "Server Configuration" link: http://perl.apache.org/docs/2.0/user/index.html In particular you need to create a directory to hold mod_perl scripts, and move your script into it. Then you need to put a Location block in httpd.conf that sets the new directory up to use mod_perl, as described in the linked page.

      Where on the Apache site did you get the code snippet?

      cmac

      I thought perhaps I'd post this:

      sh-3.2# /usr/local/apache2/bin/httpd -M Loaded Modules: core_module (static) authn_file_module (static) authn_default_module (static) authz_host_module (static) authz_groupfile_module (static) authz_user_module (static) authz_default_module (static) auth_basic_module (static) include_module (static) filter_module (static) log_config_module (static) env_module (static) setenvif_module (static) mpm_prefork_module (static) http_module (static) mime_module (static) status_module (static) autoindex_module (static) asis_module (static) cgi_module (static) negotiation_module (static) dir_module (static) actions_module (static) userdir_module (static) alias_module (static) so_module (static) php5_module (shared) perl_module (shared) apreq_module (shared) Syntax OK