Tags:
development1Add my vote for this tag create new tag
, view all tags

PerlSamplePlugin

Execute and format nicely some Perl code embedded in a TWiki page, showing STDOUT and STDERR outputs

Introduction

This plugin executes and nicely formats a piece of Perl code, together with its STDOUT and STDERR outputs. To avoid improper usage it executes the Perl code in a CPAN:Safe compartment.

Syntax Rules

Enclose Perl code in %PERLSAMPLE{ and }%.

Usage Example

You type: You get: If correctly installed:
%PERLSAMPLE{
print "hello world!";
}% 
code return
1
print "hello world!";
stdout stderr
 1: hello world! 
 
%PERLSAMPLE{print "hello world!";}%

To-Do

  • Apply a timeout to the perl execution (spawn a delayed kill process)
  • Limit the output size (disk quota?)
  • Use a random generated file for the output/stderr

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %PERLSAMPLEPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Execute and format nicely some Perl code embedded in a TWiki page, showing STDOUT and STDERR outputs

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the TWiki server.

  • Install the CPAN:Safe Perl module (see http://www.cpan.org)
  • Make sure that bin/perl_stdout.tmp and bin/perl_stderr.tmp are writable by the Apache user
  • Download the ZIP file from the Plugin Home (see below)
  • Unzip PerlSamplePlugin.zip in your twiki installation directory. Content:
    File: Description:
    data/TWiki/PerlSamplePlugin.txt Plugin topic
    lib/TWiki/Plugins/PerlSamplePlugin.pm Plugin Perl module
  • Configure the plugin:
    • Run the configure script to enable the plugin
  • Test if the installation was successful:
    • See above example

Plugin Info

Plugin Author: TWiki:Main.AndreaSterbini and TWiki:Main.FrancoBagnoli
Copyright: © 2000-2001 TWiki:Main.FrancoBagnoli
© 2007-2011 TWiki:TWiki.TWikiContributor
License: GPL (GNU General Public License)
Plugin Version: 2011-01-25 (V1.1)
Change History:  
2011-01-25: TWikibug:Item6638: Doc improvements; XHTML fixes -- TWiki:Main.PeterThoeny
2001-11-27: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.1
CPAN Dependencies: CPAN:Safe
Other Dependencies: none
Perl Version: 5.005
Benchmarks: GoodStyle nn%, FormattedSearch nn%, PerlSamplePlugin nn%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/PerlSamplePlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/PerlSamplePluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/PerlSamplePluginAppraisal

Related Topics: TWikiPlugins, DeveloperDocumentationCategory, AdminDocumentationCategory, TWikiPreferences

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatmd5 PerlSamplePlugin.md5 r4 r3 r2 r1 manage 0.2 K 2011-01-25 - 08:15 PeterThoeny  
Compressed Zip archivetgz PerlSamplePlugin.tgz r4 r3 r2 r1 manage 4.6 K 2011-01-25 - 08:15 PeterThoeny  
Compressed Zip archivezip PerlSamplePlugin.zip r5 r4 r3 r2 r1 manage 6.2 K 2011-01-25 - 08:15 PeterThoeny  
Unknown file formatEXT PerlSamplePlugin_installer r3 r2 r1 manage 3.4 K 2011-01-25 - 08:15 PeterThoeny  
Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r11 - 2013-10-16 - 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-2016 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.