All pastes #79008 Raw Edit

Something

public text v1 · immutable
·published 2006-07-04 20:00 UTC
rendered paste body
use strict;
use LWP::Simple;
use HTML::TokeParser;

# Get file

open(DLFILE, ">rawbash") ||
        die "Cannot open temp file: $!";
my $tmp = get("http://bash.org/?random1");
$tmp =~ s#\<br /\>#\:\:break\:\:#gi;
print DLFILE $tmp;
close(DLFILE) || die "Cannot close: $!";

# Parse file

my $p = HTML::TokeParser->new(shift||"rawbash");

while (my $token = $p->get_tag("p")) {
        if ($token->[1]{class} eq "qt") {
                my $text = $p->get_trimmed_text("/p");
                $text =~ s#\:\:break\:\:#\n#g;
                print "$text\n\n";
        }
}

# Delete temp file

unlink("rawbash");