vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[livejournal] r15109: LJSUP-4179: remove "my $x if cond()" con...

Committer: vad
LJSUP-4179: remove "my $x if cond()" construction.

U   trunk/cgi-bin/fbupload.pl
U   trunk/cgi-bin/ljemailgateway.pl
U   trunk/cgi-bin/ljprotocol.pl
U   trunk/cgi-bin/talklib.pl
U   trunk/cgi-bin/weblib.pl
Modified: trunk/cgi-bin/fbupload.pl
===================================================================
--- trunk/cgi-bin/fbupload.pl	2009-04-08 04:33:18 UTC (rev 15108)
+++ trunk/cgi-bin/fbupload.pl	2009-04-08 07:33:06 UTC (rev 15109)
@@ -143,7 +143,7 @@
     $req->content($$rawdata);
     my $res = $ua->request($req);
 
-    my $res_code = $1 if $res->status_line =~ /^(\d+)/;
+    my $res_code = ($res->status_line =~ /^(\d+)/) ? $1 : '';
     unless ($res->is_success) {
         $$rv = "HTTP error uploading pict: " . $res->content();
         return $res_code;

Modified: trunk/cgi-bin/ljemailgateway.pl
===================================================================
--- trunk/cgi-bin/ljemailgateway.pl	2009-04-08 04:33:18 UTC (rev 15108)
+++ trunk/cgi-bin/ljemailgateway.pl	2009-04-08 07:33:06 UTC (rev 15109)
@@ -121,7 +121,7 @@
     my $content_type = $tent->head->get('Content-type:');
     $charset = $1 if $content_type =~ /\bcharset=['\"]?(\S+?)['\"]?[\s\;]/i;
     $format = $1 if $content_type =~ /\bformat=['\"]?(\S+?)['\"]?[\s\;]/i;
-    my $delsp = $1 if $content_type =~ /\bdelsp=['\"]?(\w+?)['\"]?[\s\;]/i;
+    my $delsp = ($content_type =~ /\bdelsp=['\"]?(\w+?)['\"]?[\s\;]/i) ? $1 : '';
 
     if (defined($charset) && $charset !~ /^UTF-?8$/i) { # no charset? assume us-ascii
         return $err->("Unknown charset encoding type. ($charset)")
@@ -200,7 +200,7 @@
 
         # ok, parse the XML.
         my $html = $tent->bodyhandle->as_string();
-        my $xml_string = $1 if $html =~ /<!-- lsPictureMail-Share-\w+-comment\n(.+)\n-->/is;
+        my $xml_string = ($html =~ /<!-- lsPictureMail-Share-\w+-comment\n(.+)\n-->/is) ? $1 : '';
         return $err->(
             "Unable to find XML content in PictureMail message.",
           ) unless $xml_string;

Modified: trunk/cgi-bin/ljprotocol.pl
===================================================================
--- trunk/cgi-bin/ljprotocol.pl	2009-04-08 04:33:18 UTC (rev 15108)
+++ trunk/cgi-bin/ljprotocol.pl	2009-04-08 07:33:06 UTC (rev 15109)
@@ -1691,7 +1691,7 @@
         # We must use property 'dupsig_post' in author of entry to be deleted, not in
         # remote user or journal owner!
         my $item = LJ::get_log2_row($uowner, $req->{'itemid'});
-        my $poster = LJ::want_user($item->{'posterid'}) if $item;
+        my $poster = $item ? LJ::want_user($item->{'posterid'}) : '';
 
         LJ::delete_entry($uowner, $req->{'itemid'}, 'quick', $oldevent->{'anum'});
 

Modified: trunk/cgi-bin/talklib.pl
===================================================================
--- trunk/cgi-bin/talklib.pl	2009-04-08 04:33:18 UTC (rev 15108)
+++ trunk/cgi-bin/talklib.pl	2009-04-08 07:33:06 UTC (rev 15109)
@@ -1436,7 +1436,7 @@
             }
 
             # URL: [    ]  Verify? [ ]
-            my $url_def = $form->{'oidurl'} || $oid_identity if defined $oid_identity;
+            my $url_def = defined $oid_identity ? ($form->{'oidurl'} || $oid_identity) : '';
 
             $ret .= "<tr valign='middle' align='left' id='oid_more'><td colspan='2'></td><td>";
             $ret .= "Identity URL: <input class='textbox' name='oidurl' maxlength='60' size='53' id='oidurl' value='$url_def' /> ";
@@ -1537,7 +1537,7 @@
             }
 
             # URL: [    ]  Verify? [ ]
-            my $url_def = $form->{'oidurl'} || $oid_identity if defined $oid_identity;
+            my $url_def = defined $oid_identity ? ($form->{'oidurl'} || $oid_identity) : '';
 
             $ret .= "<tr valign='middle' align='left' id='oid_more'><td colspan='2'></td><td>";
             $ret .= "Identity URL: <input class='textbox' name='oidurl' maxlength='60' size='53' id='oidurl' value='$url_def' /> ";

Modified: trunk/cgi-bin/weblib.pl
===================================================================
--- trunk/cgi-bin/weblib.pl	2009-04-08 04:33:18 UTC (rev 15108)
+++ trunk/cgi-bin/weblib.pl	2009-04-08 07:33:06 UTC (rev 15109)
@@ -893,7 +893,8 @@
     # Figure out their last post
     my $memkey = [$remote->{'userid'}, "lastcomm:$remote->{'userid'}"];
     my $memval = LJ::MemCache::get($memkey);
-    my ($jid, $talkid) = split(/:/, $memval) if $memval;
+    my ($jid, $talkid);
+    ($jid, $talkid) = split(/:/, $memval) if $memval;
 
     return ($talkid, $jid);
 }
@@ -2813,7 +2814,7 @@
 
     my $int_len = 0;
 
-    my @interest_list = $u->notable_interests(100) if $u;
+    my @interest_list = $u ? $u->notable_interests(100) : ();
 
     modify_interests_for_adcall(\%opts, \@interest_list);
 
@@ -3880,7 +3881,8 @@
     my $statusvis = $u->statusvis;
     return "" unless $statusvis =~ /^[LMO]$/;
 
-    my $statusvis_full = "locked" if $statusvis eq "L";
+    my $statusvis_full = "";
+    $statusvis_full = "locked" if $statusvis eq "L";
     $statusvis_full = "memorial" if $statusvis eq "M";
     $statusvis_full = "readonly" if $statusvis eq "O";
 

Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments