URI-Find-Simple-1.07/000755 000765 000024 00000000000 14023517630 014442 5ustar00neilbstaff000000 000000 URI-Find-Simple-1.07/Changes000644 000765 000024 00000002241 14023517604 015735 0ustar00neilbstaff000000 000000 Revision history for Perl module URI::Find::Simple 1.07 2021-03-14 NEILB - Changed github repo URL to reflect my change in username - Changed to github issues for bugtracker 1.06 2014-08-04 NEILB - URI-Find-20140709 stopped translating URIs to canonical form, which broke our testsuite. Thanks to Petr Pisar for RT#97738 1.05 2014-02-05 NEILB - Added SEE ALSO links to HTML::LinkExtractor and HTML::LinkExtor. - Hadn't added README to MANIFEST, so it wasn't in the dist. Sigh. 1.04 2014-02-02 NEILB - NEILB has taken over maintenance - Added github repo to metadata and pod - Added license details to metadata and added LICENSE section to doc - Reformatted Changes as per CPAN::Changes::Spec - Specified min perl version as 5.6.0 - Added missing PREREQ's, and moved Test::More to TEST_REQUIRES - Added README 1.03 2010-10-25 TOMI - Package properly 1.01 2010-09-06 TOMI - Fix tests for URI::Find change - Count tests properly 1.01 2008-09-15 TOMI - Clearer license - Better method of requiring perl 5.8.1 1.0 2008-06-19 TOMI - Unicode support improved. 0.7 2004-03-16 TOMI - Initial release URI-Find-Simple-1.07/MANIFEST000644 000765 000024 00000000354 14023517630 015575 0ustar00neilbstaff000000 000000 lib/URI/Find/Simple.pm MANIFEST t/find.t Makefile.PL Changes README META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) URI-Find-Simple-1.07/t/000755 000765 000024 00000000000 14023517630 014705 5ustar00neilbstaff000000 000000 URI-Find-Simple-1.07/README000644 000765 000024 00000001106 12273526374 015332 0ustar00neilbstaff000000 000000 README for Perl module URI::Find::Simple This module provides a simple interface to URI::Find, for situations where you don't need/want to bother with callbacks. You can read a nicely formatted version of the documentation for this module online: https://metacpan.org/pod/URI::Find::Simple You should be able to install this using your usual method for installing modules from CPAN. If you don't have one let, have a look at: http://www.cpan.org/modules/INSTALL.html This module was written by Tom Insam. It is now being maintained by Neil Bowers URI-Find-Simple-1.07/META.yml000644 000765 000024 00000001233 14023517630 015712 0ustar00neilbstaff000000 000000 --- abstract: unknown author: - unknown build_requires: ExtUtils::MakeMaker: '0' Test::More: '0.88' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: URI-Find-Simple no_index: directory: - t - inc requires: Carp: '0' Encode: '0' URI::Find: '0' perl: '5.006' strict: '0' warnings: '0' resources: repository: git://github.com/neilb/URI-Find-Simple.git version: 1.07 x_serialization_backend: 'CPAN::Meta::YAML version 0.018' URI-Find-Simple-1.07/lib/000755 000765 000024 00000000000 14023517630 015210 5ustar00neilbstaff000000 000000 URI-Find-Simple-1.07/Makefile.PL000644 000765 000024 00000002252 14023517556 016424 0ustar00neilbstaff000000 000000 use ExtUtils::MakeMaker; require 5.006; my $mm_ver = $ExtUtils::MakeMaker::VERSION; if ($mm_ver =~ /_/) { # dev version $mm_ver = eval $mm_ver; die $@ if $@; } WriteMakefile( 'NAME' => 'URI::Find::Simple', 'VERSION_FROM' => 'lib/URI/Find/Simple.pm', 'PREREQ_PM' => { 'URI::Find' => 0, 'Carp' => 0, 'Encode' => 0, 'strict' => 0, 'warnings' => 0, }, ($mm_ver <= 6.45 ? () : (META_MERGE => { 'meta-spec' => { version => 2 }, resources => { bugtracker => 'https://github.com/neilb/URI-Find-Simple/issues', repository => { type => 'git', web => 'https://github.com/neilb/URI-Find-Simple', url => 'git://github.com/neilb/URI-Find-Simple.git', }, }, }) ), ($mm_ver >= 6.31 ? (LICENSE => 'perl') : () ), ($mm_ver >= 6.48 ? (MIN_PERL_VERSION => 5.006) : () ), ($mm_ver >= 6.64 ? (TEST_REQUIRES => { 'Test::More' => 0.88, }) : () ), ); URI-Find-Simple-1.07/META.json000644 000765 000024 00000002460 14023517630 016065 0ustar00neilbstaff000000 000000 { "abstract" : "unknown", "author" : [ "unknown" ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "URI-Find-Simple", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "Carp" : "0", "Encode" : "0", "URI::Find" : "0", "perl" : "5.006", "strict" : "0", "warnings" : "0" } }, "test" : { "requires" : { "Test::More" : "0.88" } } }, "release_status" : "stable", "resources" : { "repository" : { "type" : "git", "url" : "git://github.com/neilb/URI-Find-Simple.git", "web" : "https://github.com/neilb/URI-Find-Simple" } }, "version" : 1.07, "x_serialization_backend" : "JSON::PP version 2.97001" } URI-Find-Simple-1.07/lib/URI/000755 000765 000024 00000000000 14023517630 015647 5ustar00neilbstaff000000 000000 URI-Find-Simple-1.07/lib/URI/Find/000755 000765 000024 00000000000 14023517630 016527 5ustar00neilbstaff000000 000000 URI-Find-Simple-1.07/lib/URI/Find/Simple.pm000644 000765 000024 00000006237 14023457146 020333 0ustar00neilbstaff000000 000000 package URI::Find::Simple; use warnings; use strict; use 5.006; use URI::Find; use Carp qw(croak); use Encode qw( encode ); our @ISA = qw( Exporter ); our @EXPORT_OK = qw( list_uris change_uris ); our $VERSION = 1.07; our $CHARSET = "utf-8"; sub list_uris { my $text = shift; croak "expected a text string" unless defined($text); my @list; my $uri_find = URI::Find->new( sub { my ($object, $text) = @_; push @list, $object->as_string; return $text; } ); if ($CHARSET) { my $copy = encode($CHARSET, $text); $copy =~ s/([^\000-\177])/'%' . sprintf("%x", ord($1))/eg; $text = $copy; } $uri_find->find(\$text); return @list; } sub change_uris { my $text = shift; my $sub = shift; croak "expected a text string" unless defined($text); croak "expected a code ref" unless ref($sub) eq 'CODE'; my $uri_find = URI::Find->new( sub { my ($object, $text) = @_; return $sub->($object->as_string); } ); $uri_find->find(\$text); return $text; } 1; __END__ =head1 NAME URI::Find::Simple - a simple interface to URI::Find =head1 SYNOPSIS use URI::Find::Simple qw( list_uris ); my @list = list_uris($text); my $html = change_uris($text, sub { "$_[0]" } ); =head1 DESCRIPTION L is all very well, but sometimes you just want a list of the links in a given piece of text, or you want to change all the urls in some text somehow, and don't want to mess with callback interfaces. This module uses URI::Find, but hides the callback interface, providing two functions - one to list all the uris, and one to change all the uris. =head2 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. =head2 change_uris( text, sub { code } ) the passed sub is called for every found uri in the text, and it's return value is substituted into the string. Returns the changed string. =head1 CAVEATS, BUGS, ETC The change_uris function is only just nicer than the callback interface. In some ways it's 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, this seemed to be the sensible thing. 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. Therefore this code: my $text = change_uris($text, sub { shift } ); may not return the same thing you pass it. URIs such as will be converted to the string 'http://jerakeen.org'. =head1 SEE ALSO L, L, L, L, L. =head1 REPOSITORY L =head1 AUTHOR Tom Insam Etom@jerakeen.orgE inspired by Paul Mison Epaul@husk.orgE This module is now maintained by Neil Bowers Eneilb@cpan.orgE. =head1 COPYRIGHT AND LICENSE Copyright (c) 2004 Tom Insam Etom@jerakeen.orgE. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. URI-Find-Simple-1.07/t/find.t000644 000765 000024 00000003351 12367676006 016030 0ustar00neilbstaff000000 000000 use strict; use warnings; use lib qw(lib); use Test::More tests => 16; use_ok('URI::Find::Simple'); eval { URI::Find::Simple::list_uris() }; ok($@ =~ /expected a text string/, "can't call list_uris without text"); eval { URI::Find::Simple::change_uris() }; ok($@ =~ /expected a text string/, "can't call change_uris without text"); eval { URI::Find::Simple::change_uris('bob') }; ok($@ =~ /expected a code ref/, "can't call change_uris without subref"); ok(my $text = <