WebDyne

 view release on metacpan or  search on metacpan

lib/WebDyne/Constant.pm  view on Meta::CPAN

    WEBDYNE_NODE_SRCE_IX         => 6,


    #  Container structure
    #
    WEBDYNE_CONTAINER_META_IX => 0,
    WEBDYNE_CONTAINER_DATA_IX => 1,


    #  Where compiled scripts are stored. Scripts are stored in
    #  here with a the inode of the source file as the cache
    #  file name.
    #
    WEBDYNE_CACHE_DN => &cache_dn,


    #  Empty cache files at startup ? Default is yes (psp files wil be
    #  recompiled again after a server restart)
    #
    WEBDYNE_STARTUP_CACHE_FLUSH => 1,


    #  How often to check cache for excess entries, clean to
    #  low_water if > high_water entries, based on last used
    #  time or frequency.
    #
    #  clean_method 0				= clean based on last used time (oldest
    #  get cleaned)
    #
    #  clean_method 1				= clean based on frequency of use (least
    #  used get cleaned)
    #
    WEBDYNE_CACHE_CHECK_FREQ   => 256,
    WEBDYNE_CACHE_HIGH_WATER   => 64,
    WEBDYNE_CACHE_LOW_WATER    => 32,
    WEBDYNE_CACHE_CLEAN_METHOD => 1,
    WEBDYNE_CACHE_STAT_TTL     => 0,


    #  Type of eval code to run - use Safe module, or direct. Direct
    #  is default, but may allow subversion of code
    #
    #  1					= Safe # Not tested much - don't assume it is really safe !
    #  0					= Direct (UnSafe)
    #
    WEBDYNE_EVAL_SAFE => 0,


    #  Prefix eval code with strict pragma. Can be undef'd to remove
    #  this behaviour, or altered to suit local taste
    #
    WEBDYNE_EVAL_USE_STRICT => 'use strict qw(vars)',
    
    
    #  Anything to prepend after use strict
    #
    WEBDYNE_EVAL_PREPEND => '',


    #  Global opcode set, only these opcodes can be used if using a
    #  safe eval type. Uncomment the full_opset line if you want to
    #  be able to use all perl opcodes. Ignored if using direct eval
    #
    #WEBDYNE_EVAL_SAFE_OPCODE_AR		=>	[&Opcode::full_opset()],
    #WEBDYNE_EVAL_SAFE_OPCODE_AR			=>	[&Opcode::opset(':default')],
    WEBDYNE_EVAL_SAFE_OPCODE_AR => [':default'],


    #  Use strict var checking, eg will check that a when ${varname} param
    #  exists with a HTML page that the calling perl code (a) supplies a
    #  "varname" hash parm, and (b) that param is not undef
    #
    WEBDYNE_STRICT_VARS => 1,


    #  When a perl method loaded by a user calls another method within
    #  that just-loaded package (eg sub foo { shift()->bar() }), the
    #  WebDyne AUTOLOAD method gets called to work out where "bar" is,
    #  as it is not in the WebDyne ISA stack.
    #
    #  By default, this gets done every time the routine is called,
    #  which can add up when done many times. By setting the var below
    #  to 1, the AUTOLOAD method will pollute the WebDyne class with
    #  a code ref to the method in question, saving a run through
    #  AUTOLOAD if it is ever called again. The downside - it is
    #  forever, and if your module has a method of the same name as
    #  one in the WebDyne class, it will clobber the WebDyne one, probably
    #  bringing the whole lot crashing down around your ears.
    #
    #  The upside. A speedup of about 10% on modules that use AUTOLOAD
    #  heavily
    #
    WEBDYNE_AUTOLOAD_POLLUTE => 0,


    #  Dump flag. Set to 1 if you want the <dump> tag to display the
    #  current CGI status
    #
    WEBDYNE_DUMP_FLAG => 0,


    #  Encoding
    #
    WEBDYNE_HTML_CHARSET => do {
        $constant_temp{'webdyne_html_charset'}='UTF-8'
    },


    #  Content-type for text/html. Combined with charset to produce Content-type header
    #
    WEBDYNE_CONTENT_TYPE_HTML => do {
        $constant_temp{'webdyne_content_type_html'}='text/html'
    },
    WEBDYNE_CONTENT_TYPE_HTML_ENCODED => do {
        $constant_temp{'webdyne_content_type_html_encoded'}=sprintf('%s; charset=%s', @constant_temp{qw(webdyne_content_type_html webdyne_html_charset)})
    },


    #  Content-type for text/plain. As above
    #
    WEBDYNE_CONTENT_TYPE_TEXT => do {
        $constant_temp{'webdyne_content_type_text'}='text/plain'
    },
    WEBDYNE_CONTENT_TYPE_TEXT_ENCODED => 
        sprintf('%s; charset=%s', @constant_temp{qw(webdyne_content_type_text webdyne_html_charset)}),

