#!/usr/bin/perl -W use strict; use warnings; use diagnostics; use Data::Dumper; my $testtext = <%s','%s'); print "
$txt
"; #--------# sub identifylinks { # # Erkennt und markiert Hyperlinks in einem Text # # Aufruf: # ======= # my $testtext = 'test: http://www.test.de'; # identifylinks (\$testtext,'%s','%s'); # print $testtext; # my $text = $_[0]; my $link = $_[1]; my $email_link = (defined $_[2] ? $_[2] : ''); if (eval "use URI::Find_eigenpatch; 1;") { my $finder = URI::Find->new( sub { return sprintf($link,@_); } ); my $call = sub { return $_[0]; }; if ($email_link ne '' && eval "use Email::Find; 1;" ) { my $finder = Email::Find->new( sub { return sprintf($email_link,$_[0]->format,$_[1]); } ); $call = sub { my $text = shift; $finder->find(\$text); return $text; }; } $finder->find($text,$call); } }