Tags:
create new tag
view all tags

SID-01374: Uninitialized value error when running save in command line

Status: Answered Answered TWiki version: 5.1.0 Perl version: 5.12.3
Category: CategoryError Server OS: Solaris Last update: 14 years ago

Dear TWiki Support,

We were trying to create a topic from command line using "save", following the description on TWikiScripts. However we got the following error:

-bash-4.1# ./save -topic Sandbox.MyTopic2 -user admin -action save -text "New text of the topic"
[Wed Jan 11 11:45:29 2012] save: Use of uninitialized value in lc at /import/pae-www/twiki/lib/TWiki/UI/Save.pm line 469.
[Wed Jan 11 11:45:29 2012] save: Use of uninitialized value $reqmethod in pattern match (m//) at /import/pae-www/twiki/lib/TWiki/UI/Save.pm line 56.
-bash-4.1#

And the topic "MyTopic2" is not created. We tried to run the script with user "root" as well as the webserver user "webservd". Results are the same.

In the browser, "save" action does not have any problem.

Is it the problem of the command itself, or the problem of TWiki/Perl installation? If the aforementioned method does not work, are there any alternative ways to create/modify a topic from command line?

Any suggestions are greatly appreciated. Thank you in advance,

-- GuangyuShi - 2012-01-11

Discussion and Answer

This is a bug. Please file a bug report at TWikibug:WebHome.

This fixes the issue:

--- TWiki/UI/Save.pm.save1   2011-08-20 21:03:51.000000000 -0700
+++ TWiki/UI/Save.pm   2012-01-11 14:06:22.000000000 -0800
@@ -53,8 +53,8 @@
     my $revision = $query->param( 'rev' ) || undef;
     my $reqmethod = $query->request_method();
 
-    if( $reqmethod !~ /^POST$/i ) {
-        # save can only be called via POST method
+    if( $reqmethod && $reqmethod !~ /^POST$/i ) {
+        # save can only be called via POST method or command line
         throw TWiki::OopsException(
             'attention',
             def => 'post_method_only',

-- PeterThoeny - 2012-01-11

Thanks, Peter. A bug report has been filed (Item6830).

Your fix is valid and now we are able to create and modify topics in command line. However, the first error is still there: "save: Use of uninitialized value in lc at /import/pae-www/twiki/lib/TWiki/UI/Save.pm line 469."

Do you know what it will affect? Is it possible to fix it as well, or shall we just ignore it?

Thanks.

-- GuangyuShi - 2012-01-11

Not really an error, can be ignored. Untested fix: Change line 468:

my $editaction = lc($query->param( 'editaction' )) || '';

to this:

my $editaction = lc( $query->param( 'editaction' ) || '' );

-- PeterThoeny - 2012-01-11

This is now fixed in SVN trunk and 5.1 branch, see TWikibug:Item6830.

-- PeterThoeny - 2012-01-12

      Change status to:
ALERT! 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.
SupportForm
Status Answered
Title Uninitialized value error when running save in command line
SupportCategory CategoryError
TWiki version 5.1.0
Server OS Solaris
Web server Sun One Webserver
Perl version 5.12.3
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2012-01-12 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.