Question
Hi,
I had a problem performing save due to an error saying "Can't call method 'Get' on an undefined value". My TWiki-Version is TWiki-4.2.0, Tue, 22 Jan 2008, build 16278. Suddenly the error occured after we were able to create about 45 topics without problems. The problem only occured when I tried to create new topic using my
TWikiForm and the generation of unique topic names using
TopicXXXXXXXXXX. Creating a simple topic and saving it worked without problems. Restarting the apache does not help.
I modified the Save.pm a little and the error does not occur any more. My question is, whether my modification is allright.
Here is what I've done: In the apache - error log I saw that the error was raised in Save.pm in line 257:
[Mon Aug 04 08:41:57 2008] [error] [client 10.129.43.88] Can't call method "get" on an undefined value at /srv/www/htdocs/twiki/lib/TWiki/UI/Save.pm line 257., referer:
http://borgsapp01.hg.fresenius.de/twiki
/bin/edit.pl
The original line 257 in Save.pm:
my $pti = $prevMeta->get( 'TOPICINFO' );
It seemed that $prevMeta is not defined. So to fix it, I added for following code (see lines below #JR 04.08.2008...).
Line 257 in Save.pm after modification:
#JR 04.08.2008: Added check if $prevMeta is defined. Otherwise error message "Can't call method "get" on an undefined value" occurs
if ( $prevMeta ) {
my $pti = $prevMeta->get( 'TOPICINFO' ); ...
...
if( $formDef && $prevMeta ) { $newMeta->merge( $prevMeta, $formDef ); }
$merged = [ $orev, $author, $rev||1 ];
#JR 04.08.2008: End of modification
}
Environment
--
TWikiGuest - 04 Aug 2008
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
Thanks, probably best tracked as a bug item.
--
PeterThoeny - 06 Nov 2008