All pastes #78993 Raw Edit

Mine

public text v1 · immutable
·published 2006-07-04 19:49 UTC
rendered paste body
# Coded by: Justin (aka Dean)

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\:\:#i;
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#;
                print "$text\n\n";
        }
}

# Delete temp file

unlink("rawbash");