Tags:
create new tag
view all tags

SID-01492: Calling TWiki::Func functions from outside of TWiki

Status: Answered Answered TWiki version: 5.1.1 Perl version: Perl 5.10.1 from OpenCSW
Category: CategoryAPI Server OS: Oracle Solaris 10, 8/11 u10 Last update: 13 years ago

Hi,

Is there any way I can call functions in the TWikiFuncDotPm class from an external script? In particular, some seem to require a session variable (ie. TWiki::Func::getTopicList), and I can't see how to call that function from a script that's run outside of TWiki, ie. via cron job on the server.

Thanks!

- John

-- JohnIRoberts - 2012-06-25

Discussion and Answer

You need to initialize the command line script properly. Study twiki/bin/statistics which runs in CLI (command line interface) and CGI mode. The action of the script is done by module TWiki/UI/Statistics.pm.

There is one detail you need to take care of: You need to tie the script to the module. In the statistics case it is defined in TWiki/UI.pm:

    $TWiki::cfg{SwitchBoard}{statistics} =
      [ 'TWiki::UI::Statistics', 'statistics',    { statistics  => 1 } ];

For your own script you can define this in your own script before you call $TWiki::engine->run();

-- PeterThoeny - 2012-06-26

Ah excellent, I've got it working now. Thank you very much!

-- JohnIRoberts - 2012-06-26

Good. Please consider contributing code back to the community. You could package this as an add-on, see AddOnPackageHowTo.

-- PeterThoeny - 2012-06-26

      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 Calling TWiki::Func functions from outside of TWiki
SupportCategory CategoryAPI
TWiki version 5.1.1
Server OS Oracle Solaris 10, 8/11 u10
Web server Apache 2.2.22 from OpenCSW
Perl version Perl 5.10.1 from OpenCSW
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2012-06-26 - 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.