lib/WebDyne/Constant.pm  view on Meta::CPAN

* **WEBDYNE_STARTUP_CACHE_FLUSH**

    **Default:** `1`

    Remove existing disk cache files at startup so PSP files are recompiled after restart and then cached again when first viewed. Set to 0 to keep disk cache files across restarts.

* **WEBDYNE_CACHE_CHECK_FREQ**

    **Default:** `256`

    Per-process request interval used to trigger memory cache housekeeping.

* **WEBDYNE_CACHE_HIGH_WATER**

    **Default:** `64`

    Maximum number of compiled pages to keep in memory before cache housekeeping removes entries.

* **WEBDYNE_CACHE_LOW_WATER**

    **Default:** `32`

    Target number of compiled pages to retain after memory cache housekeeping runs.

* **WEBDYNE_CACHE_CLEAN_METHOD**

    **Default:** `1`

    Memory cache cleanup method. `0` removes entries by oldest last-use time; `1` removes least-used entries first.

* **WEBDYNE_CACHE_STAT_TTL**

    **Default:** `0`

    Controls how often WebDyne rechecks disk cache file mtimes after a compiled page has been loaded into the current process.

    `0` preserves the historical behavior and stats cache files on every request. A positive value reuses the last stat result for that many seconds. `-1` reuses the last stat result for the lifetime of the current process, so externally updated cach...

* **WEBDYNE_EVAL_SAFE**

    **Default:** `0`

    Run dynamic PSP code in a `Safe` compartment instead of direct Perl eval. Safe mode is experimental and not recommended as a security boundary.

* **WEBDYNE_EVAL_USE_STRICT**

    **Default:** `'use strict qw(vars)'`

    Perl source prepended before generated eval code to enable strict variable checking. Set to `undef` to disable this strict pragma. In Safe mode this behaves as a strict on/off flag rather than arbitrary source text.

* **WEBDYNE_EVAL_PREPEND**

    **Default:** `''`

    Perl source text prepended to generated eval code after `WEBDYNE_EVAL_USE_STRICT`. Use conservatively because it affects interpreted PSP code globally.

* **WEBDYNE_EVAL_SAFE_OPCODE_AR**

    **Default:** array reference containing `:default`

    Opcode set allowed when `WEBDYNE_EVAL_SAFE` is enabled. Ignored when direct eval mode is used. Use `Opcode::full_opset()` for the full opcode set if Safe mode is enabled and you explicitly want to allow all Perl opcodes.

* **WEBDYNE_STRICT_VARS**

    **Default:** `1`

    Check render variables referenced as `${name}` and raise an error when a referenced variable was not supplied to `render()` or `render_block()`, or was supplied as `undef`.

* **WEBDYNE_AUTOLOAD_POLLUTE**

    **Default:** `0`

    Cache dynamically found method references in the `WebDyne` namespace to avoid repeated `AUTOLOAD` lookup. This can improve some workloads but risks method-name clashes, so it should only be used in controlled environments.

* **WEBDYNE_DUMP_FLAG**

    **Default:** `0`

    Enable output from the special `<dump>` tag, mainly for form and request debugging.

* **WEBDYNE_HTML_CHARSET**

    **Default:** `'UTF-8'`

    Default character set used for generated content types and default HTML metadata.

