Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

hattmoward's scratchpad

by meredith (Friar)
on Jun 04, 2004 at 04:52 UTC ( [id://360693]=scratchpad: print w/replies, xml ) Need Help??

  • Read section about using sub main in tye's scratchpad (search page for "stupid")

extra CSS for dark theme. This is in a node somewhere

/* i don't browse full screen to have a small textarea :) */ textarea { width: 100%; height: 300px; } /* Code blocks in a nice white-bordered gray box */ pre tt { display: block; background-color: #404040; border: 1px solid white; width: 90%; padding: 0px 2ex 2ex 2ex; } /* I like a little feedback now and then */ a:hover { color: blue; }

Re: s/\w/random character/g

tosh: Playing nice in mod_perl and CGI:

Figure out my environment:

use constant HAS_MODPERL => eval { require Apache; }; unless ( HAS_MODPERL ) { require CGI; }
Get request/form info in the same fashion for both environments:
use vars qw($request %Args); $request = HAS_MODPERL ? Apache->request : new CGI; %Args = HAS_MODPERL ? $request->args : $request->Vars;
I form all my output and place it in a scalar, $out, then finish up with this:
&output(\$out, $request) and exit;
&output is the following:
sub output { my $out = shift; $out = ref $out ? $$out : $out; my $request = shift; if ( "$request" =~ /Apache/ ) { #test class $request->header_out("Content-Length" => length($out)); $request->content_type('text/html'); $request->send_http_header; } else { print $request->header(-type => 'text/html', -length => length($out) ); } print $out; }

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 about the Monastery: (5)
As of 2024-03-28 13:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found