Thomas Adam wrote: > On 6 October 2010 23:01, Jakub Narebski <jnareb@xxxxxxxxx> wrote: > > +sub capture { > > + Â Â Â my ($self, $code) = @_; > > + > > + Â Â Â $self->start(); > > + Â Â Â $code->(); > > unless( defined $code and ref($code) eq 'CODE' ) > { > # Error? > .... > } But what to do if $code is *not* a code reference? Well, except perhaps providing better error message... > > + Â Â Â return $self->stop(); > > +} > > + > > +# Wrap caching data; capture only STDOUT > > +sub capture_block (&) { > > This is prototyped deliberately? Yes, it is prototyped deliberately to be able to use it like this my $data = capture_block { ... } similarly to the API used by Capture::Tiny (which is not in core, which captures also STDERR, and which do not provide capture_stop() equivalent for die_error to be not captured and cached). Only to explicitely discard prototype with '&capture_block($code)', when using it in ->cache_output_* methods in GitwebCache::CacheOutput ;-) -- Jakub Narebski Poland -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html