fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2012-03-21 08:54 am

[dw-free] more undefined string development warnings

[commit: http://hg.dwscoalition.org/dw-free/rev/e17e214b4289]

http://bugs.dwscoalition.org/show_bug.cgi?id=4342

Fix various "Use of ininitialized value..." warnings.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/DW/Logic/ProfilePage.pm
  • cgi-bin/LJ/Feed.pm
--------------------------------------------------------------------------------
diff -r bd280e612ea4 -r e17e214b4289 cgi-bin/DW/Logic/ProfilePage.pm
--- a/cgi-bin/DW/Logic/ProfilePage.pm	Wed Mar 21 16:51:39 2012 +0800
+++ b/cgi-bin/DW/Logic/ProfilePage.pm	Wed Mar 21 16:55:34 2012 +0800
@@ -126,13 +126,14 @@
     my $userpic_obj = LJ::Userpic->get( $u, $u->{defaultpicid} );
     my $imgtag_conditional;
     if ( $userpic_obj ) {
-      $imgtag_conditional = $userpic_obj->imgtag;
+        $imgtag_conditional = $userpic_obj->imgtag;
     } else {
-      $imgtag_conditional = '<img src="' . $ret->{userpic} .
-                            '" height=' . $ret->{height} .
-                            ' width=' . $ret->{width} .
-                            ' alt="' . $ret->{alt_text} .
-                            '" />';
+        my $ret_userpic  = $ret->{userpic}  || '';
+        my $ret_height   = $ret->{height}   || '';
+        my $ret_width    = $ret->{width}    || '';
+        my $ret_alt_text = $ret->{alt_text} || '';
+
+        $imgtag_conditional = qq{<img src="$ret_userpic" height=$ret_height width=$ret_width alt="$ret_alt_text" />};
     }
 
 
@@ -520,9 +521,9 @@
     my ( $membership, $postlevel ) = $u->get_comm_settings;
 
     my $membership_string = LJ::Lang::ml( '.commsettings.membership.open' );
-    if ( $membership eq "moderated" ) {
+    if ( $membership && $membership eq "moderated" ) {
         $membership_string = LJ::Lang::ml( '.commsettings.membership.moderated' );
-    } elsif ( $membership eq "closed" ) {
+    } elsif ( $membership && $membership eq "closed" ) {
         $membership_string = LJ::Lang::ml( '.commsettings.membership.closed' );
     }
 
@@ -546,7 +547,7 @@
     my ( $membership, $postlevel ) = $u->get_comm_settings;
 
     my $postlevel_string = LJ::Lang::ml( '.commsettings.postlevel.members' );
-    if ( $postlevel eq "select" ) {
+    if ( $postlevel && $postlevel eq "select" ) {
         $postlevel_string = LJ::Lang::ml( '.commsettings.postlevel.select' );
     } elsif ( $u->prop( 'nonmember_posting' ) ) {
         $postlevel_string = LJ::Lang::ml( '.commsettings.postlevel.anybody' );
diff -r bd280e612ea4 -r e17e214b4289 cgi-bin/LJ/Feed.pm
--- a/cgi-bin/LJ/Feed.pm	Wed Mar 21 16:51:39 2012 +0800
+++ b/cgi-bin/LJ/Feed.pm	Wed Mar 21 16:55:34 2012 +0800
@@ -309,11 +309,12 @@
 sub _init_talkview {
     my ( $journalinfo, $u, $opts, $talkview ) = @_;
     my $hubbub = $talkview eq 'rss' && LJ::is_enabled( 'hubbub' );
+    my $bot_director = LJ::Hooks::run_hook( "bot_director", "<!-- ", " -->" ) || '';
     my $ret;
 
     # header
     $ret .= "<?xml version='1.0' encoding='$opts->{'saycharset'}' ?>\n";
-    $ret .= LJ::Hooks::run_hook("bot_director", "<!-- ", " -->") . "\n";
+    $ret .= "$bot_director\n";
     $ret .= "<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' " .
             "xmlns:atom10='http://www.w3.org/2005/Atom'>\n";
 
@@ -444,13 +445,14 @@
     unless ($opts->{'single_entry'}) {
         $feed = XML::Atom::Feed->new( Version => 1 );
         $xml  = $feed->elem->ownerDocument;
+        my $bot_director = LJ::Hooks::run_hook("bot_director") || '';
 
         if ($u->should_block_robots) {
             _add_feed_namespace( $feed, "idx", "urn:atom-extension:indexing" );
             $xml->getDocumentElement->setAttribute( "idx:index", "no" );
         }
 
-        $xml->insertBefore( $xml->createComment( LJ::Hooks::run_hook("bot_director") ), $xml->documentElement());
+        $xml->insertBefore( $xml->createComment( $bot_director ), $xml->documentElement() );
 
         # attributes
         $feed->id( $u->atomid );
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org