Re: perl scripting in AppleScript
Re: perl scripting in AppleScript
- Subject: Re: perl scripting in AppleScript
- From: John Fowler <email@hidden>
- Date: Mon, 22 Dec 2003 22:49:17 -0600
On Dec 22, 2003, at 6:02 PM, email@hidden
wrote:
On 22/12/03 05:47, "John Fowler" <email@hidden> wrote:
On Dec 21, 2003, at 9:28 PM, John Fowler wrote:
But if I remove -n from the shell script I am golden again:
This was incorrect. Now my script only works with one-line input.
[...]
If you are still using the `e' flag, that would be the expected
behaviour.
Regards,
Phil.
Thanks for the reply.
I understand that -e expects one line of _program_ and I am happy with
that. I didn't expect that this meant the program could only process
one line of _input_ from a file. I gather from your comment that this
is so however.
That would explain why the -n switch would be invoked in an applescript
do shell script context. But if the -n switch assumes a while loop
around the _program_, then my purpose - which is to build a string
variable containing all lines of a text file - will not be
accomplished. In this context do shell script perl scripting will be
little better for my purpose than using grep, which as far as I know
always operates on one line only.
I don't know whether I could build an applescript shell perl
interaction using sequential do shell scripts each with a -e switch
(the perl manual says sequential -e's can be used but I suspect this
does not apply to the applescript context where I imagine each do shell
script invokes a new -- shell? Just guessing here.
Maybe I could build an explicit while loop around the input statement
to build my variable.
Another strategy with some appeal would be to preposition a perl
program, a filter if I understand the perlese correctly, and invoke it
as needed with a do shell script call.
My ultimate goal is to build my applescript program in a generic
fashion so it could be ported - I even daydream of it becoming
shareware - and I guess a perl script can be in the package. I'm
working on these ideas as I go along.
Right now an explicit while loop around the input statement looks like
the best direction.
JF
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.