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

📄 namedcapture.pm

📁 source of perl for linux application,
💻 PM
字号:
package Tie::Hash::NamedCapture;our $VERSION = "0.06";# The real meat implemented in XS in universal.c in the core, but this# method was left behind because gv.c expects a Purl-Perl method in# this package when it loads the tie magic for %+ and %-my ($one, $all) = Tie::Hash::NamedCapture::flags();sub TIEHASH {    my ($pkg, %arg) = @_;    my $flag = $arg{all} ? $all : $one;    bless \$flag => $pkg;}tie %+, __PACKAGE__;tie %-, __PACKAGE__, all => 1;1;__END__=head1 NAMETie::Hash::NamedCapture - Named regexp capture buffers=head1 SYNOPSIS    tie my %hash, "Tie::Hash::NamedCapture";    # %hash now behaves like %+    tie my %hash, "Tie::Hash::NamedCapture", all => 1;    # %hash now access buffers from regexp in $qr like %-=head1 DESCRIPTIONThis module is used to implement the special hashes C<%+> and C<%->, but itcan be used to tie other variables as you choose.When the C<all> parameter is provided, then the tied hash elements will bearray refs listing the contents of each capture buffer whose name is thesame as the associated hash key. If none of these buffers were involved inthe match, the contents of that array ref will be as many C<undef> valuesas there are capture buffers with that name. In other words, the tied hashwill behave as C<%->.When the C<all> parameter is omitted or false, then the tied hash elementswill be the contents of the leftmost defined buffer with the name of theassociated hash key. In other words, the tied hash will behave asC<%+>.The keys of C<%->-like hashes correspond to all buffer names found in theregular expression; the keys of C<%+>-like hashes list only the names ofbuffers that have captured (and that are thus associated to defined values).=head1 SEE ALSOL<perlreapi>, L<re>, L<perlmodlib/Pragmatic Modules>, L<perlvar/"%+">,L<perlvar/"%-">.=cut

⌨️ 快捷键说明

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