Roxen.git / server / modules / scripting / perl.pike

version» Context lines:

Roxen.git/server/modules/scripting/perl.pike:7:      //<locale-token project="mod_perl">LOCALE</locale-token>   // USE_DEFERRED_LOCALE;   #define LOCALE(X,Y) _DEF_LOCALE("mod_perl",X,Y)      #include <module.h>   inherit "module";   inherit "roxenlib";      string cvs_version = -  "$Id: perl.pike,v 2.25 2004/06/30 16:59:20 mast Exp $"; +  "$Id: perl.pike,v 2.26 2008/08/15 12:33:55 mast Exp $";      constant module_type = MODULE_FILE_EXTENSION | MODULE_TAG;      constant module_name = "Scripting: Perl support";   constant module_doc =    "This module provides a faster way of running Perl scripts with Roxen. "    "The module also optionally provides a &lt;perl&gt;..&lt;/perl&gt; "    "container (and a corresponding processing instruction &lt;?perl ... "    "?&gt;) to run Perl code from inside RXML pages.";    - static string recent_error = 0; - static int parsed_tags = 0, script_calls = 0, script_errors = 0; + protected string recent_error = 0; + protected int parsed_tags = 0, script_calls = 0, script_errors = 0;    - static mapping handler_settings = ([ ]); + protected mapping handler_settings = ([ ]);    - static int cache_output; + protected int cache_output;    - static string script_output_mode; + protected string script_output_mode;      constant thread_safe = 1;      #ifdef THREADS - static object mutex = Thread.Mutex(); + protected object mutex = Thread.Mutex();   #endif      void create()   {    defvar("extensions", ({ "pl", "perl" }),    LOCALE(1,"Extensions"), TYPE_STRING_LIST,    LOCALE(2,"List of URL extensions that indicate that the document "    "is a Perl script."));      #if 0
Roxen.git/server/modules/scripting/perl.pike:137:    s += "found: " + query("helper")+" <br />\n";    else    s += "not found.<br />\n";       if (recent_error)    s += "<b>Most recent error</b>: " + recent_error + " <br />\n";       return s;   }    - static object gethandler() + protected object gethandler()   { return ExtScript.getscripthandler(query("helper"),    query("parallel"), handler_settings);   }    - static void fix_settings() + protected void fix_settings()   {    string u, g;    mapping s = ([ ]);      #if constant(getpwnam)    if (sscanf(query("identity"), "%s:%s", u, g) == 2)    {    array ua = getpwnam(u), ga = getgrnam(g);       if (!ua) ua = getpwuid((int) u);
Roxen.git/server/modules/scripting/perl.pike:165: Inside #if constant(getpwnam)
   if (ua) s->set_uid = ua[2];    if (ga) s->set_gid = ga[2];    }   #endif       handler_settings = s;       cache_output = query("caching");   }    - static void periodic() + protected void periodic()   {    fix_settings();    ExtScript.periodic_cleanup();    call_out(periodic, 900);   }      void start()   {    periodic();    script_output_mode = query("scriptout");   }    - static void add_headers(string headers, object id) + protected void add_headers(string headers, object id)   { string header, name, value;    if (headers)    foreach(headers / "\r\n", header)    { if (sscanf(header, "%[^:]:%s", name, value) == 2)    switch (name)    { case "Content-Type":    case "Content-Encoding":    case "Content-Languages":    // Might require special treatment in the future?    ;    default:    id->add_response_header (name, value);    }    }   }    - static void do_response_callback(RequestID id, array result) + protected void do_response_callback(RequestID id, array result)   {   // werror("perl:do_response_callback: %O %O\n", id, result);    id->connection()->write("HTTP/1.0 200 OK\r\n");    if (arrayp(result) && sizeof(result) > 1)    { if (sizeof(result) > 2 && stringp(result[2]))    {    foreach(result[2] / "\r\n" - "", string s)    id->connection()->write(s + "\r\n");    id->connection()->write("\r\n");    }