1use strict; 2package Tie::Hash::NamedCapture; 3 4our $VERSION = "0.13"; 5 6__END__ 7 8=head1 NAME 9 10Tie::Hash::NamedCapture - Named regexp capture buffers 11 12=head1 SYNOPSIS 13 14 tie my %hash, "Tie::Hash::NamedCapture"; 15 # %hash now behaves like %+ 16 17 tie my %hash, "Tie::Hash::NamedCapture", all => 1; 18 # %hash now access buffers from regexp in $qr like %- 19 20=head1 DESCRIPTION 21 22This module is used to implement the special hashes C<%+> and C<%->, but it 23can be used to tie other variables as you choose. 24 25When the C<all> parameter is provided, then the tied hash elements will be 26array refs listing the contents of each capture buffer whose name is the 27same as the associated hash key. If none of these buffers were involved in 28the match, the contents of that array ref will be as many C<undef> values 29as there are capture buffers with that name. In other words, the tied hash 30will behave as C<%->. 31 32When the C<all> parameter is omitted or false, then the tied hash elements 33will be the contents of the leftmost defined buffer with the name of the 34associated hash key. In other words, the tied hash will behave as 35C<%+>. 36 37The keys of C<%->-like hashes correspond to all buffer names found in the 38regular expression; the keys of C<%+>-like hashes list only the names of 39buffers that have captured (and that are thus associated to defined values). 40 41This implementation has been moved into the core executable, but you 42can still load this module for backward compatibility. 43 44=head1 SEE ALSO 45 46L<perlreapi>, L<re>, L<perlmodlib/Pragmatic Modules>, L<perlvar/"%+">, 47L<perlvar/"%-">. 48 49=cut 50