HTML-Zoom

 view release on metacpan or  search on metacpan

lib/HTML/Zoom.pm  view on Meta::CPAN

}

sub from_html {
  my $self = shift->_self_or_new;
  $self->from_events($self->zconfig->parser->html_to_events($_[0]))
}

sub from_file {
  my $self = shift->_self_or_new;
  my $filename = shift;
  $self->from_html(do { local (@ARGV, $/) = ($filename); <> });
}

sub to_stream {
  my $self = shift;
  die "No events to build from - forgot to call from_html?"
    unless $self->{initial_events};
  my $sutils = $self->zconfig->stream_utils;
  my $stream = $sutils->stream_from_array(@{$self->{initial_events}});
  $stream = $_->apply_to_stream($stream) for @{$self->{transforms}||[]};
  $stream

maint/synopsis-extractor  view on Meta::CPAN

#!/usr/bin/env perl

use strict;
use warnings;

use FindBin qw($Bin);
use File::Find;
use File::Spec;

sub slurp_file {
    local (@ARGV, $/) = ($_[0]); <>
}

sub extract_synopsis {
    my $string = shift || return;
    my $head_or_cut = qr[head|cut]x;
    if($string=~m/^=head1 SYNOPSIS\n(.*?)^=$head_or_cut/sm) {
        my $extracted = $1;
        my $begin_end = qr[begin|end]x;
        $extracted=~s/\n^=$begin_end testinfo\n\n//smg; # remove test block
        $extracted=~s/^\S.+?$//smg; # wipe out non code lines in pod



( run in 0.479 second using v1.01-cache-2.11-cpan-49f99fa48dc )