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

Re: [MacPerl] New User's MacPerl Questions



On 9/16/98 at 11:07 AM, Chris Nandor <pudge@pobox.com> shipped these bits:

>At 10.51 -0400 1998.09.16, Jefferson R. Lowrey wrote:
>>>4) I'd like to be able to 'watch' a folder (like in AS with an idle
>>>timer), is
>>>this a MacPerl question, or should I just buy the next book in that
>>>UNIX-centric
>>>Perl series?
>>
>>It is a MacPerl question.  It should be possible - unfortunatly I'm
>>not the guy to tell you how (Mac guru, Perl newbie).
>

Actually I've been thinking about this lately for a couple of reasons. I run a random sig script and have been looking for a way to have it run every 20 min or so. I've had the same problem with using Cron Chris describes. The context switch when the script runs is a real pain, especially since I also use Virtual and it switches out my desktop every time the script runs. What I'm doing in the meantime is to use Nobumi Iyanaga's (thanks, Nobumi, if you're still on this list) Frontier glue table for MacPerl ( at <http://www.bekkoame.or.jp/~n-iyanag/Frontier/macperlglue.html> )and run the script as a scheduled Frontier task every 20 min. This works fine for now, but I'd still prefer a "pure Perl" solution.

The other reason pertains to the 'watched folder' question. We do this
for an awful lot of things at the paper; most of our servers watch
folders for incoming files and run various processes on them before
moving the processed file somewhere else. Usually we have used Frontier
for this purpose, but we're moving towards doing more of our scripting
using Perl rather than Frontier and so I need a folder-watcher in Perl.
I have been working on a module to encapsulate this, tentiatively named
"File::WatchedFolder." I've looked through CPAN and haven't seen
anything pertaining to this, but if you know of a module that already
does this (the only similar one I can think of is File::Find, but I
intend to allow multiple handlers to process each file whereas
File::Find only takes 1, I believe) please let me know. Also let me
know if you'd be interested in the module when it's ready; it's in a
pretty early stage of development and design (i.e. second hack) but I
could post it on a web page at some point.

>Or, you can use some version of Cron, which you could set to launch
>the script every minute or so, which is bad only because every time it
>launches, MacPerl goes to the front.  I wrote a cron in MacPerl which
>can always sit in the background, as a standalone app so it does not
>tie up the MacPerl app.  Maybe I'll distribute it if people want it. 
>Not very polished, and not working perfectly, but oh well.

I'd be interested in seeing this, Chris.

j

>
>--
>Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
>%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])
>
>***** Want to unsubscribe from this list?
>***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch
>
--
#!/usr/bin/perl
$dot="\x2e";$lt="\x3c";$gt="\x3e";$at="\x40";
print "J Mignault ${lt}mignault${at}nytimes${dot}com${gt}\n";
$yow = qq(Barbie says, Take quaaludes in gin and go to a disco right
	away! But Ken says, WOO-WOO!! No credit at ``Mr. Liquor''!!);



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch