Permalink
Browse files

add new star_trans_html.pl

  • Loading branch information...
1 parent 3718cfc commit ccb81c92e9a2394796931ff1874d6577c4f21476 Achilles Xu committed May 2, 2012
Showing with 35 additions and 1 deletion.
  1. +1 −1 .gitignore
  2. +34 −0 start_trans_html.pl
View
@@ -1,4 +1,4 @@
error.log
.#*
\#*#
-data/origin/search.cpan.org/*.new
+data/origin/*/*.new
View
@@ -0,0 +1,34 @@
+use strict;
+use warnings;
+
+use Smart::Comments "###";
+use File::Copy qw(cp);
+use URI::Escape qw(uri_escape);
+use LWP::Simple qw(getstore is_success);
+
+my $url = shift @ARGV;
+
+die "wrong url, must be something under *.perl.org" unless $url =~ m{^http://([^/\.]+\.perl\.org)(/.*)$};
+
+my $domain = $1;
+my $path = $2;
+
+### $domain
+### $path
+
+my $origin = "data/origin/$domain/". uri_escape($path) . ".old";
+
+### $origin
+
+my $trans = "data/trans/$domain/". uri_escape($path) . ".old";
+
+### $trans
+
+my $rc = getstore($url, $origin);
+if (is_success($rc)) {
+ cp $origin, $trans;
+} else {
+ unlink $origin;
+}
+
+print "done!\n";

0 comments on commit ccb81c9

Please sign in to comment.