Catch unmatched "[" in selector parser with a helpful error
[catagits/HTML-Zoom.git] / lib / HTML / Zoom / SubObject.pm
CommitLineData
d80786d0 1package HTML::Zoom::SubObject;
2
3use strict;
4use warnings FATAL => 'all';
5use Scalar::Util ();
6
7sub new {
8 my ($class, $args) = @_;
9 ($args||={})->{zconfig} ||= do {
10 require HTML::Zoom::ZConfig;
11 HTML::Zoom::ZConfig->new
12 };
13 my $new = { _zconfig => $args->{zconfig} };
14 Scalar::Util::weaken($new->{_zconfig});
15 bless($new, $class)
16}
17
18sub _zconfig { shift->{_zconfig} }
19
20sub with_zconfig {
21 my ($self, $zconfig) = @_;
22 my $new = bless({ %$self, _zconfig => $zconfig }, ref($self));
23 Scalar::Util::weaken($new->{_zconfig});
24 $new
25}
26
271;