add strictures commit (out of order)
[catagits/HTML-Zoom.git] / lib / HTML / Zoom / SubObject.pm
1 package HTML::Zoom::SubObject;
2
3 use strictures 1;
4 use Scalar::Util ();
5
6 sub 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
17 sub _zconfig { shift->{_zconfig} }
18
19 sub 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
26 1;