#! /usr/bin/perl
use strict;
use warnings;
use URI::Find::Schemeless;
use HTML::Entities qw(encode_entities); # changed
my $text = q~
hello this is no.url
this is an url: www.fabiani.net
ftp.anything.de/test/thisfile mailto:martin@fabiani.net or the like
yeah martin@fabiani.net http://www.fabiani.net/
~;
# create a new URI::Find::Schemeless objekt and add as callback
# the function what shell be done with each found URI
my $finder = URI::Find::Schemeless->new
(
sub {
my ($uri, $originalUri) = @_;
# error: encode_entities is missing
# return qq~$originalUri~;
return
q// .
encode_entities($originalUri) . q/>/;
}
);
# here starts the search (and in our case the replacement):
my $howManyFound = $finder->find(\$text);
# lets have a look at the result
print "$howManyFound URIs found\n";
print "$text\n";