Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[livejournal] r19085: LJSUP-8849 (get rid of 'my if'-like cons...

Committer: ailyin
LJSUP-8849 (get rid of 'my if'-like constructs in cgi-bin)
U   trunk/cgi-bin/LJ/Browse.pm
U   trunk/cgi-bin/LJ/Message.pm
U   trunk/cgi-bin/LJ/S2.pm
U   trunk/cgi-bin/LJ/Setting/ImagePlaceholders.pm
U   trunk/cgi-bin/LJ/Widget/Location.pm
U   trunk/cgi-bin/LJ/Widget/TopUsers.pm
U   trunk/cgi-bin/htmlcontrols.pl
U   trunk/cgi-bin/ljlang.pl
Modified: trunk/cgi-bin/LJ/Browse.pm
===================================================================
--- trunk/cgi-bin/LJ/Browse.pm	2011-05-19 06:45:59 UTC (rev 19084)
+++ trunk/cgi-bin/LJ/Browse.pm	2011-05-19 07:44:35 UTC (rev 19085)
@@ -1246,7 +1246,9 @@
     # need a user object for submitter
     croak "invalid user object[u]" unless LJ::isu($u);
     # need a category
-    my $cat = LJ::Browse->load_by_id($catid) if (defined $catid);
+    my $cat = undef;
+    $cat = LJ::Browse->load_by_id($catid) if defined $catid;
+
     die "invalid category" unless $cat;
 
     return if ($class->_is_community_in_pending($c->userid, $cat->catid));
@@ -1276,8 +1278,11 @@
     croak "invalid user object[c]" unless LJ::isu($c);
     # need a user object for moderator
     croak "invalid user object[u]" unless LJ::isu($mod);
+
     # need a category
-    my $cat = LJ::Browse->load_by_id($catid) if (defined $catid) ;
+    my $cat = undef;
+    $cat = LJ::Browse->load_by_id($catid) if defined $catid;
+
     die "invalid category" unless $cat;
 
     my $dbh = LJ::get_db_writer()

Modified: trunk/cgi-bin/LJ/Message.pm
===================================================================
--- trunk/cgi-bin/LJ/Message.pm	2011-05-19 06:45:59 UTC (rev 19084)
+++ trunk/cgi-bin/LJ/Message.pm	2011-05-19 07:44:35 UTC (rev 19085)
@@ -91,8 +91,10 @@
 
     # Begin DB Transaction
     my $o_rv = $orig_u->begin_work;
-    my $r_rv = $rcpt_u->begin_work unless $same_cluster;
 
+    my $r_rv = undef;
+    $r_rv = $rcpt_u->begin_work unless $same_cluster;
+
     # Write to DB
     my $orig_write = $self->_save_sender_message;
     my $rcpt_write = $self->_save_recipient_message;

Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm	2011-05-19 06:45:59 UTC (rev 19084)
+++ trunk/cgi-bin/LJ/S2.pm	2011-05-19 07:44:35 UTC (rev 19085)
@@ -2025,8 +2025,11 @@
     my $linklist = [ map { UserLink($_) } @$linkobj ];
 
     my $remote = LJ::get_remote();
-    my $up = LJ::load_userid($opts->{ljentry}->{posterid}) if $opts->{ljentry};
 
+    my $up = undef;
+    $up = LJ::load_userid($opts->{ljentry}->{posterid})
+        if $opts->{ljentry};
+
     my $p = {
         '_type' => 'Page',
         '_u' => $u,

Modified: trunk/cgi-bin/LJ/Setting/ImagePlaceholders.pm
===================================================================
--- trunk/cgi-bin/LJ/Setting/ImagePlaceholders.pm	2011-05-19 06:45:59 UTC (rev 19084)
+++ trunk/cgi-bin/LJ/Setting/ImagePlaceholders.pm	2011-05-19 07:44:35 UTC (rev 19085)
@@ -35,7 +35,8 @@
     my $is_stock = grep { $imgplaceholders eq $_ }
                     (qw/320|240 640|480 0|0/, ''); # standard sizes
 
-    my $extra = $class->ml('setting.imageplaceholders.option.select.custom', { width => $maxwidth, height => $maxheight })
+    my $extra = undef;
+    $extra = $class->ml('setting.imageplaceholders.option.select.custom', { width => $maxwidth, height => $maxheight })
         unless $is_stock;
 
     my @options = (

Modified: trunk/cgi-bin/LJ/Widget/Location.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/Location.pm	2011-05-19 06:45:59 UTC (rev 19084)
+++ trunk/cgi-bin/LJ/Widget/Location.pm	2011-05-19 07:44:35 UTC (rev 19085)
@@ -44,7 +44,8 @@
     # check if specified country has regions
     my $regions_cfg = $class->country_regions_cfg($effective_country);
     # hashref of all regions for the specified country; it is initialized and used only if $regions_cfg is defined, i.e. the country has regions (states)
-    my $state_options = $class->region_options($regions_cfg)
+    my $state_options = undef;
+    $state_options = $class->region_options($regions_cfg)
         if $regions_cfg;
 
 
@@ -227,8 +228,10 @@
     $post->{zip} = "" if $post->{zip} eq $zip_inline_desc;
 
     # state and zip
-    my ($zipcity, $zipstate) = LJ::load_state_city_for_zip($post->{'zip'})
-        if $post->{'country'} eq "US" && length $post->{'zip'} > 0;
+    my ($zipcity, $zipstate);
+    if ( $post->{'country'} eq "US" && length $post->{'zip'} > 0 ) {
+        ($zipcity, $zipstate) = LJ::load_state_city_for_zip($post->{'zip'});
+    }
 
     # country
     if ($post->{'country'} ne "US" && $post->{'zip'}) {

Modified: trunk/cgi-bin/LJ/Widget/TopUsers.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/TopUsers.pm	2011-05-19 06:45:59 UTC (rev 19084)
+++ trunk/cgi-bin/LJ/Widget/TopUsers.pm	2011-05-19 07:44:35 UTC (rev 19085)
@@ -44,7 +44,10 @@
         foreach (@$data) {
             my $count = $_->{count};
             my $user  = LJ::load_userid($_->{userid});
-            my $userpic = $user->userpic() if $user;
+
+            my $userpic = undef;
+            $userpic = $user->userpic() if $user;
+
             warn "Cannot load user with id=$_->{userid}\n" unless $user;
             warn "Cannot load userpic with id=$_->{userid}\n" unless $userpic;
 

Modified: trunk/cgi-bin/htmlcontrols.pl
===================================================================
--- trunk/cgi-bin/htmlcontrols.pl	2011-05-19 06:45:59 UTC (rev 19084)
+++ trunk/cgi-bin/htmlcontrols.pl	2011-05-19 07:44:35 UTC (rev 19085)
@@ -122,7 +122,8 @@
     $ret .= ">\n";
 
     # build hashref from arrayref if multiple selected
-    my $selref = { map { $_, 1 } @{$opts->{'selected'}} }
+    my $selref = undef;
+    $selref = { map { $_, 1 } @{$opts->{'selected'}} }
         if $opts->{'multiple'} && ref $opts->{'selected'} eq 'ARRAY';
 
     my $did_sel = 0;

Modified: trunk/cgi-bin/ljlang.pl
===================================================================
--- trunk/cgi-bin/ljlang.pl	2011-05-19 06:45:59 UTC (rev 19084)
+++ trunk/cgi-bin/ljlang.pl	2011-05-19 07:44:35 UTC (rev 19085)
@@ -647,7 +647,8 @@
     my %memkeys; 
     foreach my $code (keys %lc_codes) {
         my $cache_key = "ml.${lang}.${dmid}.${code}";
-        my $text = $TXT_CACHE{$cache_key} unless $LJ::NO_ML_CACHE;
+        my $text = undef;
+        $text = $TXT_CACHE{$cache_key} unless $LJ::NO_ML_CACHE;
         
         if (defined $text) {
             $strings{ $lc_codes{$code} } = $text;

Tags: andy, livejournal, pl, pm
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