[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Perl Filter BBEdit Tool



I've written a BBEdit tool that works with MacPerl to allow Perl scripts 
to act
as text filters on text selected in a BBEdit window. I've also updated 
the four
BBEdit extensions I previously distributed that facilitate using BBEdit 
(and
BBEdit Lite) as an external editor for MacPerl. The extensions and tool
are freeware.

The BBEdit extensions and BBEdit tool can be downloaded from:

   ftp://members.aol.com//bradh5/macperl_bbedit_extensions.sit

More information is available on my BBEdit extensions web page:

   http://members.aol.com//bradh5/bbedit_extensions.html
   
Brief descriptions of the tool and extensions are given below. More
detailed descriptions are contained on the web page given above.

Perl Filters BBEdit Tool
------------------------

A BBEdit tool presents an interface consisting of a floating window. 
BBEdit tools
only work with BBEdit, not BBEdit Lite. When the tool is started a 
floating
window (named "Perl Filters") is displayed containing a list of text file 
names.
There are two buttons at the top of the Perl Filters window - a "Run" 
button, and
an "Open" button. The text files listed in the tool window are those 
contained in
a folder named "Perl Filters" in the same folder as the BBEdit 
application.
Selecting a file name in the list and clicking on the Open button will 
open the
file in a BBEdit window (double-clicking on a file name will also open the
associated file).

Selecting a file and clicking on the Run button will run the Perl script
contained in the file. The text selected in the active BBEdit window will 
be
written to a temporary file and the full path name of this file will be 
passed to
the script as the first element in the @ARGV array. This allows the line 
input
(angle) operator with a null filehandle (<>) to be used to read through 
the lines
of the selected text. Any output of the script written to STDOUT will 
replace the
selected text in the active BBEdit window.

BBEdit Extensions
-----------------

With one exception, the only change to these extensions from the ones 
previously
released is that the extensions will attempt to launch MacPerl is it is 
not
running (this new feature only works with BBEdit, not BBEdit Lite). The 
exception
is the "Run MacPerl Front" extension. Previous versions of the Run 
MacPerl Front
extension should be replaced with this new version.

The four extensions are:

1. Run MacPerl (version 1.0.3) - This extension sends the text in the 
active
BBEdit window to MacPerl to be executed as a Perl script. If a Perl script
executed by the extension writes output to STDOUT or STDERR then a new 
BBEdit
window is created and the output is put into the new window after the 
script is
finished executing. Version 1.0 of this extension named "Run Perl Script" 
was
distributed on the BBEdit 4 CD.

2. Run MacPerl Front (version 1.0.3) - When this extension is run MacPerl 
is
brought to the front, and the contents of the active BBEdit window are 
sent to
MacPerl to be executed as though run using the Run Script command in 
MacPerl
(e.g., STDOUT is sent to the MacPerl STDOUT window rather than to a new 
BBEdit
window).

3. Run File with MacPerl (version 1.0.2) - This extension presents a 
standard
file dialog to select a file that is sent to MacPerl and executed as a 
Perl
script. This extension functions the same as the Run MacPerl extension 
except
that the script to be run is chosen from a file.

4. Edit MacPerl Script (version 1.0.2) - This extension presents a 
standard file
dialog to select a file to be edited in BBEdit. This extension is useful 
for
editing Perl scripts in file types that cannot be edited normally by 
BBEdit
(runtimes, droplets, etc.). This extension requires MacPerl 5.1.0r2 or 
later,
and BBEdit 4.0 or later. Currently, this extension only works properly
on PowerPC Macintoshes.

Brad Hanson
bhanson@avalon.net