Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re^3: How to send mail from Perl/Tk Program?

by memo.garciasir (Acolyte)
on Feb 26, 2009 at 16:47 UTC ( #746596=note: print w/replies, xml ) Need Help??

in reply to Re^2: How to send mail from Perl/Tk Program?
in thread How to send mail from Perl/Tk Program?

And what if I'm looking for a different approach?

I want a link that do the same as In other words, that call the standard mail program of the user.


  • Comment on Re^3: How to send mail from Perl/Tk Program?

Replies are listed 'Best First'.
Re^4: How to send mail from Perl/Tk Program?
by zentara (Archbishop) on Feb 26, 2009 at 16:58 UTC
    You could put hyperlinks in your Text widgets, that run the mail program, when clicking on the hypertext link. An example, without the actual mailcode....which should be forked off or threaded.
    #!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new( -title => "hyperlinks" ); my $t = $mw->Scrolled('Text')->pack; my $tag = "tag000"; foreach (<DATA>) { chomp; my (@items) = split (/(http:\S+)/,$_); foreach (@items) { if (/(http:\S+)/) { $t->insert( 'end', $_, $tag ); $t->tagConfigure( $tag, -foreground => 'blue' ); $t->tagBind( $tag, '<Any-Enter>' => [ \&manipulate_link, $tag, 'raised', +'hand2' ] ); $t->tagBind( $tag, '<Any-Leave>' => [ \&manipulate_link, $tag, 'flat', 'x +term' ] ); $t->tagBind( $tag, '<Button-1>' => [ \&manipulate_link, $tag, 'sunken' ] +); $t->tagBind( $tag, '<ButtonRelease-1>' => [ \&manipulate_link, $tag, 'raised', undef, \&printm +e ] ); $tag++; } else { $t->insert( 'end', $_ ); } } $t->insert( 'end', "\n" ); } MainLoop; sub printme { local ($,) = " "; print "printme:", @_, "\n"; } sub manipulate_link { # manipulate the link as you press the mouse key my ($a) = shift; my ($tag) = shift; my ($relief) = shift; my ($cursor) = shift; my ($after) = shift; # by configuring the relief (to simulate a button press) $a->tagConfigure( $tag, -relief => $relief, -borderwidth => 1 ); # by changing the cursor between hand and xterm $a->configure( -cursor => $cursor ) if ($cursor); # and by scheduling the specified action to run "soon" if ($after) { my ($s) = $a->get( $a->tagRanges($tag) ); $mw->after( 200, [ $after, $a, $s, $tag, @_ ] ) if ($after); } } __DATA__ Hi there. This is text. THis is more text but in a line. followed by __END__

    I'm not really a human, but I play one on earth My Petition to the Great Cosmic Conciousness

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://746596]
[pryrt]: stevieb: going thru cblast to get caught up, I see that strawberry fixed their download hashes. Fast turnaround on that fix. :-)
[pryrt]: Are you going to tie the berrybrew expected hashes to their releases.json to keep it always up-to-date?

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (10)
As of 2017-03-30 13:17 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (357 votes). Check out past polls.