add strictures commit (out of order)
[catagits/HTML-Zoom.git] / lib / HTML / Zoom / SubObject.pm
CommitLineData
d80786d0 1package HTML::Zoom::SubObject;
2
1cf03540 3use strictures 1;
d80786d0 4use Scalar::Util ();
5
6sub new {
7 my ($class, $args) = @_;
8 ($args||={})->{zconfig} ||= do {
9 require HTML::Zoom::ZConfig;
10 HTML::Zoom::ZConfig->new
11 };
12 my $new = { _zconfig => $args->{zconfig} };
13 Scalar::Util::weaken($new->{_zconfig});
14 bless($new, $class)
15}
16
17sub _zconfig { shift->{_zconfig} }
18
19sub with_zconfig {
20 my ($self, $zconfig) = @_;
21 my $new = bless({ %$self, _zconfig => $zconfig }, ref($self));
22 Scalar::Util::weaken($new->{_zconfig});
23 $new
24}
25
261;