Created
July 14, 2009 23:04
-
-
Save dblevins/147299 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use LWP; | |
my $user = 'test'; | |
my $site = 'http://blogs.apache.org'; | |
open(C, "< .$user") or die "Unable to open handle to .$user: $!\n"; | |
my $pass = <C>; | |
chomp $pass; | |
close C; | |
print "Content-Type: text/html\n\n"; | |
my $browser = LWP::UserAgent->new; | |
$browser->cookie_jar( {} ); | |
$browser->post("$site/roller_j_security_check", [ j_username => $user, j_password => $pass]); | |
# gotta be a way to avoid the $_ usage | |
$_ = $ENV{REQUEST_URI}; | |
my ($blog, $entry) = m,.*/preview.cgi/([^/]+)/.previewEntry=(.+)$,; | |
my $res = $browser->get("$site/roller-ui/authoring/preview/$blog/?previewEntry=$entry"); | |
my $content = $res->content(); | |
# munge the links and url paths | |
$content =~ s,href="/,href="$site/,g; | |
$content =~ s,/roller-ui/authoring/preview/([^ ]+.css),/$1,; | |
print $content; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment