Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uwm.edu!bionet!agate!usenet.ins.cwru.edu!ncoast!allbery From: allbery@NCoast.ORG (Brandon S. Allbery KB8JRR/AA) Newsgroups: comp.lang.perl Subject: Re: Crafty automatic file deletion? Message-ID: <1991Apr5.001508.16154@NCoast.ORG> Date: 5 Apr 91 00:15:08 GMT References: <126507@uunet.UU.NET> <126658@uunet.UU.NET> Reply-To: allbery@ncoast.ORG (Brandon S. Allbery KB8JRR/AA) Followup-To: comp.lang.perl Organization: North Coast Public Access Un*x (ncoast) Lines: 45 As quoted from <126658@uunet.UU.NET> by rbj@uunet.UU.NET (Root Boy Jim): +--------------- | find into the script, it is nontrivial to do. Look at the | complexity of find2perl to see what I mean. Besides, you | have to be smart enuf not to follow symbolic links :-) +--------------- I'll get find.pl out after I clean up a few minor remaining problems (i.e. how to do glob matches on strings, as opposed to file names...). I may even post it without that if I can't figure it out (you'll have to use -name_re instead of -name, though). It's not particularly complex if you ignore the list-of- lists stuff. I can't help it that Jim's on one of those systems where you have to use symlinks in dangerous ways merely in order to survive [ :-) ] but I'll have the default symlink traversal flag configurable (that is, aside from the predicates themselves). +--------------- | There is one thing missing, however; eval looks pretty neat, | but can become complicated in a hurry. I would like the ability | to load code into the script in order to simplify things. Thus: | | find2perl ~ -load maybe_remove.pl -name "*.rm.*.*" \ | -eval '&maybe_remove($file)' +--------------- find.pl has -load. And -eval. And -okeval. +--------------- | I'm not clear on whether the current filename is in | $file, $name, or $_. +--------------- find.pl puts it in $_ for consistency with everything else. Also, user code (from -load with no package, -eval, etc.) is in a separate package from the actual find routines, so there's a lower chance of conflict. (The find package has a slightly odd name, too, to avoid problems.) ++Brandon -- Me: Brandon S. Allbery Ham: KB8JRR/AA on 2m, 220, 440, 1200 Internet: allbery@NCoast.ORG (QRT on HF until local problems fixed) America OnLine: KB8JRR // Delphi: ALLBERY AMPR: kb8jrr.AmPR.ORG [44.70.4.88] uunet!usenet.ins.cwru.edu!ncoast!allbery KB8JRR @ WA8BXN.OH