#!/usr/bin/perl -w

use strict;
use Net::FTP::Etilem_net;
$|=1;

for (qw(tidy perltidy)) {
    die "'$_' is missing, aborting." unless qx(which $_);
}

my @l = @ARGV;
@l =  qw(*pm *pl) unless(@l);
my $l = new Net::FTP::Etilem_net;

$l->ftp_connect;
$l->ftp_changedir("/www/perl");
for (qx(ls @l)) {
    if (/\.p[lm]$/) {
	chomp;
	print "Formatting $_ in HTML : ";
	system("perltidy -css=code.css -st -se -html $_" .
	       "| tidy -q -c -utf8 -asxml > $_.html 2>/dev/null");
	print "OK\n";
    }
    $l->ftp_put($_);
    $l->ftp_put($_ . ".html");
    unlink "$_.html";
}
$l->ftp_quit;

=head1 NAME

B<put_code.pl> [glob]

=head1 DESCRIPTION

Put Perl code on <www.etilem.net>, FTP password is needed ;)

=head1 COPYRIGHT

Copyright 2010 Etienne LEMEE <coding AT etilem DOT net>

This piece of code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

=cut

