| 1 | #!/usr/bin/perl |
| 2 | |
| 3 | use strictscip-perl cpan Regexp-Common 2024080801 strict/; |
| 4 | use libscip-perl cpan Regexp-Common 2024080801 lib/ qw {blib/lib}, "."; |
| 5 | |
| 6 | use Regexp::Commonscip-perl cpan Regexp-Common 2024080801 Regexp/Common/; |
| 7 | use t::Commonscip-perl cpan Regexp-Common 2024080801 t/Common/; |
| 8 | |
| 9 | $^Wscip-perl cpan Regexp-Common 2024080801 main/`$^W`. = 1; |
| 10 | |
| 11 | |
| 12 | sub create_partsscip-perl cpan Regexp-Common 2024080801 main/create_parts().; |
| 13 | |
| 14 | my $news = $REscip-perl cpan Regexp-Common 2024080801 main/`%RE`. {URI} {news}; |
| 15 | |
| 16 | my @tests = ( |
| 17 | [news => $news => {news => NORMAL_PASS | FAIL}], |
| 18 | ); |
| 19 | |
| 20 | my ($good, $bad) = create_parts; |
| 21 | |
| 22 | run_testsscip-perl cpan Regexp-Common 2024080801 main/run_tests(). version => "Regexp::Common::URI::news", |
| 23 | tests => \@tests, |
| 24 | good => $good, |
| 25 | bad => $bad, |
| 26 | query => \&newsscip-perl cpan Regexp-Common 2024080801 main/news()., |
| 27 | wanted => \&wantedscip-perl cpan Regexp-Common 2024080801 main/wanted().; |
| 28 | |
| 29 | sub newsscip-perl cpan Regexp-Common 2024080801 main/news(). { |
| 30 | my ($tag, $grouppart) = ($_scip-perl cpan Regexp-Common 2024080801 main/`@_`. [0], @{$_scip-perl cpan Regexp-Common 2024080801 main/`@_`. [1]}); |
| 31 | |
| 32 | my $news = "news:"; |
| 33 | $news .= $grouppart if definedscip-perl cpan Regexp-Common 2024080801 main/defined(). $grouppart; |
| 34 | |
| 35 | $news; |
| 36 | } |
| 37 | |
| 38 | sub wantedscip-perl cpan Regexp-Common 2024080801 main/wanted(). { |
| 39 | my ($tag, $parts) = @_scip-perl cpan Regexp-Common 2024080801 main/`@_`.; |
| 40 | |
| 41 | my @wanted; |
| 42 | $wanted [0] = $_scip-perl cpan Regexp-Common 2024080801 main/$_.; |
| 43 | $wanted [1] = "news"; |
| 44 | $wanted [2] = $$parts [0]; |
| 45 | |
| 46 | \@wanted; |
| 47 | } |
| 48 | |
| 49 | |
| 50 | sub create_partsscip-perl cpan Regexp-Common 2024080801 main/create_parts(). { |
| 51 | my (@good, @bad); |
| 52 | |
| 53 | my @good_arts = qw {fnord banzai123 4567 000 (!!make-$$$-fast**) |
| 54 | %00%FF%12''' really? ?/?/?/&=:;}; |
| 55 | my @good_hosts = qw /www.abigail.freedom.nl www.PERL.com a.b.c.d.e.f.g.h.i.j.k.x |
| 56 | 127.0.0.1 w--w--w.abigail.freedom.nl w3.abigail.freedom.nl/; |
| 57 | |
| 58 | my @bad_arts = ("", qw /%GG %F %7- %% {} <> ~abigail []/); |
| 59 | my @bad_hosts = ("", qw /www.example..com w+w.example.com |
| 60 | w--.example.com 127.0.1 127.0.0.0.1 |
| 61 | -w.example.com www.example.1com/); |
| 62 | |
| 63 | # Groupparts. |
| 64 | $good [0] = ["*", qw /a comp.lang.perl.misc comp.lang.c++ hello_kitty_ |
| 65 | foo-1234567890/, |
| 66 | mapscip-perl cpan Regexp-Common 2024080801 main/map(). {joinscip-perl cpan Regexp-Common 2024080801 main/join(). '@' => @$_scip-perl cpan Regexp-Common 2024080801 main/$_.} |
| 67 | t::Common::crossscip-perl cpan Regexp-Common 2024080801 t/Common/cross(). (\@good_arts, \@good_hosts)]; |
| 68 | $bad [0] = ["", qw /1234567890 ** really? (!!make-$$$-fast**) |
| 69 | _hello_kitty_/, |
| 70 | (mapscip-perl cpan Regexp-Common 2024080801 main/map(). {joinscip-perl cpan Regexp-Common 2024080801 main/join(). '@' => @$_scip-perl cpan Regexp-Common 2024080801 main/$_.} |
| 71 | t::Common::crossscip-perl cpan Regexp-Common 2024080801 t/Common/cross(). (\@good_arts, \@bad_hosts)), |
| 72 | (mapscip-perl cpan Regexp-Common 2024080801 main/map(). {joinscip-perl cpan Regexp-Common 2024080801 main/join(). '@' => @$_scip-perl cpan Regexp-Common 2024080801 main/$_.} |
| 73 | t::Common::crossscip-perl cpan Regexp-Common 2024080801 t/Common/cross(). (\@bad_arts, \@good_hosts))]; |
| 74 | |
| 75 | return (\@good, \@bad); |
| 76 | } |
| 77 | |
| 78 | |
| 79 | __END__ |