summaryrefslogtreecommitdiff
path: root/tools/mkdescriptions
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2021-01-25 12:13:54 +0000
committerSadie Powell <sadie@witchery.services>2021-01-25 12:39:56 +0000
commitf6b861f12d070ba931d829505bfd3229653f5df2 (patch)
treeb043d1e05d9703ab0ec29be91055d793f0fd93d0 /tools/mkdescriptions
parentcc28ba0f2164ea68db1bc373ee06fc58f82c3314 (diff)
Fix unnecessary begin blocks in Perl source files.
Diffstat (limited to 'tools/mkdescriptions')
-rwxr-xr-xtools/mkdescriptions15
1 files changed, 4 insertions, 11 deletions
diff --git a/tools/mkdescriptions b/tools/mkdescriptions
index ee29f48e9..bb6f011d8 100755
--- a/tools/mkdescriptions
+++ b/tools/mkdescriptions
@@ -18,15 +18,7 @@
#
-BEGIN {
- require 5.10.0;
- unless (-f 'configure') {
- print "Error: $0 must be run from the main source directory!\n";
- exit 1;
- }
-}
-
-use feature ':5.10';
+use v5.10.0;
use strict;
use warnings FATAL => qw(all);
@@ -42,7 +34,7 @@ use lib dirname $RealDir;
use make::common;
use make::console;
-if (scalar @ARGV < 1) {
+unless (scalar @ARGV) {
print_format "<|GREEN Usage:|> $0 <<|UNDERLINE DOCS-SITE|>>\n", *STDERR;
exit 1;
}
@@ -51,7 +43,8 @@ my %version = get_version();
my $docdir = rel2abs catdir $ARGV[0], 'docs', $version{MAJOR}, 'modules';
print_error "unable to find the module directory at $docdir!" unless -d $docdir;
-for my $module (<src/modules/extra/m_*.cpp>, <src/modules/m_*.cpp>, <src/modules/m_*/main.cpp>) {
+my $root = dirname $RealDir;
+for my $module (<$root/src/modules/extra/m_*.cpp>, <$root/src/modules/m_*.cpp>, <$root/src/modules/m_*/main.cpp>) {
print_error "unable to extract module name from $module!" unless $module =~ /m_(\w+)[.\/]/;
my $docfile = catfile $docdir, "$1.md";
print_error "unable to find the module documentation at $docfile!" unless -f $docfile;