On Mar 27, 2008, at 8:56 AM, Peter Weil wrote:
Thanks to some assistance from this list yesterday, I have a php
Unix filter that runs perfectly when selected from the shebang menu.
But when I run it as the first step in a text factory, the filter
script fails -- the factory just dies midway through the filter
script --and it never gets to the rest of the factory steps
following the filter. No errors, no result window.
The filter script is basically just a bunch of array explodes and
implodes, str_replaces and preg_replaces. And, as I said, it runs
perfectly when called from the shebang menu.
Why should it run differently in a text factory? Do I need to add an
argument for the filter in the text factory?
For historical reasons, Unix filters run from the #! menu have their
data passed to them in a temporary file via arguments. [1]
Filters run through text factories have their data passed to them via
stdin. (This was a better fit for the existing tools that exist on the
system, and since text factories didn't have a installed base, there
wasn't the risk of breaking #! filters people were already using.)
(I believe this is documented in the user manual. If not, I will log a
bug so we can update the documentation.)
If you want to write a script that works transparently in both
environments, your script will have to make a decision about where to
collect the input data from. Perl and Python have abstractions for
this (and you can also do it by hand using a heuristic based on
whether command line arguments are present.)
I don't do enough PHP hacking to offer PHP-specific advice for the
problem.
[1] This is what the original MacPerl tools did. BBEdit used this
calling convention for its first built-in support for Perl, and has
kept it throughout the years to avoid breaking existing filters.
Jim
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <[EMAIL PROTECTED]>