GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Petal::CodePerl::Expr(3) User Contributed Perl Documentation Petal::CodePerl::Expr(3)

Code::Perl::Expr - Extra Code::Perl classes for Petal

These are some extra Code::Perl Expression classes that are specific to Petal

"Petal::CodePerl::Expr" has been removed from the front of the class names, so for example "Alternate" is really "Petal::CodePerl::Expr::Alternate".

  $class->new(Paths => \@paths);

  alternate(@paths);

@paths - an array of Expression objects

Alternate will try each expression in turn, looking for the first one which evaluates without dieing.

  $class->new(Expr => $path);

  pathexists($path);

$path - an Expression object

PathExists will return true if the $path can be followed without dieing, false otherwise

  $class->new(Ref => $ref, Key => $key);

  dereft($ref, $key);

$ref - an Expression object $key - a string

DerefTAL will attempt to dereference the object returned by $ref in the TAL style, using the $key. This means if $ref yields a blessed reference the $key will used as a method name if possible. If $key cannot be used as a method name or $ref yielded an unblessed reference then DerefTAL tries to dereference $ref as an array or a hash, using $key. If $ref doesn't yield a reference then we die.

  $class->new(Perl => $perl, Params => \@params);

  perlsprintf($perl, @params);

$string - an string of Perl code @params - an array of exprs to be place into the string

This is a quick hack to allow me to get compiled modifiers working, hopefully it will go away soon

When PerlSprintf is producing Perl code, it will use Perl's sprintf function to insert the expressions in @params into the string in $string. You should put a %s in $string to mark where you want the expressions in @params to be placed. The expressions will be wrapped in () to avoid precedence problems. Because it uses Perl's sprintf function you must be careful if there is a "%" in your Perl, you have to change any "%" to "%%".

  perlsprintf('$array[%s].$hash->{%s}', scal("a"), string("harry"));

will give perl like

        $array[($a]).$hash->{"harray"}

Written by Fergal Daly <fergal@esatclear.ie>.

Copyright 2003 by Fergal Daly <fergal@esatclear.ie>.

This program is free software and comes with no warranty. It is distributed under the LGPL license

See the file LGPL included in this distribution or http://www.fsf.org/licenses/licenses.html.

2003-07-14 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.