[Rt-commit] rt branch, 4.0-trunk, updated. rt-4.0.0rc4-35-gb099e15

? sunnavy sunnavy at bestpractical.com
Thu Feb 3 23:15:32 EST 2011


The branch, 4.0-trunk has been updated
       via  b099e156ebaf9dc8372d1951763d7eb4cd2bf2c5 (commit)
      from  44a1d032bf39808ec8ce6cecfb32edcf6bfef8c3 (commit)

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

- Log -----------------------------------------------------------------
commit b099e156ebaf9dc8372d1951763d7eb4cd2bf2c5
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Feb 4 11:33:47 2011 +0800

    we don't like 2 args open any more

diff --git a/devel/extract-message-catalog b/devel/extract-message-catalog
index 8f65233..6b231a6 100755
--- a/devel/extract-message-catalog
+++ b/devel/extract-message-catalog
@@ -133,7 +133,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;
     }
@@ -261,7 +261,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 = "";
@@ -355,7 +355,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/devel/license_tag b/devel/license_tag
index b12f641..9861553 100755
--- a/devel/license_tag
+++ b/devel/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 - ";
@@ -136,7 +136,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;
 
@@ -145,7 +145,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 - ";
@@ -169,7 +169,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;
 
@@ -179,7 +179,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 - ";
@@ -203,7 +203,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;
 
@@ -213,7 +213,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 - ";
@@ -240,7 +240,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/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 49b5140..943d445 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -462,7 +462,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 b57e0c3..21e23a9 100644
--- a/lib/RT/Interface/CLI.pm
+++ b/lib/RT/Interface/CLI.pm
@@ -195,7 +195,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);
     }
@@ -221,7 +221,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 9ac96d7..e4e2643 100644
--- 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" or die "couldn't execute program: $!";
+            open my $mail, '|-', "$path $args" or die "couldn't execute program: $!";
 
             # if something wrong with $mail->print we will get PIPE signal, handle it
             local $SIG{'PIPE'} = sub { die "program unexpectedly closed pipe" };
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 49d8d06..7ec6139 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -837,7 +837,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/t/mail/crypt-gnupg.t b/t/mail/crypt-gnupg.t
index 6b89aab..cf69985 100644
--- a/t/mail/crypt-gnupg.t
+++ b/t/mail/crypt-gnupg.t
@@ -304,7 +304,7 @@ diag 'wrong signed/encrypted parts: wrong proto';
 
 diag 'verify inline and in attachment signatures';
 {
-    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 ea2d01b..d947fe5 100644
--- a/t/ticket/linking.t
+++ b/t/ticket/linking.t
@@ -38,13 +38,13 @@ 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>;
 \$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";
@@ -391,7 +391,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 805cf41..ee1ee7a 100644
--- a/t/web/command_line.t
+++ b/t/web/command_line.t
@@ -508,7 +508,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