Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Zedulator - an integrated chat/page-view for Perlmonks

by jZed (Prior)
on Nov 21, 2003 at 23:41 UTC ( [id://309074]=sourcecode: print w/replies, xml ) Need Help??
Category: CB Clients
Author/Contact Info jZed -- Jeff Zucker <>

One of the best features of Perl Monks is that it is easy to link to almost anything. The ability to insert links into Chatterbox conversation gives us the ability to turn entire webpages into parts of speech. But the standard setup makes it so that we can't see the conversation and the thing the conversation is refering to on the same page (well, yes the CB is there, but if you scroll to see the CB, you lose the page and vice-versa, and the CB isn't dynamically refreshed). With a dynamically refreshed, non-scrolling CB, we need to switch back and forth between windows or tabs to see pad://fooBar and the CB discussion of it.

The quick and dirty hack below puts something similar to the FullPage Chat into a frame on the same page as a page-viewing frame and makes the links in the CB go to the page-viewing frame so that both the chat and the page are visible in a single window/tab. I accomplish this with CGI and LWP but it could be accomplished with no programming if the base target for the showchatmessages node was either user definable or was named something other than _new. For example, if the base target was named pm_page_display, then my framed CB can be created with just a local frameset and no need for CGI or LWP.

This could probably also be accomplished with the excellent framechat, but I'm looking for something simpler and this is more of a proof of concept than a full script, the code is lame - I don't parse the HTML, much less XML.

One use of this is generalizable for other Everything installations - you can give a guided tour of a website. You chat with your client in the CB box, presenting links to pages on the site, the client views the link in one frame and chats with you about it in another. Similarly, if a teacher is doing a class, they can put up a diagram or page for discussion and then talk with students about it in the CB without dividing the attention or requiring multiple, possibly confusing windows. It would even be simple for the teacher to create a self-refreshing page, have all the students go there and then as the teacher changed the page, the page would change for all students.

Installation : requires a perl, LWP::Simple, a local webserver. Just drop the code in a CGI directory; chmod it and change the shebang line if needed.

#!perl -Tw
use strict;
use LWP::Simple;
use CGI();
use CGI::Carp qw(fatalsToBrowser);
my $q   = new CGI;
my $cgi = $q->url;
my $pm  = '';
my $op  = $q->param('op') || 'frameset';
my %v;
($v{frameset},$v{talk_button}) = split "\n\n", join '', <DATA>;
my $source = $v{$op};
if ($op eq 'chat' ) {
    my $btag =  qq[ <body text    =" #007F00"
                          bgcolor =" #000000"
                          link    =" #00C600"
                          vlink   =" #00A000"
    $source = &get("$pm/
+") || '';
    $source =~ s/target="_new"/target="pm_page_view"/;
    $source =~ s~\s*</head>~<base href="$pm">\n</head>\n$btag~;
$source =~ s/\$pm/$pm/g;
$source =~ s/\$cgi/$cgi/g;
print $q->header(), $source;

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
  <base href="$pm">
<frameset rows="50%,50%">
  <frame name="pm_page_view" src="/">
  <frameset cols="80%,20%">
    <frameset rows="0,28,*" border="0">
      <frame name="hiddenFrame" src="" />
      <frame src="$cgi?op=talk_button"
             marginwidth="2" marginheight="2" scrolling="no"/>
      <frame src="$cgi?op=chat" />
    <frameset rows="60,*">
      <frame src="/
+messages" />
            <frame src="/"
+ />
      <p>No Frames?  <a href="/
      Chat Here</a></p>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<base href="$pm">
<base target="hiddenFrame">
<script language="javascript">
function do_submit(){
<body bgcolor="black">
<form id="f1" name="f1" method="post" action="/" enctype="appl
<input type="hidden" name="displaytype" value="raw"><input type="hidde
+n" name="node_id" value="3193"><input type="hidden" name="op" value="
<input type="text" name="message"  size=40 maxlength=240 onMouseDown="
+javascript:document.f1.message.value=''" /> <input type="button" valu
+e="talk" onClick="do_submit()"></form>

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: sourcecode [id://309074]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-07-14 01:48 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.