From 01abe8afb95f4bafb1f192fb3fe451a95cd2e3f8 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sun, 15 Feb 2015 23:18:31 +0100 Subject: perl: Rework use and exporter declarations Place 'use' strict and warnings first, then Exporter 'our' declarations, then Test module imports, then system module imports, then Dpkg module imports, then 'use' parent and overload pragmas, separated by a blank line for each block. Split each exported symbol declaration into its own line to ease modifications. --- scripts/Dpkg/Control/Changelog.pm | 1 + scripts/Dpkg/Control/Fields.pm | 3 +-- scripts/Dpkg/Control/FieldsCore.pm | 29 ++++++++++++++++++++--------- scripts/Dpkg/Control/Types.pm | 16 +++++++++++++--- 4 files changed, 35 insertions(+), 14 deletions(-) (limited to 'scripts/Dpkg/Control') diff --git a/scripts/Dpkg/Control/Changelog.pm b/scripts/Dpkg/Control/Changelog.pm index 850bdc72f..379cad091 100644 --- a/scripts/Dpkg/Control/Changelog.pm +++ b/scripts/Dpkg/Control/Changelog.pm @@ -21,6 +21,7 @@ use warnings; our $VERSION = '1.00'; use Dpkg::Control; + use parent qw(Dpkg::Control); =encoding utf8 diff --git a/scripts/Dpkg/Control/Fields.pm b/scripts/Dpkg/Control/Fields.pm index 6f2eee4e3..d3f92725d 100644 --- a/scripts/Dpkg/Control/Fields.pm +++ b/scripts/Dpkg/Control/Fields.pm @@ -19,6 +19,7 @@ use strict; use warnings; our $VERSION = '1.00'; +our @EXPORT = @Dpkg::Control::FieldsCore::EXPORT; use Carp; use Exporter qw(import); @@ -26,8 +27,6 @@ use Exporter qw(import); use Dpkg::Control::FieldsCore; use Dpkg::Vendor qw(run_vendor_hook); -our @EXPORT = @Dpkg::Control::FieldsCore::EXPORT; - # Register vendor specifics fields foreach my $op (run_vendor_hook('register-custom-fields')) { next if not (defined $op and ref $op); # Skip when not implemented by vendor diff --git a/scripts/Dpkg/Control/FieldsCore.pm b/scripts/Dpkg/Control/FieldsCore.pm index bf724be08..1d0e56464 100644 --- a/scripts/Dpkg/Control/FieldsCore.pm +++ b/scripts/Dpkg/Control/FieldsCore.pm @@ -19,22 +19,33 @@ use strict; use warnings; our $VERSION = '1.00'; +our @EXPORT = qw( + field_capitalize + field_is_official + field_is_allowed_in + field_transfer_single + field_transfer_all + field_list_src_dep + field_list_pkg_dep + field_get_dep_type + field_get_sep_type + field_ordered_list + field_register + field_insert_after + field_insert_before + FIELD_SEP_UNKNOWN + FIELD_SEP_SPACE + FIELD_SEP_COMMA + FIELD_SEP_LINE +); use Exporter qw(import); + use Dpkg::Gettext; use Dpkg::ErrorHandling; use Dpkg::Control::Types; use Dpkg::Checksums; -our @EXPORT = qw(field_capitalize field_is_official field_is_allowed_in - field_transfer_single field_transfer_all - field_list_src_dep field_list_pkg_dep field_get_dep_type - field_get_sep_type - field_ordered_list field_register - field_insert_after field_insert_before - FIELD_SEP_UNKNOWN FIELD_SEP_SPACE FIELD_SEP_COMMA - FIELD_SEP_LINE); - use constant { ALL_PKG => CTRL_INFO_PKG | CTRL_INDEX_PKG | CTRL_PKG_DEB | CTRL_FILE_STATUS, ALL_SRC => CTRL_INFO_SRC | CTRL_INDEX_SRC | CTRL_PKG_SRC, diff --git a/scripts/Dpkg/Control/Types.pm b/scripts/Dpkg/Control/Types.pm index bdcdd239a..09e12d155 100644 --- a/scripts/Dpkg/Control/Types.pm +++ b/scripts/Dpkg/Control/Types.pm @@ -17,11 +17,21 @@ use strict; use warnings; our $VERSION = '0.01'; +our @EXPORT = qw( + CTRL_UNKNOWN + CTRL_INFO_SRC + CTRL_INFO_PKG + CTRL_INDEX_SRC + CTRL_INDEX_PKG + CTRL_PKG_SRC + CTRL_PKG_DEB + CTRL_FILE_CHANGES + CTRL_FILE_VENDOR + CTRL_FILE_STATUS + CTRL_CHANGELOG +); use Exporter qw(import); -our @EXPORT = qw(CTRL_UNKNOWN CTRL_INFO_SRC CTRL_INFO_PKG CTRL_INDEX_SRC - CTRL_INDEX_PKG CTRL_PKG_SRC CTRL_PKG_DEB CTRL_FILE_CHANGES - CTRL_FILE_VENDOR CTRL_FILE_STATUS CTRL_CHANGELOG); =encoding utf8 -- cgit v1.2.3