X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FHTML%2FZoom%2FStreamBase.pm;h=a22158b4d1c3a01ebf0cd1bacca9d2f61f192b94;hb=1cf035405cb81b780825c083cf7f5c0767b19243;hp=6c0b41620de65d56bb2c3fccb6c639af9aa6318c;hpb=12bfb3b72e83b770d0a1a8b546af34494acbf648;p=catagits%2FHTML-Zoom.git diff --git a/lib/HTML/Zoom/StreamBase.pm b/lib/HTML/Zoom/StreamBase.pm index 6c0b416..a22158b 100644 --- a/lib/HTML/Zoom/StreamBase.pm +++ b/lib/HTML/Zoom/StreamBase.pm @@ -1,7 +1,6 @@ package HTML::Zoom::StreamBase; -use strict; -use warnings FATAL => 'all'; +use strictures 1; use HTML::Zoom::TransformBuilder; sub _zconfig { shift->{_zconfig} } @@ -83,6 +82,17 @@ sub apply { $self->$code; } +sub apply_if { + my ($self, $predicate, $code) = @_; + if($predicate) { + local $_ = $self; + $self->$code; + } + else { + $self; + } +} + sub to_html { my ($self) = @_; $self->_zconfig->producer->html_from_stream($self);