[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3033] branches/1.2/bin/io.pl



Revision: 3033
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3033&view=rev
Author:   jfkw
Date:     2010-07-29 02:43:35 +0000 (Thu, 29 Jul 2010)

Log Message:
-----------
bin/io.pl: fix defined(%hash) is deprecated in Perl 5.12.

Per http://perldoc.perl.org/functions/defined.html:

  Use of defined on aggregates (hashes and arrays) is deprecated. It used to
  report whether memory for that aggregate has ever been allocated. This
  behavior may disappear in future versions of Perl. You should instead use a
  simple test for size:

     if (%a_hash) { print "has hash members\n" }

Fix one module's instances of:

if defined %$old_form;

with:

if (%$old_form);

Additional commits to fix throughout 1.2 codebase to follow, pending comments.

Modified Paths:
--------------
    branches/1.2/bin/io.pl

Modified: branches/1.2/bin/io.pl
===================================================================
--- branches/1.2/bin/io.pl	2010-07-29 02:14:47 UTC (rev 3032)
+++ branches/1.2/bin/io.pl	2010-07-29 02:43:35 UTC (rev 3033)
@@ -1680,7 +1680,7 @@
             $form->update_status( \%myconfig );
         }
 
-        $old_form->{printed} = $form->{printed} if defined %$old_form;
+        $old_form->{printed} = $form->{printed} if (%$old_form);
 
         %audittrail = (
             tablename => ($order) ? 'oe' : lc $ARAP,
@@ -1692,7 +1692,7 @@
 
         $old_form->{audittrail} .=
           $form->audittrail( "", \%myconfig, \%audittrail )
-          if defined %$old_form;
+          if (%$old_form);
 
     } elsif ( $form->{media} eq 'email' ) {
         $form->{subject} = qq|$form->{label} $form->{"${inv}number"}|
@@ -1715,7 +1715,7 @@
         $bcc = $locale->text( 'Bcc: [_1]', $form->{bcc} ) . qq|\n|
           if $form->{bcc};
 
-        if ( defined %$old_form ) {
+        if (%$old_form) {
             $old_form->{intnotes} = qq|$old_form->{intnotes}\n\n|
               if $old_form->{intnotes};
             $old_form->{intnotes} .=
@@ -1748,7 +1748,7 @@
 
         $old_form->{audittrail} .=
           $form->audittrail( "", \%myconfig, \%audittrail )
-          if defined %$old_form;
+          if (%$old_form);
     } elsif ( $form->{media} eq 'queue' ) {
         %queued = split / /, $form->{queued};
 
@@ -1795,7 +1795,7 @@
     $form->parse_template( \%myconfig, ${LedgerSMB::Sysconfig::userspath} );
 
     # if we got back here restore the previous form
-    if ( defined %$old_form ) {
+    if (%$old_form) {
 
         $old_form->{"${inv}number"} = $form->{"${inv}number"};
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.