Permalink
Browse files

Add a hidden option to dbicadmin to self-inject autogenerated POD

  • Loading branch information...
1 parent 6c0bb6a commit 7d6f6a6ebc1523840fe942a4ea2a21ab467e002d @ribasushi ribasushi committed Feb 22, 2010
Showing with 20 additions and 27 deletions.
  1. +0 −1 .gitignore
  2. +2 −0 lib/DBIx/Class/Admin/Usage.pm
  3. +18 −26 script/dbicadmin
View
@@ -10,6 +10,5 @@ _build/
blib/
inc/
lib/DBIx/Class/Optional/Dependencies.pod
-lib/dbicadmin.pod
pm_to_blib
t/var/
@@ -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
}
View
@@ -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 } ],
@@ -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<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.