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

Re: [MacPerl] a random tip: "the Ur-droplet"



At 19.21 -0700 2000.06.29, Sean M. Burke wrote:
>Once upon a time I did wrote some really handy MacPerl droplets, and left
>them on a filesystem that was, I was told, regularly backed up.  But
>somehow or other, the filesystem crashed months later, and when the files
>were restored, they were missing their resource fork.  Since that's where
>the source code is for droplets, I lost a decent amount of work.
>
>So I decided that from then on, I'd have all droplets that exist consist
>only of this:
>
>if(-e "$0.plx") {
>  do "$0.plx" or die; # propagate any errors.
>} else {
>  die "Can't find $0.plx";
>}
>
>So if I want a droplet that's called "do_stuff_now", I create such a
>droplet consisting of just the above code -- and when the droplet is run,
>it actually just goes and runs what's in a file called "do_stuff_now.plx",
>which is just a normal plaintext file.
>And if the filesystem crashes and the backup loses the resource fork, no
>big deal -- all those .plx files have all their source code in the data
>fork, not the resource fork.  All the droplets would still break, but I
>just replace them with a new droplet with the above code in them.
>(In truth, I don't /make/ a new droplet every time, I just duplicate an
>"Ur-droplet" and put it in whatever directory and with whatever name I
>want.)
>
>More generally and importantly, I can then search over the content of those
>.plx files in BBEdit or wherever, whereas if the same code were in droplets
>(in the resource fork), BBEdit wouldn't be able to see it.

Mmm, nifty.  And @ARGV propogates over and everything.

-- 
Chris Nandor       |     pudge@pobox.com      |     http://pudge.net/
Andover.Net        | chris.nandor@andover.net | http://slashcode.com/

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org