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 ]

autarch (914)

autarch
  (email not shown publicly)
http://www.vegguide.org/

Journal of autarch (914)

Friday April 20, 2007
01:39 PM

Net pipes for Pine

[ #33049 ]

So I'm a freak, and I still use Pine for reading my email. Even weirder, I like to run Pine directly on the server in question, because it's way faster than using Imap. However, this is a little annoying when I want to look at some sort of attachment like a PDF or image, because I need to view it on the machine running my gui.

I wrote this little script to enable this, and it works well:

#!/usr/bin/perl
 
use strict;
use warnings;
 
use File::Temp qw(tempfile);
 
my ( $fh, $filename ) = tempfile();
 
print $fh $_ while <>;
 
seek $fh, 0, 0;
 
my $remote_host = ( split / /, $ENV{SSH_CONNECTION} )[0];
system( 'scp', $filename, $remote_host . ':' . $filename );
system( 'ssh', $remote_host, 'DISPLAY=:0.0 gnome-open ' . $filename );

The fact that gnome-open just does the right thing makes this all very simple.

However, I just now realized that this won't work when I am connecting from a machine behind NAT. I think the trick might be to always connect to the remote machine with a reverse tunnel, and take advantage of that to make things work.

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.