Perl Best Practices
C.5. TextWrangler
TextWrangler is a free text editor from the makers of BBEdit. Although it has a comparatively restricted set of features, it is still extremely capable and easy to use. You can download a free copy of it from http://www.barebones.com/products/textwrangler/. First, adjust your preferences settings. In the Editor Defaults screen under Preferences:
Adjust your tab stops to four spaces using the option under Text You can create stationery for any boilerplate file templates you wish to load by using TextWrangler to create a file containing the desired code. When the code template is ready, select File To use abbreviations in TextWrangler, you need to write a small Perl script that will generate the text you want by filtering the current selection. First, create the folder ~/Library/Application Support/TextWrangler Support/Unix Support/Unix Filters/. Then, add a file named debug.pl, with the following contents: #! /usr/bin/perl -- print 'use Data::Dumper qw( Dumper );\nwarn Dumper [ ', <>, ' ]';
You can then assign this filter to a particular keystroke using the palette available from the Windows Create as many text filters as you wish. For example, a ~/Library/Application Support/TextWrangler Support/Unix Support/Unix Filters/benchmark.pl file might contain: #! /usr/bin/perl -- use Perl6::Slurp; my $selection = slurp; print <<"END_REPLACEMENT" use Benchmark qw( cmpthese ); cmpthese -10, { $selection }; END_REPLACEMENT
|