Interarchy, Mac::Glue, SFTP
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: ... Classic).
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 securityI 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
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);
}
}
Now Playing: Like A Diamond - Tom Petty & The Heartbreakers (The Last DJ)
Leave a comment