Wow,
Thanks for the quick responses--I used parts of both. Still have some
refinements to do, but you saved me quite a bit of frustration.
All the best,
John
> ----------
> From: Ronald J Kimball
> Sent: Tuesday, December 24, 2002 1:40 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [MacPerl] new to perl, even newer to macperl, need Find
> help
>
> On Tue, Dec 24, 2002 at 11:58:56AM -0600, Jeff Lowrey wrote:
> > At 12:38 PM -0500 12/24/02, Nestor, John wrote:
> > >> tell application "MacPerl"
> > >> activate
> > >> with timeout of 6000 seconds
> > >> set PathString to Do Script "
> > >> #!perl -w
> > >>
> > >> use File::Find;
> > >>
> > >> # I should wind up with an array of full paths, right?
> > >> @files=find(\\&wanted, 'Macintosh HD:');
> > >> # I'm playing is safe and returning a string--
> >
> > Then why not create a string in the first place?
> >
> > > > #I know I can pass strings back and forth--hey, I'm a beginner,
> > > remember?
> > >> :)
> > >> $files=join(\",\",@files);
> > >> MacPerl::Reply($files);
> > >>
> > >> sub wanted {
> > >> if ($_ =~ m/Pearson Translator/){
> > > > push (@paths, $File::Find::name);
> > > > }
> > >> return @paths;
> >
> > Are you sure that you're supposed to return an array from the wanted
> > function? Are you sure returning "@paths" will actually return the
> > array, and not something else? Maybe you should return a reference
> > to the array?
>
> The return value of the wanted() function is ignored, so it doesn't matter
> what you return. Whatever you want to do should be done as a side-effect
> of the wanted() function; in this case, pushing the file path onto an
> array.
>
> my @files;
>
> find(\&wanted, 'Macintosh HD');
>
> my $files = join ',', @files;
>
> sub wanted {
> if ($_ =~ /Pearson Translator/) {
> push @files, $File::Find::name;
> }
> }
>
>
> Ronald
>
>
>
>
****************************************************************************
This email may contain confidential material.
If you were not an intended recipient,
please notify the sender and delete all copies.
We may monitor email to and from our network.
****************************************************************************