Interarchy, Mac::Glue, SFTP

| | Comments (0)
One of my favorite examples of Mac::Glue is a program I use to compare my local and remote copies of Slash. My development box is a Linux box under my desk, but I do most of my editing of code on the Mac OS X box, via Interarchy. It opens the selected file in BBEdit for editing, and automatically uploads it when I hit Save.

So my program uses Mac::Glue to tell Interarchy to fetch certain directory listings and files, and opens them in BBEdit; then BBEdit is told to compare that file to the local copy. If they don't match, I look at the differences side-by-side in BBEdit's differences windows.

One problem with this setup is that it makes it hard when I am on the road. But Interarchy now has both SSH/FTP and SFTP. And all I need to do is change the $host parameter to include ";ssh" after it, or add sftp => 1 to the edit() method:

# username/password retrieved from Keychain; sftp for extra security
my $err = $interarchy->edit(path => $r_path, host => $host, sftp => $sftp);
 
if ($err) {
    $interarchy->close($i_window); # clean up
} else {
    my $result = $bbedit->compare($b_window, against => $l_path);
 
    if ($result->{differences_found}) {
        print "Hit Return when done comparing:\n  $lpath";
        $bbedit->activate;
        exit if <> =~ /^q/i;
    } else {
        $bbedit->close($b_window);
    }
}

I just need to get Mac::AppleEvents (a future part of Mac::Carbon) ported to Mac OS X so I can run the script from Mac OS X instead of MacPerl under Classic (though it works fine under Classic, controlling Interarchy and BBEdit under Mac OS X, it is still ... Classic).

Now Playing: Like A Diamond - Tom Petty & The Heartbreakers (The Last DJ)

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 November 14, 2002 10:59 AM.

Making brian d foy's computer speak was the previous entry in this site.

Homeland Alert is the next entry in this site.

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