[kw-pm] seeking a location

Daniel R. Allen daniel at coder.com
Mon Sep 30 16:09:19 CDT 2002


I've sent out a few feelers for meeting locations (RIM, communitech).  

What would be really useful if one of the companies who is a member of
communitech could pass on the word that we're looking for a meeting site-
I understand communitech has a members-only message board.  Otherwise,
I'll just keep trying with Communitech, but I don't know if they'll
respond too quickly.

--

To provide a bit of Perl content to this post-

Someone at the last meeting suggested providing a calendar of local tech
groups meetings.  There are a good number of them- kw.pm, kwLug, kwUug,
kwIug, the computer science club at the U of W, the communitech calendar
(which is usually disjoint from all the above), and probably a few others
I don't know about.  (Record? Imprint?)  I haven't seen a comprehensive
list anywhere; I think the newspapers try, but they don't quite do it.
 
Maybe we could provide a tech-meeting web calendar aggregator as a service
to the community.

Here's a toy script which uses the CS club at the U of W as an
example.  It reads their (well-formed) events page and turns it into
either a text file or RSS file (news feed format).

Do you think publishing an integrated list of upcoming techie meetings
would be useful?

---
#!/usr/bin/perl -w
# Daniel Allen, 30 Sep. 02

use LWP::UserAgent;
use HTML::TokeParser;
use XML::RSS;           ### comment this line and set $txt=1 for text instead
use strict;

my $txt = 0;
my $base_url = "http://www.csclub.uwaterloo.ca";
my $url = "$base_url/events/";

my $ua = new LWP::UserAgent;

$ua->agent("cal-scraper " . $ua->agent);

my $response = $ua->get($url);

warn "failed retrieving page: $!" unless ($response->is_success);
my $content = $response->content;

my $rss;
$rss = create_rss() unless ($txt);

my $p = HTML::TokeParser->new(\$content);

# luckily, CSC has well-formatted events listing.  Each event has the format:
#   <h3><a href="filename">description<a/></h3>
#      where filename contains "/events/location-date-time_PM.html"
#      eg:  <h3><a href="/events/Comfy_lounge-2002-09-16-5:30_PM.html">F02 elections</a></h3>

while (my $token = $p->get_tag("h3")) {
	$token = $p->get_tag("a");
	my $file = $token->[1]{href} || "-";
	my $title = ($p->get_text("/a"));

	unless ($file eq "-") {

		my ($loc, $year, $mon, $day, $time) = split /-/, $file;		
		$time =~ s/.html//;

		print "$year $mon $day $time $title\n" if ($txt);
		add_rss_item($rss, "$year $mon $day $time $title", "$base_url$file") unless ($txt);
		
	}
}

print_rss($rss) unless ($txt);


sub create_rss {
	my $rss = new XML::RSS;
	$rss->channel(
				  title => 'CSC',
				  description => 'U of W Computer Science Club',
				  url   => 'http://www.csclub.uwaterloo.ca/'
				  );
	return $rss;
}	

sub add_rss_item {
	my ($rss, $title, $link) = @_;

	$rss->add_item(
				   title  => $title,
				   'link' => $link
				   );
}

sub print_rss {
	my ($rss) = @_;

	my $outdata = $rss->as_string;
	# $rss->save("dir/$channel.rss");

	print $outdata;
}





More information about the kw-pm mailing list