From 45a4eea5b94d5a90aa83014c51366d42c39ed746 Mon Sep 17 00:00:00 2001
From: Frédéric Buclin ' : ' ';
- print $start_tag . get_string($san_tag, $vars) . "Bugzilla::Chart object:\n";
+ say "
Bugzilla::Chart object:";
print Data::Dumper::Dumper($self);
print "
";
}
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index 8d1cf32a0..3c37c0dbd 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -250,7 +250,7 @@ sub bz_create_database {
if (!$conn_success) {
$dbh = _get_no_db_connection();
- print "Creating database $db_name...\n";
+ say "Creating database $db_name...";
# Try to create the DB, and if we fail print a friendly error.
my $success = eval {
@@ -483,7 +483,7 @@ sub bz_setup_database {
my @desired_tables = $self->_bz_schema->get_table_list();
my $bugs_exists = $self->bz_table_info('bugs');
if (!$bugs_exists) {
- print install_string('db_table_setup'), "\n";
+ say install_string('db_table_setup');
}
foreach my $table_name (@desired_tables) {
@@ -520,7 +520,7 @@ sub bz_setup_foreign_keys {
my $activity_fk = $self->bz_fk_info('profiles_activity', 'userid');
my $any_fks = $activity_fk && $activity_fk->{created};
if (!$any_fks) {
- print get_text('install_fk_setup'), "\n";
+ say get_text('install_fk_setup');
}
my @tables = $self->bz_table_list();
@@ -711,12 +711,12 @@ sub bz_alter_column_raw {
$table, $name, $new_def,
defined $set_nulls_to ? $self->quote($set_nulls_to) : undef);
my $new_ddl = $self->_bz_schema->get_type_ddl($new_def);
- print "Updating column $name in table $table ...\n";
+ say "Updating column $name in table $table ...";
if (defined $current_def) {
my $old_ddl = $self->_bz_schema->get_type_ddl($current_def);
- print "Old: $old_ddl\n";
+ say "Old: $old_ddl";
}
- print "New: $new_ddl\n";
+ say "New: $new_ddl";
$self->do($_) foreach (@statements);
}
@@ -810,7 +810,7 @@ sub _bz_add_table_raw {
if (Bugzilla->usage_mode == USAGE_MODE_CMDLINE
and !$options->{silently})
{
- print install_string('db_table_new', { table => $name }), "\n";
+ say install_string('db_table_new', { table => $name });
}
$self->do($_) foreach (@statements);
}
@@ -1317,7 +1317,7 @@ sub _bz_init_schema_storage {
$self->_bz_add_table_raw('bz_schema');
}
- print install_string('db_schema_init'), "\n";
+ say install_string('db_schema_init');
my $sth = $self->prepare("INSERT INTO bz_schema "
." (schema_data, version) VALUES (?,?)");
$sth->bind_param(1, $store_me, $self->BLOB_TYPE);
diff --git a/Bugzilla/Field.pm b/Bugzilla/Field.pm
index 219172094..aa3551182 100644
--- a/Bugzilla/Field.pm
+++ b/Bugzilla/Field.pm
@@ -47,7 +47,7 @@ Bugzilla::Field - a particular piece of information about bugs
# Instantiate a Field object for an existing field.
my $field = new Bugzilla::Field({name => 'qacontact_accessible'});
if ($field->obsolete) {
- print $field->description . " is obsolete\n";
+ say $field->description . " is obsolete";
}
# Validation Routines
@@ -1173,8 +1173,8 @@ sub populate_field_definitions {
undef, $field_description);
if ($old_field_id && ($old_field_name ne $new_field_name)) {
- print "SQL fragment found in the 'fielddefs' table...\n";
- print "Old field name: " . $old_field_name . "\n";
+ say "SQL fragment found in the 'fielddefs' table...";
+ say "Old field name: $old_field_name";
# We have to fix saved searches first. Queries have been escaped
# before being saved. We have to do the same here to find them.
$old_field_name = url_quote($old_field_name);
@@ -1211,8 +1211,8 @@ sub populate_field_definitions {
$sth_UpdateSeries->execute($query, $series_id);
}
# Now that saved searches have been fixed, we can fix the field name.
- print "Fixing the 'fielddefs' table...\n";
- print "New field name: " . $new_field_name . "\n";
+ say "Fixing the 'fielddefs' table...";
+ say "New field name: $new_field_name";
$dbh->do('UPDATE fielddefs SET name = ? WHERE id = ?',
undef, ($new_field_name, $old_field_id));
}
diff --git a/Bugzilla/Install.pm b/Bugzilla/Install.pm
index ce8fe6bad..642165a43 100644
--- a/Bugzilla/Install.pm
+++ b/Bugzilla/Install.pm
@@ -34,7 +34,7 @@ use Bugzilla::Group;
use Bugzilla::Product;
use Bugzilla::User;
use Bugzilla::User::Setting;
-use Bugzilla::Util qw(get_text);
+use Bugzilla::Util qw(get_text say);
use Bugzilla::Version;
use constant STATUS_WORKFLOW => (
@@ -188,7 +188,7 @@ sub update_settings {
my $any_settings = $dbh->selectrow_array(
'SELECT 1 FROM setting ' . $dbh->sql_limit(1));
if (!$any_settings) {
- print get_text('install_setting_setup'), "\n";
+ say get_text('install_setting_setup');
}
my %settings = %{SETTINGS()};
@@ -210,7 +210,7 @@ sub update_system_groups {
# adding groups.
my $editbugs_exists = new Bugzilla::Group({ name => 'editbugs' });
if (!$editbugs_exists) {
- print get_text('install_groups_setup'), "\n";
+ say get_text('install_groups_setup');
}
# Create most of the system groups
@@ -281,7 +281,7 @@ sub init_workflow {
my $has_workflow = $dbh->selectrow_array('SELECT 1 FROM status_workflow');
return if $has_workflow;
- print get_text('install_workflow_init'), "\n";
+ say get_text('install_workflow_init');
my %status_ids = @{ $dbh->selectcol_arrayref(
'SELECT value, id FROM bug_status', {Columns=>[1,2]}) };
@@ -316,7 +316,7 @@ sub create_admin {
my $full_name = $answer{'ADMIN_REALNAME'};
if (!$login || !$password || !$full_name) {
- print "\n" . get_text('install_admin_setup') . "\n\n";
+ say "\n" . get_text('install_admin_setup') . "\n";
}
while (!$login) {
@@ -325,7 +325,7 @@ sub create_admin {
chomp $login;
eval { Bugzilla::User->check_login_name_for_creation($login); };
if ($@) {
- print $@ . "\n";
+ say $@;
undef $login;
}
}
@@ -383,7 +383,7 @@ sub make_admin {
}
if (Bugzilla->usage_mode == USAGE_MODE_CMDLINE) {
- print "\n", get_text('install_admin_created', { user => $user }), "\n";
+ say "\n", get_text('install_admin_created', { user => $user });
}
}
@@ -408,7 +408,7 @@ sub _prompt_for_password {
chomp $pass2;
eval { validate_password($password, $pass2); };
if ($@) {
- print "\n$@\n";
+ say "\n$@";
undef $password;
}
system("stty","echo") unless ON_WINDOWS;
@@ -430,7 +430,7 @@ sub reset_password {
my $password = _prompt_for_password($prompt);
$user->set_password($password);
$user->update();
- print "\n", get_text('install_reset_password_done'), "\n";
+ say "\n", get_text('install_reset_password_done');
}
1;
diff --git a/Bugzilla/Migrate.pm b/Bugzilla/Migrate.pm
index 4d7637527..ee4f1d6a6 100644
--- a/Bugzilla/Migrate.pm
+++ b/Bugzilla/Migrate.pm
@@ -30,7 +30,7 @@ use Bugzilla::Error;
use Bugzilla::Install::Requirements ();
use Bugzilla::Install::Util qw(indicate_progress);
use Bugzilla::Product;
-use Bugzilla::Util qw(get_text trim generate_random_password);
+use Bugzilla::Util qw(get_text trim generate_random_password say);
use Bugzilla::User ();
use Bugzilla::Status ();
use Bugzilla::Version;
@@ -261,7 +261,7 @@ sub bug_fields {
sub users {
my $self = shift;
if (!exists $self->{users}) {
- print get_text('migrate_reading_users'), "\n";
+ say get_text('migrate_reading_users');
$self->{users} = $self->_read_users();
}
return $self->{users};
@@ -270,7 +270,7 @@ sub users {
sub products {
my $self = shift;
if (!exists $self->{products}) {
- print get_text('migrate_reading_products'), "\n";
+ say get_text('migrate_reading_products');
$self->{products} = $self->_read_products();
}
return $self->{products};
@@ -279,7 +279,7 @@ sub products {
sub bugs {
my $self = shift;
if (!exists $self->{bugs}) {
- print get_text('migrate_reading_bugs'), "\n";
+ say get_text('migrate_reading_bugs');
$self->{bugs} = $self->_read_bugs();
}
return $self->{bugs};
@@ -340,7 +340,7 @@ sub reset_serial_values {
sub translate_all_bugs {
my ($self, $bugs) = @_;
- print get_text('migrate_translating_bugs'), "\n";
+ say get_text('migrate_translating_bugs');
# We modify the array in place so that $self->bugs will return the
# modified bugs, in case $self->before_insert wants them.
my $num_bugs = scalar(@$bugs);
@@ -608,7 +608,7 @@ sub create_custom_fields {
if (!$self->dry_run) {
$created = Bugzilla::Field->create($created);
}
- print get_text('migrate_field_created', { field => $created }), "\n";
+ say get_text('migrate_field_created', { field => $created });
}
delete $self->{bug_fields};
}
@@ -680,7 +680,7 @@ sub create_legal_values {
sub insert_bugs {
my ($self, $bugs) = @_;
my $dbh = Bugzilla->dbh;
- print get_text('migrate_creating_bugs'), "\n";
+ say get_text('migrate_creating_bugs');
my $init_statuses = Bugzilla::Status->can_change_to();
my %allowed_statuses = map { lc($_->name) => 1 } @$init_statuses;
diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm
index ac6848bfa..d158be1e1 100644
--- a/Bugzilla/Util.pm
+++ b/Bugzilla/Util.pm
@@ -31,13 +31,12 @@ package Bugzilla::Util;
use strict;
use base qw(Exporter);
-@Bugzilla::Util::EXPORT = qw(trick_taint detaint_natural
- detaint_signed
+@Bugzilla::Util::EXPORT = qw(trick_taint detaint_natural detaint_signed
html_quote url_quote xml_quote
css_class_quote html_light_quote url_decode
i_am_cgi correct_urlbase remote_ip
do_ssl_redirect_if_required use_attachbase
- diff_arrays on_main_db
+ diff_arrays on_main_db say
trim wrap_hard wrap_comment find_wrap_point
format_time validate_date validate_time datetime_from
file_mod_time is_7bit_clean
@@ -341,6 +340,13 @@ sub diff_arrays {
return (\@removed, \@added);
}
+# XXX - This is a temporary subroutine till we require Perl 5.10.1.
+# This will happen before Bugzilla 5.0rc1.
+sub say (@) {
+ print @_;
+ print "\n";
+}
+
sub trim {
my ($str) = @_;
if ($str) {
diff --git a/report.cgi b/report.cgi
index a71776bfe..20e899a6b 100755
--- a/report.cgi
+++ b/report.cgi
@@ -287,10 +287,10 @@ print $cgi->header(-type => $format->{'ctype'},
# prints out both data structures.
if ($cgi->param('debug')) {
require Data::Dumper;
- print "data hash:\n";
- print Data::Dumper::Dumper(%data) . "\n\n";
- print "data array:\n";
- print Data::Dumper::Dumper(@image_data) . "\n\n
";
+ say "data hash:";
+ say Data::Dumper::Dumper(%data);
+ say "\ndata array:";
+ say Data::Dumper::Dumper(@image_data) . "\n\n
";
}
# All formats point to the same section of the documentation.
diff --git a/sanitycheck.cgi b/sanitycheck.cgi
index 7b8177d83..1f6740e77 100755
--- a/sanitycheck.cgi
+++ b/sanitycheck.cgi
@@ -60,7 +60,7 @@ sub Status {
}
else {
my $start_tag = $alert ? '