Gracious, benevolent monks:

I've got a file which amalgamates job listings from different categories of a website, and dumps them out. This worked fine at my old isp, and is fine at my new isp when run from the command line, but produces truncated output from a browser(it just stops printing at a point, making it useless), but produces no errors.

The platform was linux, now is freeBSD. I figured its a cgi thing, but I've been through ovid's tutorial, and even understood some of it.

#!/usr/bin/perl -w use strict; use CGI; # get joblinks # Check for recent jobs in 5 categories and return links # check for a few start and end dates # category anchors, to avoid icky month transformations my $query = CGI->new(); my @begindate = split (/ /, scalar localtime); my ($Q,$dow,$mon,$day,$hh_mm_ss,$tz,$yyyy) = @begindate; my $endday = ($day - 6); my $base = 'http://www.craigslist.org'; my @categories = qw/eng sad tch art bus nby\/apa nby\/roo/; print $query->header( "text/html" ), $query->start_html(-title => "CraigsList Distillate", -bgcolor => "#ffffaa" ), $query->h1( "GetJobs.pl" ); print "<a name = top >"; foreach (@categories) { print "<a href = \#$_>$_ </a> &nbsp;"; } for my $i (0 .. $#categories) { open HANDLE_IN, "lynx -source http://www.craigslist.org/sfo/$categ +ories[$i] |" or die "can't open HANDLE_IN $!"; my $grab = 0; while (<HANDLE_IN>) { my $newdate = &newdate($_); next unless(($newdate) && (/bgcolor/)) || ($grab ne 0); print "<a name = $categories[$i]><br><b> $categories[$i] </b> + <BR> <a href = \#top>Top </a>" if $grab == 0; s|href=\/|href=$base\/|ig; $grab++; my $olddate = &olddate($_); print unless $olddate; last if $olddate; } close HANDLE_IN; } print $query->end_html; sub olddate { #is the date more than a few days old? return () unless /\s([\w]{3}\s[\d]+)[\w]{2}/; my ($mon, $dd) = split (/ /, $1); my $test = $dd - $endday; $test <= 0 ? (1) : (); } sub newdate { #is the date less than a few days old? return () unless /([\w]{3}\s[\d]+)/; my ($mon, $qd) = split (/ /, $1); my $test = $qd - $endday; $test >= 0 ? (1) : (); }
Thanks for any insights or comments.
http://wutare.pair.com/~frk/cgi-bin/getjobs.pl
to see it f->up.

http://vader.inow.com/~mrk/cgi-bin/getjobs.pl
to see it work.
mkahn


In reply to not in my browser (truncated output) by mkahn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.