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

Re: [MacPerl-Modules] glue finder and alias references



At 17.07 -0500 1999.08.12, Jefferson R. Lowrey wrote:
>use strict;
>use Mac::Glue ':all';
>
>my $finder = Mac::Glue->new('Finder');
>
>my @files = @ARGV;
>$finder->set($finder->obj(property =>'name', of => $finder->obj(alias =>
>$files[0])), to => "Pudge");
>__END__
>Which would hopefully change the name of the first thing dropped on it to
>"Pudge".  Obviously, this is a test script.
>
>However, it complains -
># Can't find property ''.

There are a few problems.

First, "of" and "in" are only supposed to be used as aliases for
"property", when you are linking to properties together.  You don't need
them here.

Second, you don't embed obj() in another obj().

So that leaves:

  $finder->set(
    $finder->obj(property => name => alias => $files[0]),
    to => 'Pudge'
  );

which works.

However, you can simplify it further by using prop(foo) instead of
obj(property => foo).  They are the same thing.

  $finder->set($finder->prop(name => alias => $files[0]), to => 'Pudge');

Of course, as noted, it is a much better idea to use Perl's rename()
builtin (which works a bit differently; you cannot rename('a:b:c:', 'd')
and expect the result to be 'a:b:d:'.

-- 
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 macperl-modules-request@macperl.org