Class-Tangram
view release on metacpan or search on metacpan
bin/ct2pod.pl view on Meta::CPAN
(my $class = $entry) =~ s{\$\*}{};
$class =~ s{::.*?$}{};
($Data::Dumper::Varname = "$entry") =~ s{\*}{};
print Data::Dumper->Dump([ ${*{$entry}{SCALAR}} ], [$class]);
}
}
}
}
}
sub read_pod(\*) {
my $fh = shift;
my @output;
while ( defined <$fh> ) {
push @output, $_;
}
close $fh;
if ( $? ) {
barf "sub-process ".($?&255 ? "killed by signal $?"
: "exited with error code ".($?>>8));
}
return join "", @output;
}
#=====================================================================
# MAIN SECTION STARTS HERE
#=====================================================================
my $is_schema;
getopt ( "schema|s" => \$is_schema,
);
while ( my $filename = shift ) {
generate_pod($filename);
next;
die "fork failed; $!" unless defined (my $pid = open POD, "-|");
generate_pod $filename unless $pid;
my $pod = read_pod(*POD) if $pid;
}
__DATA__
=head1 NAME
[% IF pod.name %][% pod.name %][% ELSE %]
[% class %] - Class::Tangram data class
[% END %]
=head1 SYNOPSIS
[% IF pod.synopsis %][% pod.synopsis %][% ELSE %]
use [% class %];
my $object = [% class %]->new
[% IF required %]
(
[% FOR item = required %]
[% item.name %] => [% item.example %],
[% END %]
);
[% END %][%# required %]
[% END %]
[% FOR type = fields.keys.sort %]
[% IF type.match("i?set") %]
[% FOR fields = fields.$type.keys.sort %]
$obj->
[% END %]
[% END %]
=head1 DESCRIPTION
[% IF pod.description %][% pod.description %][% ELSE %]
[%
( run in 1.983 second using v1.01-cache-2.11-cpan-2398b32b56e )