From: Peter Rabbitson Date: Mon, 22 Feb 2010 20:24:28 +0000 (+0000) Subject: Add a hidden option to dbicadmin to self-inject autogenerated POD X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7d6f6a6ebc1523840fe942a4ea2a21ab467e002d;p=dbsrgits%2FDBIx-Class-Historic.git Add a hidden option to dbicadmin to self-inject autogenerated POD --- diff --git a/.gitignore b/.gitignore index ea0a947..5aa3840 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,5 @@ _build/ blib/ inc/ lib/DBIx/Class/Optional/Dependencies.pod -lib/dbicadmin.pod pm_to_blib t/var/ diff --git a/lib/DBIx/Class/Admin/Usage.pm b/lib/DBIx/Class/Admin/Usage.pm index 9cae79b..291fd1e 100644 --- a/lib/DBIx/Class/Admin/Usage.pm +++ b/lib/DBIx/Class/Admin/Usage.pm @@ -52,6 +52,8 @@ See L =head1 LICENSE You may distribute this code under the same terms as Perl itself + +=cut EOA } diff --git a/script/dbicadmin b/script/dbicadmin index 59c48c6..44eba49 100755 --- a/script/dbicadmin +++ b/script/dbicadmin @@ -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='], - ['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 } ], @@ -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}) { @@ -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. -# -#=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