fix uninitialized value warnings
authorJoey Hess <joey@gnu.kitenet.net>
Fri, 23 Jan 2009 01:58:49 +0000 (20:58 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Fri, 23 Jan 2009 01:58:49 +0000 (20:58 -0500)
I suspect these are only triggered by spammers.

IkiWiki/Plugin/comments.pm

index 833bedf25dcbad59a6f1dc3faed0f5c764b03db9..6d0e45a97d29f49569f306b616aada1183f36510 100644 (file)
@@ -406,19 +406,19 @@ sub sessioncgi ($$) {
 
        if ($config{comments_allowauthor}) {
                my $author = $form->field('author');
-               if (length $author) {
+               if (defined $author && length $author) {
                        $author =~ s/"/&quot;/g;
                        $content .= " claimedauthor=\"$author\"\n";
                }
                my $url = $form->field('url');
-               if (length $url) {
+               if (defined $url && length $url) {
                        $url =~ s/"/&quot;/g;
                        $content .= " url=\"$url\"\n";
                }
        }
 
        my $subject = $form->field('subject');
-       if (length $subject) {
+       if (defined $subject && length $subject) {
                $subject =~ s/"/&quot;/g;
                $content .= " subject=\"$subject\"\n";
        }