Pod-Simple
view release on metacpan or search on metacpan
lib/Pod/Simple/HTML.pm view on Meta::CPAN
$url =~ s{::$}{}s; # probably never comes up anyway
$url =~ s{::}{/}g unless $self->perldoc_url_prefix =~ m/\?/s; # sane DWIM?
return undef unless length $url;
return $self->perldoc_url_prefix . $url . $self->perldoc_url_postfix;
}
sub resolve_pod_page_link_batch_mode {
my($self, $to) = @_;
DEBUG > 1 and print STDERR " During batch mode, resolving $to ...\n";
my @path = grep length($_), split m/::/s, $to, -1;
unless( @path ) { # sanity
DEBUG and print STDERR "Very odd! Splitting $to gives (nil)!\n";
return undef;
}
$self->batch_mode_rectify_path(\@path);
my $out = join('/', map $self->pagepath_url_escape($_), @path)
. $HTML_EXTENSION;
DEBUG > 1 and print STDERR " => $out\n";
return $out;
}
lib/Pod/Simple/Search.pm view on Meta::CPAN
# simplify path
$try = File::Spec->canonpath($try);
my $start_in;
my $modname_prefix;
if($self->{'dir_prefix'}) {
$start_in = File::Spec->catdir(
$try,
grep length($_), split '[\\/:]+', $self->{'dir_prefix'}
);
$modname_prefix = [grep length($_), split m{[:/\\]}, $self->{'dir_prefix'}];
$verbose and print "Appending \"$self->{'dir_prefix'}\" to $try, ",
"giving $start_in (= @$modname_prefix)\n";
} else {
$start_in = $try;
}
if( $self->{'_dirs_visited'}{$start_in} ) {
$verbose and print "Directory '$start_in' already seen, skipping.\n";
next;
} else {
t/encod02.t view on Meta::CPAN
use Test::More tests => 2;
#use Pod::Simple::Debug (5);
use Pod::Simple::DumpAsXML;
use Pod::Simple::XMLOutStream;
print "# Pod::Simple version $Pod::Simple::VERSION\n";
{
my @output_lines = split m/[\cm\cj]+/, Pod::Simple::XMLOutStream->_out( q{
=encoding koi8-r
=head1 NAME
ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading"
=cut
} );
t/encod02.t view on Meta::CPAN
ok 1;
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print "# Now a control group, to make sure that =fishbladder DOES\n",
"# cause an 'unknown directive' error...\n";
{
my @output_lines = split m/[\cm\cj]+/, Pod::Simple::XMLOutStream->_out( q{
=fishbladder
=head1 NAME
Fet's "When you were reading"
=cut
} );
t/encod03.t view on Meta::CPAN
use Test::More tests => 2;
#use Pod::Simple::Debug (5);
use Pod::Simple::DumpAsXML;
use Pod::Simple::XMLOutStream;
print "# Pod::Simple version $Pod::Simple::VERSION\n";
{
my @output_lines = split m/[\cm\cj]+/, Pod::Simple::XMLOutStream->_out( q{
=encoding koi8-r
=head1 NAME
Bippitty Boppity Boo -- Yormp
=cut
} );
t/encod03.t view on Meta::CPAN
ok 1;
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print "# Now a control group, to make sure that =fishbladder DOES\n",
"# cause an 'unknown directive' error...\n";
{
my @output_lines = split m/[\cm\cj]+/, Pod::Simple::XMLOutStream->_out( q{
=fishbladder
=head1 NAME
Fet's "When you were reading"
=cut
} );
t/encod04.t view on Meta::CPAN
$x97 = chr utf8::unicode_to_native(0x97);
$x91 = chr utf8::unicode_to_native(0x91);
$dash = '—';
}
else { # Tests will fail for early EBCDICs
$x97 = chr 0x97;
$x91 = chr 0x91;
$dash = '--';
}
my @output_lines = split m/[\r\n]+/, Pod::Simple::XMLOutStream->_out( qq{
=head1 NAME
Em::Dash $x97 ${x91}CAF\xC9\x92
=cut
} );
my($guess) = "@output_lines" =~ m{Non-ASCII.*?Assuming ([\w-]+)};
t/encod04.t view on Meta::CPAN
} else {
fail "parser guessed wrong encoding expected 'CP1252' got '$guess'";
}
} else {
fail "parser failed to detect non-ASCII bytes in input";
}
# Initial smart-quote character triggers CP1252 guess as expected
@output_lines = split m/[\r\n]+/, Pod::Simple::XMLOutStream->_out( qq{
=head1 NAME
Smart::Quote - ${x91}FUT\xC9\x92
=cut
} );
if (ord("A") != 65) { # ASCII-platform dependent test skipped on this platform
t/encod04.t view on Meta::CPAN
fail "parser failed to detect non-ASCII bytes in input";
}
}
# Initial accented character (E acute) followed by 'smart' apostrophe is legal
# CP1252, which should be preferred over UTF-8 because the latter
# interpretation would be "JOS" . \N{LATIN SMALL LETTER TURNED ALPHA} . "S
# PLACE", and that \N{} letter is an IPA one.
@output_lines = split m/[\r\n]+/, Pod::Simple::XMLOutStream->_out( qq{
=head1 NAME
=head2 JOS\xC9\x92S PLACE
=cut
} );
if (ord("A") != 65) { # ASCII-platform dependent test skipped on this platform
t/encod04.t view on Meta::CPAN
} else {
fail "parser failed to detect non-ASCII bytes in input";
}
}
# The previous example used a CP1252 byte sequence that also happened to be a
# valid UTF8 byte sequence. In this example we use an illegal UTF-8 sequence
# (it needs a third byte), so must be 1252
@output_lines = split m/[\r\n]+/, Pod::Simple::XMLOutStream->_out( qq{
=head1 NAME
Smart::Apostrophe::Fail - L\xE9\x92Strange
=cut
} );
if (ord("A") != 65) { # ASCII-platform dependent test skipped on this platform
t/encod04.t view on Meta::CPAN
}
} else {
fail "parser failed to detect non-ASCII bytes in input";
}
}
# The following is a real word example of something in CP1252 expressible in
# UTF-8, but doesn't make sense in UTF-8, contributed by Bo Lindbergh.
# Muvrarášša is a Sami word
@output_lines = split m/[\r\n]+/, Pod::Simple::XMLOutStream->_out( qq{
=head1 NAME
Muvrar\xE1\x9A\x9Aa is a mountain in Norway
=cut
} );
if (ord("A") != 65) { # ASCII-platform dependent test skipped on this platform
( run in 1.422 second using v1.01-cache-2.11-cpan-71847e10f99 )