1URI::Find::Simple(3)  User Contributed Perl Documentation URI::Find::Simple(3)
2
3
4

NAME

6       URI::Find::Simple - a simple interface to URI::Find
7

SYNOPSIS

9         use URI::Find::Simple qw( list_uris );
10         my @list = list_uris($text);
11
12         my $html = change_uris($text, sub { "<a href=\"$_[0]\">$_[0]</a>" } );
13

DESCRIPTION

15       URI::Find is all very well, but sometimes you just want a list of the
16       links in a given piece of text, or you want to change all the urls in
17       some text somehow, and don't want to mess with callback interfaces.
18
19       This module uses URI::Find, but hides the callback interface, providing
20       two functions - one to list all the uris, and one to change all the
21       uris.
22
23   list_uris( text )
24       returns a list of all the uris in the passed string, in the form output
25       by the URI->as_string function, not the form that they exist in the
26       text.
27
28   change_uris( text, sub { code } )
29       the passed sub is called for every found uri in the text, and it's
30       return value is substituted into the string. Returns the changed
31       string.
32

CAVEATS, BUGS, ETC

34       The change_uris function is only just nicer than the callback
35       interface. In some ways it's worse. I's prefer to just pass an s///
36       operator somehow, but I don't think that's possible.
37
38       The list_uris function returns the stringified versions of the URI
39       objects, this seemed to be the sensible thing. To present a consistent
40       interface, the change_uris function operates on these strings as well,
41       which are not the same as the strings actually present in the original.
42       Therefore this code:
43
44         my $text = change_uris($text, sub { shift } );
45
46       may not return the same thing you pass it. URIs such as
47       <URI:http://jerakeen.org> will be converted to the string
48       'http://jerakeen.org'.
49

SEE ALSO

51       URI::Find, URI::Find::Iterator, URI, HTML::LinkExtor,
52       HTML::LinkExtractor.
53

REPOSITORY

55       <https://github.com/neilb/URI-Find-Simple>
56

AUTHOR

58       Tom Insam <tom@jerakeen.org> inspired by Paul Mison <paul@husk.org>
59
60       This module is now maintained by Neil Bowers <neilb@cpan.org>.
61
63       Copyright (c) 2004 Tom Insam <tom@jerakeen.org>.
64
65       This program is free software; you can redistribute it and/or modify it
66       under the same terms as Perl itself.
67
68
69
70perl v5.36.0                      2023-01-20              URI::Find::Simple(3)
Impressum