Skip to content

Commit

Permalink
Add a hidden option to dbicadmin to self-inject autogenerated POD
Browse files Browse the repository at this point in the history
  • Loading branch information
ribasushi committed Feb 22, 2010
1 parent 6c0bb6a commit 7d6f6a6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 27 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -10,6 +10,5 @@ _build/
blib/
inc/
lib/DBIx/Class/Optional/Dependencies.pod
lib/dbicadmin.pod
pm_to_blib
t/var/
2 changes: 2 additions & 0 deletions lib/DBIx/Class/Admin/Usage.pm
Expand Up @@ -52,6 +52,8 @@ See L<DBIx::Class/CONTRIBUTORS>
=head1 LICENSE
You may distribute this code under the same terms as Perl itself
=cut
EOA
}

Expand Down
44 changes: 18 additions & 26 deletions script/dbicadmin
Expand Up @@ -43,8 +43,8 @@ my ($opts, $usage) = describe_options(
['update|u' => 'Update data in the schema', ],
['delete|D' => 'Delete data from the schema',],
['op:s' => 'compatiblity option all of the above can be suppied as --op=<action>'],
['help|h' => 'display this help', { implies => { schema_class => 'main' } } ],
['pod' => 'Output this usage as pod', { implies => { schema_class => 'main' } } ],
['help|h' => 'display this help', { implies => { schema_class => '__dummy__' } } ],
['selfinject-pod' => 'hidden', { implies => { schema_class => '__dummy__' } } ],
], required=> 1 }],
['Arguments'],
['schema-class|schema|C:s' => 'The class of the schema to load', { required => 1 } ],
Expand All @@ -68,11 +68,19 @@ my ($opts, $usage) = describe_options(

die "please only use one of --config or --connect-info\n" if ($opts->{config} and $opts->{connect_info});

if($opts->{pod}) {
if($opts->{selfinject_pod}) {
$usage->synopsis($synopsis_text);
$usage->short_description($short_description);
print $usage->pod();
exit 0;
exec (
$^X,
qw/-p -0777 -i -e/,
(
's/^# auto_pod_begin.*^# auto_pod_end/'
. quotemeta($usage->pod)
. '/ms'
),
__FILE__
);
}

if($opts->{help}) {
Expand Down Expand Up @@ -112,28 +120,12 @@ if ($action eq 'select') {
}


#__END__
#
#=begin pod_begin
#
#BEGIN MARKER FOR DYNAMIC POD
#
#=end pod_begin
#
#=begin pod_end
#
#END MARKER FOR DYNAMIC POD
#
#=end pod_end
#
#=head1 AUTHOR
#
#See L<DBIx::Class/CONTRIBUTORS>.
#
#=head1 LICENSE
__END__
# auto_pod_begin
#
#You may distribute this code under the same terms as Perl itself
# This will be replaced by the actual pod when selfinject-pod is invoked
#
#=cut
# auto_pod_end
# vim: et ft=perl

0 comments on commit 7d6f6a6

Please sign in to comment.