File Coverage

blib/lib/PPIx/Regexp/Structure/Unknown.pm
Criterion Covered Total %
statement 15 23 65.2
branch 0 4 0.0
condition 0 3 0.0
subroutine 5 8 62.5
pod 2 2 100.0
total 22 40 55.0


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             PPIx::Regexp::Structure::Unknown - Represent an unknown structure.
4              
5             =head1 SYNOPSIS
6              
7             use PPIx::Regexp::Dumper;
8             PPIx::Regexp::Dumper->new( 'qr{(?(foo)bar|baz|burfle)}smx' )
9             ->print();
10              
11             =head1 INHERITANCE
12              
13             C<PPIx::Regexp::Structure::Unknown> is a
14             L<PPIx::Regexp::Structure|PPIx::Regexp::Structure>.
15              
16             C<PPIx::Regexp::Structure::Unknown> has no descendants.
17              
18             =head1 DESCRIPTION
19              
20             This class is used for a structure which the lexer recognizes as being
21             improperly constructed.
22              
23             =head1 METHODS
24              
25             This class provides no public methods beyond those provided by its
26             superclass.
27              
28             =cut
29              
30             package PPIx::Regexp::Structure::Unknown;
31              
32 9     9   44 use strict;
  9         14  
  9         307  
33 9     9   32 use warnings;
  9         12  
  9         448  
34              
35 9     9   35 use base qw{ PPIx::Regexp::Structure };
  9         23  
  9         811  
36              
37 9     9   44 use PPIx::Regexp::Constant qw{ @CARP_NOT };
  9         23  
  9         862  
38 9     9   44 use PPIx::Regexp::Util;
  9         21  
  9         1920  
39              
40             our $VERSION = '0.091';
41              
42             sub __new {
43 0     0     my ( $class, $content, %arg ) = @_;
44              
45 0           my $self = $class->SUPER::__new( $content, %arg );
46              
47             defined $arg{error}
48 0 0         and $self->{explanation} = $self->{error} = $arg{error};
49              
50             defined $arg{explanation}
51 0 0         and $self->{explanation} = $arg{explanation};
52              
53 0           return $self;
54             }
55              
56             sub width {
57 0     0 1   return ( undef, undef );
58             }
59              
60             sub explain {
61 0     0 1   my ( $self ) = @_;
62 0   0       return $self->{explanation} || $self->SUPER::explain();
63             }
64              
65             *__PPIX_ELEM__post_reblessing = \&PPIx::Regexp::Util::__post_rebless_error;
66              
67             1;
68              
69             __END__
70              
71             =head1 SUPPORT
72              
73             Support is by the author. Please file bug reports at
74             L<https://rt.cpan.org/Public/Dist/Display.html?Name=PPIx-Regexp>,
75             L<https://github.com/trwyant/perl-PPIx-Regexp/issues>, or in
76             electronic mail to the author.
77              
78             =head1 AUTHOR
79              
80             Thomas R. Wyant, III F<wyant at cpan dot org>
81              
82             =head1 COPYRIGHT AND LICENSE
83              
84             Copyright (C) 2009-2023, 2025 by Thomas R. Wyant, III
85              
86             This program is free software; you can redistribute it and/or modify it
87             under the same terms as Perl 5.10.0. For more details, see the full text
88             of the licenses in the directory LICENSES.
89              
90             This program is distributed in the hope that it will be useful, but
91             without any warranty; without even the implied warranty of
92             merchantability or fitness for a particular purpose.
93              
94             =cut
95              
96             # ex: set textwidth=72 :