add strictures commit (out of order)
[catagits/HTML-Zoom.git] / lib / HTML / Zoom / StreamBase.pm
index 6c0b416..a22158b 100644 (file)
@@ -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);