When, as follows, use a script that draws upon Perl::Tidy

Win 2k. (using here doc in the script) The $source gets printed on stdout just fine the block comes out indented.

But, what's between the EOM, I put into c:\pltidytst.pl

And I need howto help for: 1. as I not yet get it to pull from that file. -and- 2. (So as to have the flexibility to run the script on different files) How to specify on the commandline say c:\mytestfile.pl as the file to be operated on by this script -- print output to stdout be just fine. What I already tried be below the code

#!/perl/bin/perl -w
use strict;
use Perl::Tidy;

# some messy source code to format
my $source = <<'EOM';
use strict;
my @editors=('Emacs', 'Vi '); my $rand = rand();
print "A poll of 10 random programmers gave these results:\n";
foreach(0..10) {
my $i=int ($rand+rand());
print " $editors[$i] users are from Venus" . ", " .
"$editors[1-$i] users are from Mars" .
"\n";
}
EOM
# We'll pass it as ref to SCALAR and receive it in a ref to ARRAY
my @dest;
perltidy( source => \$source, destination => \@dest );
foreach (@dest) {print}
#end

I tried assign @ARGV to $source
@ARGV = 'c:\pltidytst.pl';

and I tried reset from line to file mode
undef $/;
$source = <>;

--
Alan.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to