More Mac::Glue Syntax Coolness

| | Comments (0)
I love it when you can do something that just makes sense. All I did was make an AUTOLOAD for AEObjDesc objects so that it would use that object as the direct object of the parent glue's method of the same name, and it works so well in ways I hadn't even considered. I think that's a sign that it this is indeed a good idea.

The latest example -- setting the subject of a Eudora mail document -- is that this:

$eudora->set( $e->obj(field => 'Subject:', $mail), to => 'Alert!' );

is now this:

$mail->obj(field => 'Subject:')->set(to => 'Alert');

$mail is the direct object of the obj() method, and the Subject field of $mail (returned by obj()) is the direct object of the set() method.

Another example, moving word 8 of an AppleWorks document to after word 9:

$appleworks->move(
    $appleworks->obj(word => 8 => $text),
    to => location(after => $appleworks->obj(word => 9 => $text))
);

is now this:

$text->obj(word => 8)->move(
    to => location( after => $text->obj(word => 9) )
);

use.perl.org

Leave a comment

<pudge/*> (pronounced "PudgeGlob") is thousands of posts over many years by Pudge.

"It is the common fate of the indolent to see their rights become a prey to the active. The condition upon which God hath given liberty to man is eternal vigilance; which condition if he break, servitude is at once the consequence of his crime and the punishment of his guilt."

About this Entry

This page contains a single entry by pudge published on May 19, 2003 4:50 PM.

Mac::Glue Syntax Revisited was the previous entry in this site.

Time-Epoch-0.01 Released is the next entry in this site.

Find recent content on the main index or look in the archives to find all content.