* **WEBDYNE_CONTENT_TYPE_HTML**

    **Default:** `'text/html'`

    Base content type for HTML responses.

* **WEBDYNE_CONTENT_TYPE_HTML_ENCODED**

    **Default:** `'text/html; charset=UTF-8'`

    Encoded HTML content type including the configured character set.

* **WEBDYNE_CONTENT_TYPE_TEXT**

    **Default:** `'text/plain'`

    Base content type for plain text responses.

* **WEBDYNE_CONTENT_TYPE_TEXT_ENCODED**

    **Default:** `'text/plain; charset=UTF-8'`

    Encoded plain text content type including the configured character set.

* **WEBDYNE_CONTENT_TYPE_JSON**

    **Default:** `'application/json'`

    Base content type for JSON responses.

* **WEBDYNE_CONTENT_TYPE_JSON_ENCODED**

    **Default:** `'application/json; charset=UTF-8'`

    Encoded JSON content type including the configured character set.

lib/WebDyne/Constant.pm  view on Meta::CPAN



=item *

B<WEBDYNE_CACHE_CLEAN_METHOD>

B<Default:> C<1>

Memory cache cleanup method. C<0> removes entries by oldest last-use time; C<1> removes least-used entries first.



=item *

B<WEBDYNE_CACHE_STAT_TTL>

B<Default:> C<0>

Controls how often WebDyne rechecks disk cache file mtimes after a compiled page has been loaded into the current process.

C<0> preserves the historical behavior and stats cache files on every request. A positive value reuses the last stat result for that many seconds. C<-1> reuses the last stat result for the lifetime of the current process, so externally updated cache ...



=item *

B<WEBDYNE_EVAL_SAFE>

B<Default:> C<0>

Run dynamic PSP code in a C<Safe> compartment instead of direct Perl eval. Safe mode is experimental and not recommended as a security boundary.



=item *

B<WEBDYNE_EVAL_USE_STRICT>

B<Default:> C<'use strict qw(vars)'>

Perl source prepended before generated eval code to enable strict variable checking. Set to C<undef> to disable this strict pragma. In Safe mode this behaves as a strict on/off flag rather than arbitrary source text.



=item *

B<WEBDYNE_EVAL_PREPEND>

B<Default:> C<''>

Perl source text prepended to generated eval code after C<WEBDYNE_EVAL_USE_STRICT>. Use conservatively because it affects interpreted PSP code globally.



=item *

B<WEBDYNE_EVAL_SAFE_OPCODE_AR>

B<Default:> array reference containing C<:default>

Opcode set allowed when C<WEBDYNE_EVAL_SAFE> is enabled. Ignored when direct eval mode is used. Use C<Opcode::full_opset()> for the full opcode set if Safe mode is enabled and you explicitly want to allow all Perl opcodes.



=item *

B<WEBDYNE_STRICT_VARS>

B<Default:> C<1>

Check render variables referenced as C<${name}> and raise an error when a referenced variable was not supplied to C<render()> or C<render_block()>, or was supplied as C<undef>.



=item *

B<WEBDYNE_AUTOLOAD_POLLUTE>

B<Default:> C<0>

Cache dynamically found method references in the C<WebDyne> namespace to avoid repeated C<AUTOLOAD> lookup. This can improve some workloads but risks method-name clashes, so it should only be used in controlled environments.



=item *

B<WEBDYNE_DUMP_FLAG>

B<Default:> C<0>

Enable output from the special C<<< <dump> >>> tag, mainly for form and request debugging.



=item *

B<WEBDYNE_HTML_CHARSET>

B<Default:> C<'UTF-8'>

Default character set used for generated content types and default HTML metadata.



=item *

B<WEBDYNE_CONTENT_TYPE_HTML>

B<Default:> C<'text/html'>

Base content type for HTML responses.



=item *

B<WEBDYNE_CONTENT_TYPE_HTML_ENCODED>

B<Default:> C<'text/html; charset=UTF-8'>

Encoded HTML content type including the configured character set.



( run in 0.682 second using v1.01-cache-2.11-cpan-14f38c9f855 )