Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Thanks to all perlmonks for there help so far, but I have another problem.

I wrote two modules so that I could swap my code more easily from Apache::Request.pm to CGI.pm or back.

The problem at the moment is that the module returns variables entered into the command line but no variables posted from form data. Included below is the code for the module, the code that calls the module and an example of my form.
# # Apache::Request Buffer Module # package iXML::Buffer::Apache; use strict; use Apache; use Apache::Request; use Apache::Debug; use CGI::Carp qw(fatalsToBrowser); sub new { my $proto = shift; my $class = ref($proto) || $proto; my $self = { 'r' => Apache->request, 'html' => undef, 'redir' => undef, }; bless($self, $class); $self->{apr} = Apache::Request->new( $self->{r}, ); return $self; } sub html { my ($self, $html) = @_; $self->{html} = $html; } sub redir { my ($self, $redir) = @_; $self->{redir} = $redir; } sub output { my $self = shift; if ($self->{redir}) { $self->{apr}->status(302); $self->{apr}->header_out('Location', $self->{redir}); $self->{apr}->send_http_header('text/html'); $self->{apr}->print($self->{html}); }else{ $self->{apr}->send_http_header('text/html'); $self->{apr}->print($self->{html}); } } sub param { my ($self) = shift; return $self->{apr}->param; } sub debug { my ($self) = shift; Apache::Debug::dump($self->{r}, 'SERVER RESPONSE'); } 1;
# # Code that calls the buffer and requests params; # use strict; use iXML::Buffer::Apache; $Buffer = iXML::Buffer::Apache->new(); $Params = $Buffer->param;
# # Sample form code (my script uses HTML::Template # but I filled in the stuff that counts. # <form method="post" action="admin.pl?cmd=save&file=foobar" enctype="mu +ltipart/form-data"> <table width="100%" border="0" cellspacing="1" cellpadding="0" class +="aplBodyC"> <tr> <td colspan="2" class="apeHeadingCTS"><!-- tmpl_var name="headin +g" --></td> </tr> <tr> <td nowrap class="apeListTitlesCTS" valign="top">page name</td> <td nowrap class="apeBodyCTS" width="100%" valign="top"> <input type="text" name="page" class="apeFormObjectCTS" size=" +60" maxlength="60" value="<!-- tmpl_var escape=html name="frm_page" - +->"> </td> </tr> <tr> <td class="apeListTitlesCTS">save</td> <td class="apeBodyCTS" valign="top"><input type="submit" name="S +ubmit" value="save changes" class="apeFormButtonCTS"></td> </tr> </table> </form>

In reply to Returning form data with Apache::Request Buffer Module by IOrdy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (1)
As of 2024-04-25 04:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found