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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.