vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

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

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

U   trunk/htdocs/manage/pubkey.bml
U   trunk/htdocs/misc/latestqotd.bml
U   trunk/htdocs/styles/browse/styleinfo.bml
U   trunk/htdocs/styles/create_do.bml
U   trunk/htdocs/styles/edit_do.bml
U   trunk/htdocs/support/faqbrowse.bml
U   trunk/htdocs/support/history.bml
U   trunk/htdocs/support/see_request.bml
U   trunk/htdocs/tools/friendlist.bml
U   trunk/htdocs/update.bml
U   trunk/htdocs/userinfo.bml
U   trunk/htdocs/userinfo2.bml
U   trunk/htdocs/userinfo_2008.bml
Modified: trunk/htdocs/manage/pubkey.bml
===================================================================
--- trunk/htdocs/manage/pubkey.bml	2009-04-08 07:39:27 UTC (rev 15111)
+++ trunk/htdocs/manage/pubkey.bml	2009-04-08 07:46:08 UTC (rev 15112)
@@ -29,9 +29,9 @@
 
         # pull key data, return if suspicious
         my $ks = "$kt KEY BLOCK";
-        my $data = $1 if $key =~ /$ks-{5}(.+?)-{5}.+?$ks(?:-)+/s;
+        my ($data) = $key =~ /$ks-{5}(.+?)-{5}.+?$ks(?:-)+/s;
         foreach ($data =~ /^(\w+):/mg) {
-            return 0 unless $1 =~ /(Version|Hash|Comment|MessageID|Charset)/i;
+            return 0 unless $_ =~ /(Version|Hash|Comment|MessageID|Charset)/i;
         }
         $data =~ s/^(\s|\w+:).*//mg;
         $data =~ s/(?:\r)?\n//sg;

Modified: trunk/htdocs/misc/latestqotd.bml
===================================================================
--- trunk/htdocs/misc/latestqotd.bml	2009-04-08 07:39:27 UTC (rev 15111)
+++ trunk/htdocs/misc/latestqotd.bml	2009-04-08 07:46:08 UTC (rev 15112)
@@ -11,8 +11,8 @@
 
     my $ret;
 
-    my $qid = $GET{qid}+0;
-    my $qotd = LJ::QotD->get_single_question($qid) if $qid;
+    my $qid  = int $GET{qid};
+    my $qotd = $qid ? LJ::QotD->get_single_question($qid) : undef;
 
     $ret .= "<table width='100%' cellspacing='5' cellpadding='0'><tr><td valign='top'>";
     $ret .= LJ::Widget::QotDResponses->render;

Modified: trunk/htdocs/styles/browse/styleinfo.bml
===================================================================
--- trunk/htdocs/styles/browse/styleinfo.bml	2009-04-08 07:39:27 UTC (rev 15111)
+++ trunk/htdocs/styles/browse/styleinfo.bml	2009-04-08 07:46:08 UTC (rev 15112)
@@ -4,7 +4,7 @@
  my $remote = LJ::get_remote();
 
  my $sty = LJ::S1::get_style($styleid); 
