⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 escapes.pm

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 PM
📖 第 1 页 / 共 2 页
字号:
 'sbquo'    , 8218, 'ldquo'    , 8220, 'rdquo'    , 8221, 'bdquo'    , 8222, 'dagger'   , 8224, 'Dagger'   , 8225, 'permil'   , 8240, 'lsaquo'   , 8249, 'rsaquo'   , 8250, 'euro'     , 8364,);# Fill out %Name2character...{  %Name2character = ();  my($name, $number);  while( ($name, $number) = each %Name2character_number) {    if($] < 5.007  and  $number > 255) {      $Name2character{$name} = $FAR_CHAR;      # substitute for Unicode characters, for perls      #  that can't reliable handle them    } else {      $Name2character{$name} = chr $number;      # normal case    }  }  # So they resolve 'right' even in EBCDIC-land  $Name2character{'lt'  }   = '<';  $Name2character{'gt'  }   = '>';  $Name2character{'quot'}   = '"';  $Name2character{'amp' }   = '&';  $Name2character{'apos'}   = "'";  $Name2character{'sol' }   = '/';  $Name2character{'verbar'} = '|';}#--------------------------------------------------------------------------%Code2USASCII = (# mostly generated by#  perl -e "printf qq{  \x25 3s, '\x25s',\n}, $_, chr($_) foreach (32 .. 126)"   32, ' ',   33, '!',   34, '"',   35, '#',   36, '$',   37, '%',   38, '&',   39, "'", #!   40, '(',   41, ')',   42, '*',   43, '+',   44, ',',   45, '-',   46, '.',   47, '/',   48, '0',   49, '1',   50, '2',   51, '3',   52, '4',   53, '5',   54, '6',   55, '7',   56, '8',   57, '9',   58, ':',   59, ';',   60, '<',   61, '=',   62, '>',   63, '?',   64, '@',   65, 'A',   66, 'B',   67, 'C',   68, 'D',   69, 'E',   70, 'F',   71, 'G',   72, 'H',   73, 'I',   74, 'J',   75, 'K',   76, 'L',   77, 'M',   78, 'N',   79, 'O',   80, 'P',   81, 'Q',   82, 'R',   83, 'S',   84, 'T',   85, 'U',   86, 'V',   87, 'W',   88, 'X',   89, 'Y',   90, 'Z',   91, '[',   92, "\\", #!   93, ']',   94, '^',   95, '_',   96, '`',   97, 'a',   98, 'b',   99, 'c',  100, 'd',  101, 'e',  102, 'f',  103, 'g',  104, 'h',  105, 'i',  106, 'j',  107, 'k',  108, 'l',  109, 'm',  110, 'n',  111, 'o',  112, 'p',  113, 'q',  114, 'r',  115, 's',  116, 't',  117, 'u',  118, 'v',  119, 'w',  120, 'x',  121, 'y',  122, 'z',  123, '{',  124, '|',  125, '}',  126, '~',);#--------------------------------------------------------------------------%Latin1Code_to_fallback = ();@Latin1Code_to_fallback{0xA0 .. 0xFF} = (# Copied from Text/Unidecode/x00.pm:' ', qq{!}, qq{C/}, 'PS', qq{\$?}, qq{Y=}, qq{|}, 'SS', qq{"}, qq{(c)}, 'a', qq{<<}, qq{!}, "", qq{(r)}, qq{-},'deg', qq{+-}, '2', '3', qq{'}, 'u', 'P', qq{*}, qq{,}, '1', 'o', qq{>>}, qq{1/4}, qq{1/2}, qq{3/4}, qq{?},'A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I','D', 'N', 'O', 'O', 'O', 'O', 'O', 'x', 'O', 'U', 'U', 'U', 'U', 'U', 'Th', 'ss','a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i','d', 'n', 'o', 'o', 'o', 'o', 'o', qq{/}, 'o', 'u', 'u', 'u', 'u', 'y', 'th', 'y',);{  # Now stuff %Latin1Char_to_fallback:  %Latin1Char_to_fallback = ();  my($k,$v);  while( ($k,$v) = each %Latin1Code_to_fallback) {    $Latin1Char_to_fallback{chr $k} = $v;    #print chr($k), ' => ', $v, "\n";  }}#--------------------------------------------------------------------------1;__END__=head1 NAMEPod::Escapes -- for resolving Pod EE<lt>...E<gt> sequences=head1 SYNOPSIS  use Pod::Escapes qw(e2char);  ...la la la, parsing POD, la la la...  $text = e2char($e_node->label);  unless(defined $text) {    print "Unknown E sequence \"", $e_node->label, "\"!";  }  ...else print/interpolate $text...=head1 DESCRIPTIONThis module provides things that are useful in decodingPod EE<lt>...E<gt> sequences.  Presumably, it should be usedonly by Pod parsers and/or formatters.By default, Pod::Escapes exports none of its symbols.  Butyou can request any of them to be exported.Either request them individually, as withC<use Pod::Escapes qw(symbolname symbolname2...);>,or you can do C<use Pod::Escapes qw(:ALL);> to get allexportable symbols.=head1 GOODIES=over=item e2char($e_content)Given a name or number that could appear in aC<EE<lt>name_or_numE<gt>> sequence, this returns the string thatit stands for.  For example, C<e2char('sol')>, C<e2char('47')>,C<e2char('0x2F')>, and C<e2char('057')> all return "/",because C<EE<lt>solE<gt>>, C<EE<lt>47E<gt>>, C<EE<lt>0x2fE<gt>>,and C<EE<lt>057E<gt>>, all mean "/".  Ifthe name has no known value (as with a name of "qacute") or issyntactally invalid (as with a name of "1/4"), this returns undef.=item e2charnum($e_content)Given a name or number that could appear in aC<EE<lt>name_or_numE<gt>> sequence, this returns the number ofthe Unicode character that this stands for.  For example,C<e2char('sol')>, C<e2char('47')>,C<e2char('0x2F')>, and C<e2char('057')> all return 47,because C<EE<lt>solE<gt>>, C<EE<lt>47E<gt>>, C<EE<lt>0x2fE<gt>>,and C<EE<lt>057E<gt>>, all mean "/", whose Unicode number is 47.  Ifthe name has no known value (as with a name of "qacute") or issyntactally invalid (as with a name of "1/4"), this returns undef.=item $Name2character{I<name>}Maps from names (as in C<EE<lt>I<name>E<gt>>) like "eacute" or "sol"to the string that each stands for.  Note that this does notinclude numerics (like "64" or "x981c").  Under old Perl versions(before 5.7) you get a "?" in place of characters whose Unicodevalue is over 255.=item $Name2character_number{I<name>}Maps from names (as in C<EE<lt>I<name>E<gt>>) like "eacute" or "sol"to the Unicode value that each stands for.  For example,C<$Name2character_number{'eacute'}> is 201, andC<$Name2character_number{'eacute'}> is 8364.  You get the correctUnicode value, regardless of the version of Perl you're using --which differs from C<%Name2character>'s behavior under pre-5.7 Perls.Note that this hash does notinclude numerics (like "64" or "x981c").=item $Latin1Code_to_fallback{I<integer>}For numbers in the range 160 (0x00A0) to 255 (0x00FF), this mapsfrom the character code for a Latin-1 character (like 233 forlowercase e-acute) to the US-ASCII character that best aproximatesit (like "e").  You may find this useful if you are renderingPOD in a format that you think deals well only with US-ASCIIcharacters.=item $Latin1Char_to_fallback{I<character>}Just as above, but maps from characters (like "\xE9", lowercase e-acute) to characters (like "e").=item $Code2USASCII{I<integer>}This maps from US-ASCII codes (like 32) to the correspondingcharacter (like space, for 32).  Only characters 32 to 126 aredefined.  This is meant for use by C<e2char($x)> when it sensesthat it's running on a non-ASCII platform (where chr(32) doesn'tget you a space -- but $Code2USASCII{32} will).  It'sdocumented here just in case you might find it useful.=back=head1 CAVEATSOn Perl versions before 5.7, Unicode characters with a valueover 255 (like lambda or emdash) can't be conveyed.  Thismodule does work under such early Perl versions, but in theplace of each such character, you get a "?".  Latin-1characters (characters 160-255) are unaffected.Under EBCDIC platforms, C<e2char($n)> may not always be thesame as C<chr(e2charnum($n))>, and ditto forC<$Name2character{$name}> andC<chr($Name2character_number{$name})>.=head1 SEE ALSOL<perlpod|perlpod>L<perlpodspec|perlpodspec>L<Text::Unidecode|Text::Unidecode>=head1 COPYRIGHT AND DISCLAIMERSCopyright (c) 2001-2004 Sean M. Burke.  All rights reserved.This library is free software; you can redistribute it and/or modifyit under the same terms as Perl itself.This program is distributed in the hope that it will be useful, butwithout any warranty; without even the implied warranty ofmerchantability or fitness for a particular purpose.Portions of the data tables in this module are derived from theentity declarations in the W3C XHTML specification.Currently (October 2001), that's these three: http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent=head1 AUTHORSean M. Burke C<sburke@cpan.org>=cut#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# What I used for reading the XHTML .ent files:use strict;my(@norms, @good, @bad);my $dir = 'c:/sgml/docbook/';my %escapes;foreach my $file (qw(  xhtml-symbol.ent  xhtml-lat1.ent  xhtml-special.ent)) {  open(IN, "<$dir$file") or die "can't read-open $dir$file: $!";  print "Reading $file...\n";  while(<IN>) {    if(m/<!ENTITY\s+(\S+)\s+"&#([^;]+);">/) {      my($name, $value) = ($1,$2);      next if $name eq 'quot' or $name eq 'apos' or $name eq 'gt';          $value = hex $1 if $value =~ m/^x([a-fA-F0-9]+)$/s;      print "ILLEGAL VALUE $value" unless $value =~ m/^\d+$/s;      if($value > 255) {        push @good , sprintf "   %-10s , chr(%s),\n", "'$name'", $value;        push @bad  , sprintf "   %-10s , \$bad,\n", "'$name'", $value;      } else {        push @norms, sprintf " %-10s , chr(%s),\n", "'$name'", $value;      }    } elsif(m/<!ENT/) {      print "# Skipping $_";    }    }  close(IN);}print @norms;print "\n ( \$] .= 5.006001 ? (\n";print @good;print " ) : (\n";print @bad;print " )\n);\n";__END__#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -