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

Re: [MacPerl] coooool

Chris Nandor writes:
|I had a thought yesterday and wrote to p5p about it, and Tom Christiansen
|replied with an ingenious bit of code that allows you to call object
|methods without specifying the method immeidately before it.
|  #!perl -wl
|  use UnderMethods;  # the cool code
|  use Mac::Glue ':glue';
|  for (my $f = new Mac::Glue 'Finder') {
|    my @files = get(obj(files => glueAll, of => 'Desktop'), as => 'string');
|    print join "\n", @files;
|  }

I did something like this a while ago but decided not to use it. It's just
way too obscure, can only be used in limited circumstances (only one object
at a time), as Chris pointed out you have to watch for conflicts with other
functions, including builtins, if $_ accidentally gets modified things are
going to blow up, and it makes method invocation even slower. All to save
4 characters per method call. While it's an excellent demonstration of
some of the less well lit corners of perl, there's no way I'd use it in
production code.


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