automation1Add my vote for this tag deployment1Add my vote for this tag create new tag
, view all tags


I want to create a simple perl script (myscript) which would in turn call two scripts (save and sendemail). This is required for me to have a single submit button on my topic which will allow the users to post a comment and also send a mail with a single click (instead of having to click once to post a comment and then click again to send a mail).

I created myscript with these contents:

#!c:/cygwin/bin/perl -wT
require "/twiki/bin/sendemail";
require "/twiki/bin/save";

The problem is that it executes just the sendmail script. If I interchange the second and third lines, then it executes just the save script.

I tried using the commands

#!c:/cygwin/bin/perl -w
system ("/usr/bin/perl -wT /twiki/bin/sendemail");
system ("/usr/bin/perl -wT /twiki/bin/save");

instead of 'require' but with the same results.

Can you please help me write myscript ?


TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Windows 2003
Web server: Apache 1.3.39
Perl version: 5.008008 (cygwin)
Client OS: Windows XP
Web Browser: IE 6
Categories: Plugins

-- ChengappaCB - 29 Jan 2008


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.

I solved it this way:

  • Save the script 'sendemail' under the name 'saveandsendemail'
  • Copy the following lines from the 'save' script to the 'saveandsendemail' script.
use TWiki::UI::Save;
TWiki::UI::run( \&TWiki::UI::Save::save, save => 1 );
  • Call the 'saveandsendemail' script to do the job.

The last lines of my 'saveandsendemail' script are:

use TWiki;
use TWiki::UI;
use TWiki::Plugins::SendEmailPlugin;
use TWiki::UI::Save;

my $query = new CGI;
$TWiki::Plugins::SESSION = new TWiki(undef, $query);
TWiki::UI::run( \&TWiki::Plugins::SendEmailPlugin::sendEmail );
TWiki::UI::run( \&TWiki::UI::Save::save, save => 1 );

-- ChengappaCB - 15 Feb 2008

Quite useful, thanks for sharing this with the TWiki community!

-- PeterThoeny - 23 Jan 2009

Change status to:
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2009-01-23 - 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-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.