- my $styu = LJ::load_user($sty->{user}) if $sty; # if $sty so we don't auto-vivify!
+ my $styu = $sty ? LJ::load_user($sty->{user}) : undef; # if $sty so we don't auto-vivify!
  return "Style $styleid does not exist or is not public."
     unless $sty && 
           ($sty->{is_public} eq 'Y' ||       # straight up public

Modified: trunk/htdocs/styles/create_do.bml
===================================================================
--- trunk/htdocs/styles/create_do.bml	2009-04-08 07:39:27 UTC (rev 15111)
+++ trunk/htdocs/styles/create_do.bml	2009-04-08 07:46:08 UTC (rev 15112)
@@ -63,7 +63,8 @@
 
     # closure to show edit form
     my $editform = sub {
-        my $getextra = "?authas=$authas" if $u->{'user'} ne $remote->{'user'};
+        my $getextra = "";
+        $getextra = "?authas=$authas" if $u->{'user'} ne $remote->{'user'};
         return "<div align='center'><form method='post' action='$LJ::SITEROOT/styles/edit_do.bml$getextra'>\n" .
                LJ::form_auth() ."\n" .
                LJ::html_hidden('mode', 'editstyle', 'styleid', $_[0]) . "\n" .

Modified: trunk/htdocs/styles/edit_do.bml
===================================================================
--- trunk/htdocs/styles/edit_do.bml	2009-04-08 07:39:27 UTC (rev 15111)
+++ trunk/htdocs/styles/edit_do.bml	2009-04-08 07:46:08 UTC (rev 15112)
@@ -84,7 +84,7 @@
 
     my $ret = "";
     # pass authas arguments in forms if necessary
-    my $getextra = "?authas=$authas" if $authas ne $remote->{'user'};
+    my $getextra = $authas ne $remote->{'user'} ? "?authas=$authas" : '';
 
     # delete confirmation
     if ($mode eq "delete") {
@@ -119,7 +119,7 @@
         $ret .= "<tr><td bgcolor='#d0d0d0'><b>$ML{'.edit.col.type'}</b></td><td><i>$LJ::viewinfo{$style->{'type'}}->{'des'}</i> -- <b>$style->{'type'}</b></td></tr>\n";
         $ret .= "<tr><td bgcolor='#d0d0d0'><b>$ML{'.edit.col.styleid'}</b></td><td><b>$style->{'styleid'}</b>";
 
-        my $extravars = "&nocache=1" if $style->{'opt_cache'} eq "Y";
+        my $extravars = $style->{'opt_cache'} eq "Y" ? "&nocache=1" : '';
         if ($style->{'type'} eq 'day') {
             my ($curmday, $curmon, $curyear) = (localtime(time))[3..5]; 
             $extravars .= sprintf("&day=%02d&month=%02d&year=%04d",

Modified: trunk/htdocs/support/faqbrowse.bml
===================================================================
--- trunk/htdocs/support/faqbrowse.bml	2009-04-08 07:39:27 UTC (rev 15111)
+++ trunk/htdocs/support/faqbrowse.bml	2009-04-08 07:46:08 UTC (rev 15112)
@@ -160,7 +160,7 @@
         $$body .= "<br />";
 
         if ($mode eq 'summary' && $f->has_summary) {
-            my $q = "&q=" . LJ::eurl($qterm) if $qterm;
+            my $q = $qterm ? "&q=" . LJ::eurl($qterm) : '';
 
             $$body .= "<div id='rm' name='rm'>";
             my $oc = $faqcatarg ? '' : "onclick='return showAnswer();'";

Modified: trunk/htdocs/support/history.bml
===================================================================
--- trunk/htdocs/support/history.bml	2009-04-08 07:39:27 UTC (rev 15111)
+++ trunk/htdocs/support/history.bml	2009-04-08 07:46:08 UTC (rev 15112)
@@ -67,7 +67,7 @@
                 };
                 push @userids, $row->[4] if $row->[4];
             }
-            my $us = LJ::load_userids(@userids) if @userids;
+            my $us = LJ::load_userids(@userids);
 
             # get categories
             my $cats = LJ::Support::load_cats();

Modified: trunk/htdocs/support/see_request.bml
===================================================================
--- trunk/htdocs/support/see_request.bml	2009-04-08 07:39:27 UTC (rev 15111)
+++ trunk/htdocs/support/see_request.bml	2009-04-08 07:46:08 UTC (rev 15112)
@@ -191,9 +191,11 @@
         if ($foundspid) {
             return BML::redirect("see_request.bml?id=$foundspid");
         } else {
-            my $goback = BML::ml('.goback.text', {request_link=>"href='see_request.bml?id=$spid'", spid=>$spid}) if $sp;
+            my $goback = ''; 
+            $goback = BML::ml('.goback.text', {request_link=>"href='see_request.bml?id=$spid'", spid=>$spid}) if $sp;
             my $what = $find eq 'next' || $find eq 'cnext' ? $ML{'.next'} : $ML{'.previous'};
-            my $cat = $ML{'.incat'}  if $find eq 'cnext' || $find eq 'cprev';
+            my $cat = '';
+            $cat = $ML{'.incat'} if $find eq 'cnext' or $find eq 'cprev';
             return "<?h1 $ML{'.error'} h1?>".BML::ml('.error.text2', {what=>$what, cat=>$cat})." $goback";
         }
     }
@@ -330,7 +332,7 @@
                     "$ename <a href=\"history.bml?user=$u->{user}\">" . LJ::ehtml($u->{name}) . "</a>" :
                     "$ename";
 
-            my $email_string = " ($visemail)" if $has_vs || $has_sh;
+            my $email_string = ($has_vs or $has_sh) ? " ($visemail)" : '';
             $email_string = " (<a href=\"history.bml?email=" . LJ::eurl($email) . "\">$email</a>)" if $show_history{email};
             $ret .= $email_string;
         } else {

Modified: trunk/htdocs/tools/friendlist.bml
===================================================================
--- trunk/htdocs/tools/friendlist.bml	2009-04-08 07:39:27 UTC (rev 15111)
+++ trunk/htdocs/tools/friendlist.bml	2009-04-08 07:46:08 UTC (rev 15112)
@@ -56,7 +56,7 @@
     $type =~ s/^[^ripsync]+$//i;
     my %types = map { $_ => 1 } split(//, $type);
 
-    my %remote_friend_uids = map { $_ => 1 } $remote->friend_uids if $remote;
+    my %remote_friend_uids = $remote ? (map { $_ => 1 } $remote->friend_uids) : ();
     my $show_mutual_friends = $remote && (!$remote->equals($u) || $of) ? 1 : 0;
 
     if ($u->is_community) {

Modified: trunk/htdocs/update.bml
===================================================================
--- trunk/htdocs/update.bml	2009-04-08 07:39:27 UTC (rev 15111)
+++ trunk/htdocs/update.bml	2009-04-08 07:46:08 UTC (rev 15112)
@@ -100,7 +100,7 @@
 
     # if a QotD id was passed in, fill in the fields with that QotD
     my $qid = $GET{qotd}+0;
-    my $qotd = LJ::QotD->get_single_question($qid) if $qid;
+    my $qotd = $qid ? LJ::QotD->get_single_question($qid) : '';
     if ($qotd) {
         $subject = LJ::Widget::QotD->subject_text($qotd, user => $remote);
         $event = LJ::Widget::QotD->embed_text($qotd);

Modified: trunk/htdocs/userinfo.bml
===================================================================
--- trunk/htdocs/userinfo.bml	2009-04-08 07:39:27 UTC (rev 15111)
+++ trunk/htdocs/userinfo.bml	2009-04-08 07:46:08 UTC (rev 15112)
@@ -368,7 +368,7 @@
     }
 
     ### Username
-    my $new_margin = " style='margin-right: 320px;'" if $boxad;
+    my $new_margin = $boxad ? " style='margin-right: 320px;'" : '';
     $body .= "<div class='username'$new_margin>" . $u->ljuser_display;
     if ($u->{public_key}) {
         $body .= " <a href='$LJ::SITEROOT/pubkey.bml?user=$user'>";
@@ -504,7 +504,7 @@
     $body .= "</div>";
 
     ### User Details
-    my $new_width = " style='width: 45%;'" if $boxad;
+    my $new_width = $boxad ? " style='width: 45%;'" : '';
     $body .= "<div class='user_details'$new_width>";
 
     # picture
@@ -550,7 +550,7 @@
 
     # journal titles
     my $title = $u->{journaltitle} ? LJ::ehtml($u->{journaltitle}) : BML::ml('.details.title', { user => $u->display_username });
-    my $subtitle = LJ::ehtml($u->{journalsubtitle}) if $u->{journalsubtitle};
+    my $subtitle = $u->{journalsubtitle} ?  LJ::ehtml($u->{journalsubtitle}) : '';
     $body .= "<div class='details_journal'>";
     $body .= "<p class='journal_title'>$title</p>";
     $body .= "<p class='journal_subtitle'>$subtitle</p>" if $subtitle;

Modified: trunk/htdocs/userinfo2.bml
===================================================================
--- trunk/htdocs/userinfo2.bml	2009-04-08 07:39:27 UTC (rev 15111)
+++ trunk/htdocs/userinfo2.bml	2009-04-08 07:46:08 UTC (rev 15112)
@@ -950,7 +950,8 @@
      my $count = my $incommon = 0;
      my $userlist = "";
      foreach (@$users) {
-         my $nofollow = " rel='nofollow'" if ($dontfollow && !$remote_friendid{$_->{'userid'}});
+         my $nofollow = "";
+         $nofollow = " rel='nofollow'" if ($dontfollow && !$remote_friendid{$_->{'userid'}});
          my $ulink = "<a$nofollow href='" . $_->profile_url() . "'>$_->{'user'}</a>";
          if ( $hilite_common && $remote_friendid{$_->{'userid'}} ) {
              $ulink = "<span class='incommon'>$ulink</span>";

Modified: trunk/htdocs/userinfo_2008.bml
===================================================================
--- trunk/htdocs/userinfo_2008.bml	2009-04-08 07:39:27 UTC (rev 15111)
+++ trunk/htdocs/userinfo_2008.bml	2009-04-08 07:46:08 UTC (rev 15112)
@@ -551,7 +551,8 @@
     # Left Section
     {
         my $title = $u->{journaltitle} ? LJ::ehtml($u->{journaltitle}) : BML::ml('.details.title', { user => $u->display_username });
-        my $subtitle = LJ::ehtml($u->{journalsubtitle}) if $u->{journalsubtitle};
+        my $subtitle = "";
+        $subtitle = LJ::ehtml($u->{journalsubtitle}) if $u->{journalsubtitle};
 
         $body .= "<div class='details_left'>";
         $body .= "<p class='journal_title'>$title</p>";
@@ -682,7 +683,7 @@
     }
     # End Box Ad
 
-    my $extra_section_class = " firsttwo" if $boxad;
+    my $extra_section_class = $boxad ? " firsttwo" : '';
 
     my $html_by_journal;
     LJ::run_hook("userinfo_html_by_journal", { ret => \$html_by_journal, u => $u, extra_section_class => $extra_section_class, with_header => 1 });

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