"Fossies" - the Fresh Open Source Software Archive
Member "install-tl-20200916/tlpkg/tlperl/lib/Tie/Hash/NamedCapture.pm" (8 Mar 2018, 1542 Bytes) of package /windows/misc/install-tl.zip:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard
) with prefixed line numbers and code folding
Alternatively you can here view
the uninterpreted source code file.
1 use strict;
2 package Tie::Hash::NamedCapture;
4 our $VERSION = "0.10";
6 require XSLoader;
7 XSLoader::load(); # This returns true, which makes require happy.
11 =head1 NAME
13 Tie::Hash::NamedCapture - Named regexp capture buffers
15 =head1 SYNOPSIS
17 tie my %hash, "Tie::Hash::NamedCapture";
18 # %hash now behaves like %+
20 tie my %hash, "Tie::Hash::NamedCapture", all => 1;
21 # %hash now access buffers from regexp in $qr like %-
23 =head1 DESCRIPTION
25 This module is used to implement the special hashes C<%+> and C<%->, but it
26 can be used to tie other variables as you choose.
28 When the C<all> parameter is provided, then the tied hash elements will be
29 array refs listing the contents of each capture buffer whose name is the
30 same as the associated hash key. If none of these buffers were involved in
31 the match, the contents of that array ref will be as many C<undef> values
32 as there are capture buffers with that name. In other words, the tied hash
33 will behave as C<%->.
35 When the C<all> parameter is omitted or false, then the tied hash elements
36 will be the contents of the leftmost defined buffer with the name of the
37 associated hash key. In other words, the tied hash will behave as
40 The keys of C<%->-like hashes correspond to all buffer names found in the
41 regular expression; the keys of C<%+>-like hashes list only the names of
42 buffers that have captured (and that are thus associated to defined values).
44 =head1 SEE ALSO
46 L<perlreapi>, L<re>, L<perlmodlib/Pragmatic Modules>, L<perlvar/"%+">,