fix as_stream typo to to_stream
Matt S Trout [Mon, 24 May 2010 20:22:57 +0000 (21:22 +0100)]
lib/HTML/Zoom.pm
lib/HTML/Zoom/StreamUtils.pm

index dac8bd7..7aef7e7 100644 (file)
@@ -344,7 +344,7 @@ HTML::Zoom does its best to defer doing anything until it's absolutely
 required. The only point at which it descends into state is when you force
 it to create a stream, directly by:
 
-  my $stream = $zoom->as_stream;
+  my $stream = $zoom->to_stream;
 
   while (my $evt = $stream->next) {
     # handle zoom event here
index 16a029f..6c571fc 100644 (file)
@@ -41,11 +41,11 @@ sub stream_from_proto {
   } elsif ($ref eq 'ARRAY') {
     return $self->stream_from_array(@$proto);
   } elsif ($ref eq 'CODE') {
-    return $proto->();
+    return $self->stream_from_code($proto);
   } elsif ($ref eq 'SCALAR') {
     return $self->_zconfig->parser->html_to_stream($$proto);
-  } elsif (Scalar::Util::blessed($proto) && $proto->can('as_stream')) {
-    my $stream = $proto->as_stream;
+  } elsif (Scalar::Util::blessed($proto) && $proto->can('to_stream')) {
+    my $stream = $proto->to_stream;
     return $self->stream_from_code(sub { $stream->next });
   }
   die "Don't know how to turn $proto (ref $ref) into a stream";