Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: framechat (mod_perl patch)

by OeufMayo (Curate)
on Jun 12, 2001 at 19:47 UTC ( #87842=note: print w/ replies, xml ) Need Help??


in reply to framechat

Once again epoptai++ for this really nice update.

Here's a patch for the mod_perl users which allows them to run framechat with mod_perl. This is really faster than the regular version because the whole script is only loaded once, and all the script has to do then is to fetch the XML and print it.

It is implemented as a Apache::Registry handler, if I got some time and if there's enough interest, I could maybe come up with a full blown Apache::Framechat for all the CB addicts around.

#!/usr/bin/perl open (CGI, $ARGV[0]) or die "Cannot open $ARGV[0]:$!\n"; open (MOD, "> mod_framechat.pl") or die "Cannot open mod_framechat.pl: +$!\n"; { local $/; $cgi = <CGI>; } # you know epoptai's spacebar sometime stuck... :P $cgi =~ s[my\s*%i\s*=\s*map\s*{\s*\$_\s*=>\s*param\(\$_\)}\s*param;][$ +&;\nsub mod_perl_run {]is; $cgi =~ s[</noframes></html>~;.exit][$&\n}]is; $cgi =~ s[^__END__][=cut]is; print MOD $cgi . "\n'mod_perl is cool.';"; open (MOD2, "> launch_framechat.pl") or die "Cannot open launch_framec +hat.pl:$!\n"; print MOD2 <<'__script__'; #!perl use strict; require "./mod_framechat.pl"; mod_perl_run(); __script__ print STDERR "Done. You can now run launch_framechat.pl!\n";

framechat2 mod-perl

#!/usr/bin/perl open (CGI, $ARGV[0]) or die "Cannot open $ARGV[0]:$!\n"; open (MOD, "> mod_framechat.pl") or die "Cannot open mod_framechat.pl: +$!\n"; { local $/; $cgi = <CGI>; } # you know epoptai's spacebar sometime stuck... :P $cgi =~ s[# mod_perl_patch_begin][# mod_perl_patch_begin\nsub mod_perl +_run {]is; $cgi =~ s[# mod_perl_patch_end][# mod_perl_patch_end\n}]is; print MOD $cgi . "\n1;"; open (MOD2, "> launch_framechat.pl") or die "Cannot open launch_framec +hat.pl:$!\n"; print MOD2 <<'__script__'; #!perl use strict; require "./mod_framechat.pl"; mod_perl_run(); __script__ print STDERR "Done. You can now run launch_framechat.pl!\n";

20010613 - update: Fixed the __END__ token problem, and returns a true value;

20010825 - update: Updated the patch for framechat2

<kbd>--
my $OeufMayo = new PerlMonger::Paris({http => 'paris.mongueurs.net'});</kbd>


Comment on Re: framechat (mod_perl patch)
Select or Download Code
Re: framechat (mod_perl patch)
by hacker (Priest) on Aug 03, 2002 at 14:28 UTC
    I'm not quite sure I understand where this fits in the framechat2 scheme of things. It's an Apache::Registry handler, so I originally thought it belongs in startup.pl, which is called from my PerlRequire line in httpd.conf, but that didn't work, and reading the code, I don't see where you hook into $WEB/framechat/index.pl (or whatever).

    Can you provide a quick installation blurb on this so I can figure out how to get this working under mod_perl?

    What is mod_framechat.pl?

    What is launch_framechat.pl?

    Update: Apparently the patch collides directly with my existing startup.pl, and will need some more investigating to get them to co-exist. My startup.pl looks like this:

    use strict; $ENV{GATEWAY_INTERFACE} =~ /^CGI-Perl/ or die "GATEWAY_INTERFACE not P +erl!"; use Apache::Registry (); use CGI (); CGI->compile(':all'); use CGI::Carp (); use DBI (); use DBD::mysql ();

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://87842]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2014-07-14 08:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (257 votes), past polls