Do you have a perltidy install that works for you?
Yes, I do.
So, so far, I've got nothing.
When I run perltidy on your code, I get a new file named pt1.pl.tdy, as described by:
$ perldoc perltidy
When I run diff on the 2 files, I see many whitespace differences, as expected:
$ diff pt1.pl pt1.pl.tdy 7,9c7,9 < my $m = WWW::Mechanize->new( qw/ autodie 1 /); < $m->get( $domain); < my @list = $m->images(); --- > my $m = WWW::Mechanize->new(qw/ autodie 1 /); > $m->get($domain); > my @list = $m->images(); 11c11 < my $dir = &DirPP; --- > my $dir = &DirPP; 15,16c15,16 < my $filename = "$dir". "/image_". "$counter"; < getstore($url,$filename) or die "Can't download '$url': $@\n"; --- > my $filename = "$dir" . "/image_" . "$counter"; > getstore( $url, $filename ) or die "Can't download '$url': $@\n" +; 19c19 < sub DirPP { --- > sub DirPP { 21,32c21,29 < 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; --- > 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; 33a31,33 > return $name if $made; > return; > } 35,37c35 < < < $ --- > $
q2) Can someone discuss the difference between Perl::Tidy and perltidy()? Are they related under the hood, for example?
Perl::Tidy is used by perltidy. perltidy is just a wrapper script:
$ perldoc -m perltidy

If you want to edit the file in place, leaving a backup file, use perltidy -b


In reply to Re: using Perl::Tidy/perltidy() by toolic
in thread using Perl::Tidy/perltidy() by Aldebaran

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.