]> git.donarmstrong.com Git - perltidy.git/blobdiff - examples/bbtidy.pl
Imported Upstream version 20120701
[perltidy.git] / examples / bbtidy.pl
diff --git a/examples/bbtidy.pl b/examples/bbtidy.pl
new file mode 100644 (file)
index 0000000..7353a81
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/perl -wn
+
+# This program was posted on the MacPerl mailing list by 
+# Charles Albrecht as one way to get perltidy to work as a filter
+# under BBEdit.
+
+use Perl::Tidy;
+
+BEGIN { my $input_string = ""; my $output_string = ""; }
+
+$input_string .= $_;
+
+END {
+    Perl::Tidy::perltidy(
+        source      => \$input_string,
+        destination => \$output_string
+    );
+
+    print "$output_string\n";
+}
+
+__END__
+