Aldebaran has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
I'm trying to make my posts more-readable and was advised to take a look at Perl::Tidy, which I downloaded from CPAN:
http://search.cpan.org/~shancock/Perl-Tidy-20101217/lib/Perl/Tidy.pm
The treatment there is a bit above my head, so I google for Perl::Tidy examples to learn that it is also a bash command:
http://perltidy.sourceforge.net/perltidy.html
So I get that too, and see that they talk about default behavior, which I test on the following script:
$ perltidy pt1.pl $ cat pt1.pl #!/usr/bin/perl -w use strict; use WWW::Mechanize; use LWP::Simple; use feature ':5.10'; my $domain = 'http://www.yahoo.com'; my $m = WWW::Mechanize->new( qw/ autodie 1 /); $m->get( $domain); my @list = $m->images(); my $counter = 0; my $dir = &DirPP; for my $img (@list) { my $url = $img->url_abs(); $counter++; my $filename = "$dir". "/image_". "$counter"; getstore($url,$filename) or die "Can't download '$url': $@\n"; } sub DirPP { use Errno qw/ EACCES /; # permission denied state $counter2 = 1; my $word = "site"; my $name ; my $made = 0; while(1){ $name = sprintf '%s%3d', $word, $counter2; last if not $made = mkdir $name, 0755 ; die $! if $! == EACCES; } return $name if $made; return; } $
So, so far, I've got nothing. It occurs to me, if I get this feature squared away, then the Virtue of Laziness will be doing my formatting indefinitely.
q1) How do I proceed? Do you have a perltidy install that works for you?
q2) Can someone discuss the difference between Perl::Tidy and perltidy()? Are they related under the hood, for example?
TIA.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: using Perl::Tidy/perltidy()
by toolic (Bishop) on Apr 18, 2012 at 18:37 UTC | |
by Aldebaran (Curate) on Apr 19, 2012 at 19:10 UTC | |
by GrandFather (Saint) on Apr 19, 2012 at 23:13 UTC | |
by Aldebaran (Curate) on Apr 20, 2012 at 19:59 UTC | |
Re: using Perl::Tidy/perltidy()
by GrandFather (Saint) on Apr 18, 2012 at 23:52 UTC |