URI::F...:Simple(3pm)
πΈ URI::F...:Simple(3pm) πΈ
okay bestie, welcome to URI::F...:Simple(3pm) β that's the manpage name right there in the corner, we're keeping it short and cute π. This is the User Contributed Perl Documentation for URI::Find::Simple, and it's literally the low-effort, high-reward way to deal with links in text. no cap.
β¨ NAME β¨
URI::Find::Simple β a simple interface to URI::Find π¦
β¨ SYNOPSIS β¨
use URI::Find::Simple qw( list_uris );
my @list = list_uris($text);
my $html = change_uris($text, sub { "<a href=\"$_[0]\">$_[0]</a>" } );
two functions, two vibes, zero callback chaos. periodt π
β¨ DESCRIPTION β¨
so like, URI::Find? iconic, no notes. BUT. sometimes you don't want the whole callback situation, you just want a list of the links sitting in some text, or you want to swap out every url in some text somehow, and you do not want to mess with callback interfaces. it's giving "I just want the uris bestie".
this module uses URI::Find, but it hides the callback interface and hands you two functions instead β one to list all the uris, and one to change all the uris. that's it, that's the whole deal π
π list_uris( text )
returns a list of all the uris in the passed string, in the form output by the URI->as_string function, not the form that they exist in the text. so like, the glow-up version of the string, not the original. π
π change_uris( text, sub { code } )
the passed sub is called for every found uri in the text, and its return value is substituted into the string. returns the changed string. you hand it a little code block, it hands you back a whole new string. slay β¨
π CAVEATS, BUGS, ETC π
real talk time, bestie, because we keep it honest here:
the change_uris function is only just nicer than the callback interface. in some ways it's actually worse. π I's prefer to just pass an s/// operator somehow, but I don't think that's possible.
the list_uris function returns the stringified versions of the URI objects β that seemed to be the sensible thing. and to present a consistent interface, the change_uris function operates on these strings as well, which are not the same as the strings actually present in the original. so heads up π¨
therefore this code:
my $text = change_uris($text, sub { shift } );
may not return the same thing you pass it. URIs such as <URI:http://jerakeen.org> will be converted to the string 'http://jerakeen.org'.
so yeah. it can hand you back something different from what you gave it. that's not a bug, that's just the vibe. π
π SEE ALSO π
URI::Find, URI::Find::Iterator, URI, HTML::LinkExtor, HTML::LinkExtractor.
go read the family, they're all doing their thing π«Ά
π¦ REPOSITORY π¦
<https://github.com/neilb/URI-Find-Simple>
the source lives here, go be nosy, I love that for you π
π AUTHOR π
Tom Insam <tom@jerakeen.org> inspired by Paul Mison <paul@husk.org>
This module is now maintained by Neil Bowers <neilb@cpan.org>.
shoutout to the originals and to the current maintainer keeping the lights on β
π COPYRIGHT AND LICENSE π
Copyright (c) 2004 Tom Insam <tom@jerakeen.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page, bestie!! no cap, you now know URI::F...:Simple(3pm) inside out π¦
this gem was documented asperl v5.32.1, dated2021-03-19, and the manpage title was literallyURI::F...:Simple(3pm)β the ellipsis is doing its own thing, we respect it. π β¨
π¦ where this page comes from
- debian bookworm: liburi-find-simple-perl 1.07-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: liburi-find-simple-perl 1.07-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: liburi-find-simple-perl 1.07-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: liburi-find-simple-perl 1.07-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: liburi-find-simple-perl 1.07-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: liburi-find-simple-perl 1.07-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms