| 1 | 2 | ▶ | use v5.20; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | |||
| 3 | package Tie::String::Redactable; | ||
| 4 | 2 | ▶ | use experimental qw(signatures); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 2 | ▶ | use parent qw(Tie::Scalar); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 2 | ▶ | use String::Redactable; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 2 | our $VERSION = '1.088'; | |
| 10 | |||
| 11 | 2 | ▶ | sub TIESCALAR ($class, $string) { |
|
Subroutine
TIESCALAR: called CC=1 SCAR=0.0
| |||
| 12 | 2 | ▶ | local $SIG{__WARN__} = sub {}; |
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||
| 13 | 2 | my $self = bless { string => String::Redactable->new($string) }, $class; | |
| 14 | } | ||
| 15 | |||
| 16 | 3 | ▶ | sub FETCH ($self) { |
|
Subroutine
FETCH: called CC=1 SCAR=0.0
| |||
| 17 | 3 | $self->{'string'}->placeholder; | |
| 18 | } | ||
| 19 | |||
| 20 | 0 | ▶ | sub STORE { |
|
Subroutine
STORE: not called CC=1 SCAR=6.9
| |||
| 21 | 0 | return; | |
| 22 | } | ||
| 23 | |||
| 24 | 2 | ▶ | sub to_str_unsafe ($self) { |
|
Subroutine
to_str_unsafe: called CC=1 SCAR=0.0
Pod
documented
| |||
| 25 | 2 | $self->{'string'}->to_str_unsafe; | |
| 26 | } | ||
| 27 | |||
| 28 | =encoding utf8 | ||
| 29 | |||
| 30 | =head1 NAME | ||
| 31 | |||
| 32 | Tie::String::Redactable - work even harder to redact a string | ||
| 33 | |||
| 34 | =head1 SYNOPSIS | ||
| 35 | |||
| 36 | use Tie::String::Redactable; | ||
| 37 | |||
| 38 | my $object = tie my $string, 'Tie::String::Redactable', $secret; | ||
| 39 | |||
| 40 | $object->to_str_unsafe; | ||
| 41 | (tied $string)->to_str_unsafe; | ||
| 42 | |||
| 43 | =head1 DESCRIPTION | ||
| 44 | |||
| 45 | This is a tied version of L<String::Redactable> that refuses to store | ||
| 46 | a new value, and you have to go through the tied object to get to the | ||
| 47 | object that allows you to call the method you need. It's unlikely that | ||
| 48 | you would inadvertently type out any of that. | ||
| 49 | |||
| 50 | =head2 Methods | ||
| 51 | |||
| 52 | =over 4 | ||
| 53 | |||
| 54 | =item * to_str_unsafe | ||
| 55 | |||
| 56 | This dispatches to the underlying L<String::Redactable> object. | ||
| 57 | |||
| 58 | =back | ||
| 59 | |||
| 60 | =head1 TO DO | ||
| 61 | |||
| 62 | =head1 SEE ALSO | ||
| 63 | |||
| 64 | =head1 SOURCE AVAILABILITY | ||
| 65 | |||
| 66 | This source is on GitHub: | ||
| 67 | |||
| 68 | http://github.com/briandfoy/string-redactable | ||
| 69 | |||
| 70 | =head1 AUTHOR | ||
| 71 | |||
| 72 | brian d foy, C<< <briandfoy@pobox.com> >> | ||
| 73 | |||
| 74 | =head1 COPYRIGHT AND LICENSE | ||
| 75 | |||
| 76 | Copyright © 2025-2026, brian d foy, All Rights Reserved. | ||
| 77 | |||
| 78 | You may redistribute this under the terms of the Artistic License 2.0. | ||
| 79 | |||
| 80 | =cut | ||
| 81 | |||
| 82 | 2 | __PACKAGE__; | |