Hi,

I'd like to try to clean up some of the code in the solenv Perl
modules - as a first task, I want to turn on 'use strict', which I'd
consider a bare minimum for maintainable Perl.  Longer-term,
Perl::Critic flags up lots of nice stuff, and then there's performance
and so on.

My first few attempts at this have ended up ballooning into large
tasks - for instance, there seem to be lots of unused subroutines in
the installer code, which could safely be removed.  But I then end up
not sending in any patches, and have no idea if I'm going way beyond
what's acceptable. :)

So here's a first small patch that should be quite safe.

One thing I'd like to check: is the best way to test make_installer.pl to run:

  source config_host.mk
  solenv/bin/ooinstall /tmp/foo

(I get a few errors when sourcing config_host.mk.)

I've added my name to
https://wiki.documentfoundation.org/Development/Developers with a link
to my previous license statement on the mailing list.

Kind regards,

-- 
Tim Retout <t...@retout.co.uk>
From 4548143f004c2d04b77c608bc6d0a52146b0461f Mon Sep 17 00:00:00 2001
From: Tim Retout <t...@retout.co.uk>
Date: Tue, 14 Feb 2012 22:19:46 +0000
Subject: [PATCH] Turn on strictures for some installer Perl modules.

---
 solenv/bin/modules/installer/copyproject.pm |    3 +++
 solenv/bin/modules/installer/exiter.pm      |    3 +++
 solenv/bin/modules/installer/files.pm       |    5 ++++-
 solenv/bin/modules/installer/logger.pm      |    3 +++
 4 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/solenv/bin/modules/installer/copyproject.pm b/solenv/bin/modules/installer/copyproject.pm
index 8157db4..2e4f93a 100644
--- a/solenv/bin/modules/installer/copyproject.pm
+++ b/solenv/bin/modules/installer/copyproject.pm
@@ -27,6 +27,9 @@
 
 package installer::copyproject;
 
+use strict;
+use warnings;
+
 use installer::control;
 use installer::converter;
 use installer::files;
diff --git a/solenv/bin/modules/installer/exiter.pm b/solenv/bin/modules/installer/exiter.pm
index 18b3b31..243bef4 100644
--- a/solenv/bin/modules/installer/exiter.pm
+++ b/solenv/bin/modules/installer/exiter.pm
@@ -27,6 +27,9 @@
 
 package installer::exiter;
 
+use strict;
+use warnings;
+
 use installer::files;
 use installer::globals;
 use installer::logger;
diff --git a/solenv/bin/modules/installer/files.pm b/solenv/bin/modules/installer/files.pm
index 73ea267..379144e 100644
--- a/solenv/bin/modules/installer/files.pm
+++ b/solenv/bin/modules/installer/files.pm
@@ -27,6 +27,9 @@
 
 package installer::files;
 
+use strict;
+use warnings;
+
 use installer::exiter;
 use installer::logger;
 
@@ -58,7 +61,7 @@ sub read_file
 #   Don't use "my @localfile = <IN>" here, because
 #   perl has a problem with the internal "large_and_huge_malloc" function
 #   when calling perl using MacOS 10.5 with a perl built with MacOS 10.4
-    while ( $line = <IN> ) {
+    while ( my $line = <IN> ) {
         push @localfile, $line;
     }
 
diff --git a/solenv/bin/modules/installer/logger.pm b/solenv/bin/modules/installer/logger.pm
index c5982c6..0130369 100644
--- a/solenv/bin/modules/installer/logger.pm
+++ b/solenv/bin/modules/installer/logger.pm
@@ -27,6 +27,9 @@
 
 package installer::logger;
 
+use strict;
+use warnings;
+
 use installer::files;
 use installer::globals;
 
-- 
1.7.8.3

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to