Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

pudge (1)

pudge
  (email not shown publicly)
http://pudge.net/
AOL IM: Crimethnk (Add Buddy, Send Message)

I run this joint, see?

Journal of pudge (1)

Thursday November 14, 2002
01:59 PM

Interarchy, Mac::Glue, SFTP

[ #8949 ]

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)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.