[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.8-248-gb9dda9c

? sunnavy sunnavy at bestpractical.com
Thu Feb 3 22:46:35 EST 2011


The branch, 3.8-trunk has been updated
       via  b9dda9ccf7f9d645d1bc43a0ff5cf9566060f43a (commit)
      from  390a444165c03cbfb7974fcbb8315b3654ca9029 (commit)

Summary of changes:
 bin/webmux.pl.in             |    2 +-
 lib/RT/Handle.pm             |    2 +-
 lib/RT/Interface/CLI.pm      |    4 ++--
 lib/RT/Interface/Email.pm    |    2 +-
 lib/RT/Interface/Web.pm      |    2 +-
 sbin/extract-message-catalog |    6 +++---
 sbin/license_tag             |   16 ++++++++--------
 t/mail/crypt-gnupg.t         |    2 +-
 t/ticket/linking.t           |    6 +++---
 t/web/command_line.t         |    2 +-
 10 files changed, 22 insertions(+), 22 deletions(-)

- Log -----------------------------------------------------------------
commit b9dda9ccf7f9d645d1bc43a0ff5cf9566060f43a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Feb 4 11:27:01 2011 +0800

    we don't like 2 args open any more

diff --git a/bin/webmux.pl.in b/bin/webmux.pl.in
index 7931972..318d1d7 100755
--- a/bin/webmux.pl.in
+++ b/bin/webmux.pl.in
@@ -73,7 +73,7 @@ sub handler {
         # and make all system() and open "|-" dangerouse, for example DBI
         # can get this FD for DB connection and system() call will close
         # by putting grabage into the socket
-        open $protect_fd, '>/dev/null' or die "Couldn't open /dev/null: $!";
+        open $protect_fd, '>', '/dev/null' or die "Couldn't open /dev/null: $!";
         unless ( fileno($protect_fd) == 1 ) {
             warn "We opened /dev/null to protect FD #1, but descriptor #1 is already occupied";
         }
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index f9b04ba..23bfb58 100755
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -474,7 +474,7 @@ sub InsertSchema {
 
     my (@schema);
 
-    open my $fh_schema, "<$file";
+    open my $fh_schema, '<', $file or die $!;
 
     my $has_local = 0;
     open my $fh_schema_local, "<" . $self->GetVersionFile( $dbh, $RT::LocalEtcPath . "/schema." . $db_type )
diff --git a/lib/RT/Interface/CLI.pm b/lib/RT/Interface/CLI.pm
index e634802..33b15b8 100755
--- a/lib/RT/Interface/CLI.pm
+++ b/lib/RT/Interface/CLI.pm
@@ -200,7 +200,7 @@ sub GetMessageContent {
     
     #Load the sourcefile, if it's been handed to us
     if ($source) {
-	open (SOURCE, "<$source");
+	open SOURCE, '<', $source or die $!;
 	@lines = (<SOURCE>);
 	close (SOURCE);
     }
@@ -226,7 +226,7 @@ sub GetMessageContent {
 	system ($ENV{'EDITOR'}, $filename);
     }	
     
-    open (READ, "<$filename");
+    open READ, '<', $filename or die $!;
     my @newlines = (<READ>);
     close (READ);
 
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index cde3bb9..93ffda0 100755
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -445,7 +445,7 @@ sub SendEmail {
             # don't ignore CHLD signal to get proper exit code
             local $SIG{'CHLD'} = 'DEFAULT';
 
-            open my $mail, "|$path $args >/dev/null"
+            open my $mail, '|-', "$path $args >/dev/null"
                 or die "couldn't execute program: $!";
 
             # if something wrong with $mail->print we will get PIPE signal, handle it
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 4c74b6a..7626161 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -797,7 +797,7 @@ sub SendStaticFile {
         $type ||= "application/octet-stream";
     }
     $HTML::Mason::Commands::r->content_type($type);
-    open my $fh, "<$file" or die "couldn't open file: $!";
+    open my $fh, '<', $file or die "couldn't open file: $!";
     binmode($fh);
     {
         local $/ = \16384;
diff --git a/sbin/extract-message-catalog b/sbin/extract-message-catalog
index e734b89..586feff 100755
--- a/sbin/extract-message-catalog
+++ b/sbin/extract-message-catalog
@@ -120,7 +120,7 @@ sub extract_strings_from_code {
     $filename =~ s'^\./'';
     $filename =~ s'\.in$'';
 
-    unless (open _, $file) {
+    unless (open _, '<', $file) {
         print "Cannot open $file for reading ($!), skipping.\n";
         return;
     }
@@ -249,7 +249,7 @@ sub update {
     print "Updating $lang...\n";
 
     my @lines;
-    @lines = (<LEXICON>) if open (LEXICON, $file);
+    @lines = (<LEXICON>) if open LEXICON, '<', $file;
     @lines = grep { !/^(#(:|\.)\s*|$)/ } @lines;
     while (@lines) {
         my $msghdr = "";
@@ -343,7 +343,7 @@ sub update {
         $out .= 'msgid ' . fmt($_) . "msgstr \"$Lexicon{$_}\"\n\n";
     }
 
-    open PO, ">$file" or die "Couldn't open '$file' for writing: $!";
+    open PO, '>', $file or die "Couldn't open '$file' for writing: $!";
     print PO $out;
     close PO;
 
diff --git a/sbin/license_tag b/sbin/license_tag
index 9d3009f..b55b310 100755
--- a/sbin/license_tag
+++ b/sbin/license_tag
@@ -112,7 +112,7 @@ sub tag_mason {
         my $pm = $_;
         return unless (-f $pm);
         return if $pm =~ /images/ || $pm =~ /\.(?:png|jpe?g|gif)$/;
-        open(FILE,"<$pm") || die "Failed to open $pm";
+        open FILE, '<' $pm or die "Failed to open $pm";
         my $file = (join "", <FILE>); 
         close (FILE);
         print "$pm - ";
@@ -135,7 +135,7 @@ sub tag_mason {
         
 
 
-        open (FILE, ">$pm") || die "couldn't write new file";
+        open FILE, '>', $pm or die "couldn't write new file";
         print FILE $file;
         close FILE;
 
@@ -144,7 +144,7 @@ sub tag_mason {
 
 sub tag_makefile {
         my $pm = shift;
-        open(FILE,"<$pm") || die "Failed to open $pm";
+        open FILE, '<', $pm or die "Failed to open $pm";
         my $file = (join "", <FILE>); 
         close (FILE);
         print "$pm - ";
@@ -167,7 +167,7 @@ sub tag_makefile {
         
 
 
-        open (FILE, ">$pm") || die "couldn't write new file";
+        open FILE, '>', $pm or die "couldn't write new file";
         print FILE $file;
         close FILE;
 
@@ -177,7 +177,7 @@ sub tag_makefile {
 sub tag_pm {
         my $pm = $_;
         next unless $pm =~ /\.pm/s;
-        open(FILE,"<$pm") || die "Failed to open $pm";
+        open FILE, '<', $pm or die "Failed to open $pm";
         my $file = (join "", <FILE>); 
         close (FILE);
         print "$pm - ";
@@ -200,7 +200,7 @@ sub tag_pm {
         
 
 
-        open (FILE, ">$pm") || die "couldn't write new file $pm";
+        open FILE, '>', $pm or die "couldn't write new file $pm";
         print FILE $file;
         close FILE;
 
@@ -210,7 +210,7 @@ sub tag_pm {
 sub tag_script {
         my $pm = $_;
         return unless (-f $pm);
-        open(FILE,"<$pm") || die "Failed to open $pm";
+        open FILE, '<', $pm or die "Failed to open $pm";
         my $file = (join "", <FILE>); 
         close (FILE);
         print "$pm - ";
@@ -236,7 +236,7 @@ sub tag_script {
         print "\n";
         
 
-        open (FILE, ">$pm") || die "couldn't write new file";
+        open FILE, '>', $pm or die "couldn't write new file";
         print FILE $file;
         close FILE;
 
diff --git a/t/mail/crypt-gnupg.t b/t/mail/crypt-gnupg.t
index f33fbab..e6ab562 100644
--- a/t/mail/crypt-gnupg.t
+++ b/t/mail/crypt-gnupg.t
@@ -285,7 +285,7 @@ diag 'wrong signed/encrypted parts: wrong proto' if $ENV{'TEST_VERBOSE'};
 
 diag 'verify inline and in attachment signatures' if $ENV{'TEST_VERBOSE'};
 {
-    open my $fh, "$homedir/signed_old_style_with_attachment.eml";
+    open my $fh, '<', "$homedir/signed_old_style_with_attachment.eml" or die $!;
     my $parser = new MIME::Parser;
     my $entity = $parser->parse( $fh );
 
diff --git a/t/ticket/linking.t b/t/ticket/linking.t
index 2ea3d58..a538fb1 100644
--- a/t/ticket/linking.t
+++ b/t/ticket/linking.t
@@ -38,14 +38,14 @@ my $q2 = RT::Queue->new($RT::SystemUser);
 ok ($id,$msg);
 
 my $commit_code = <<END;
-open my \$file, "<$filename" or die "couldn't open $filename";
+open my \$file, '<', "$filename" or die "couldn't open $filename";
 my \$data = <\$file>;
 chomp \$data;
 \$data += 0;
 close \$file;
 \$RT::Logger->debug("Data is \$data");
 
-open \$file, ">$filename" or die "couldn't open $filename";
+open \$file, '>', "$filename" or die "couldn't open $filename";
 if (\$self->TransactionObj->Type eq 'AddLink') {
     \$RT::Logger->debug("AddLink");
     print \$file \$data+1, "\n";
@@ -375,7 +375,7 @@ ok($link->LocalBase   == 0, "LocalBase set correctly");
 
 sub link_count {
     my $file = shift;
-    open my $fh, "<$file" or die "couldn't open $file";
+    open my $fh, '<', $file or die "couldn't open $file";
     my $data = <$fh>;
     close $fh;
 
diff --git a/t/web/command_line.t b/t/web/command_line.t
index 3fc279b..e8e2367 100644
--- a/t/web/command_line.t
+++ b/t/web/command_line.t
@@ -532,7 +532,7 @@ sub check_attachment {
     expect_handle->before() =~ $attachment_regex;
     my $attachment_id = $1;
     expect_send("show ticket/$ticket_id/attachments/$attachment_id/content","Fetching Attachment");
-    open (my $fh, $attachment_path) or die "Can't open $attachment_path: $!";
+    open my $fh, '<', $attachment_path or die "Can't open $attachment_path: $!";
     my $attachment_content = do { local($/); <$fh> };
     close $fh;
     chomp $attachment_content;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list