Simple commandline tool to aid reading the posts of this or any group

Discussion in 'Perl Misc' started by skywriter14, Jun 3, 2007.

  1. skywriter14

    skywriter14 Guest

    This is a little commandline tool I wrote to help myself read the
    posts in this group. It fetches the thread urls with the latest posts
    and opens them in firefox. I use this from cygwin command prompt in my
    windows machine. I hope someone else will be interested enough to
    enhance it.

    Why did I create it: I use a feed reader too to read the posts of the
    groups i subscribed from google groups. I click on the the links on
    summary/description of each post in my reader. Then I reach the page
    with only one post, then I click on another link to reach to the
    thread. I find do that fewtimes everyday really painful.

    example useage: perl.beginners

    (comp.lang.perl.misc is the default group)


    use strict;
    use warnings;
    use WWW::Mechanize;

    my $browser_path = '/cygdrive/c/Program\ Files/Mozilla\ Firefox/
    firefox.exe ';
    my $group_name = 'comp.lang.perl.misc'; # default group. it will be
    used if you don't provide one as parameter
    $group_name = $ARGV[0] if @ARGV; # user specified group, from
    commandline parameter
    my $url = ''.$group_name.'/topics?
    my $limit = 10; # limit number of posts to open

    print "Group: [$group_name]\n";
    my $m = WWW::Mechanize->new();
    print "Getting $limit links of threads...\n";
    my $html = $m->content();
    #print $html;

    my @links = ($html =~ m{<td><a href="(/group/$group_name/browse_thread/
    if (@links) {
    @links = map {'' . $_} @links;
    my @links_limited = splice @links, 0, $limit;
    my $url_string = sprintf (qq/"%s"/, join q/" "/, @links_limited);
    #print $url_string."\n";
    print "Opening browser...\n";
    system ($browser_path . $url_string . ' &');
    print "oooops! could not load main page\n";

    exit 0;

    So, anyone interested to enhance it?

    skywriter14, Jun 3, 2007
    1. Advertisements

  2. skywriter14

    skywriter14 Guest


    Sorry for the typos. :-s

    skywriter14, Jun 3, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.