first round of changes for the new session system

This commit is contained in:
JT Smith 2005-12-31 21:54:06 +00:00
parent da95226072
commit d4b7f2ce59
128 changed files with 2442 additions and 1478 deletions

View file

@ -1,63 +0,0 @@
package WebGUI::Macro::If;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2005 Plain Black Software.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use WebGUI::International;
use Safe;
=head1 NAME
Package WebGUI::Macro::If
=head1 DESCRIPTION
A macro for implementing a simple conditional.
=head2 process ( expression, trueResult, falseResult )
Returns trueResult if expression is true, falseResult if the expression
is false and an error message if there was a problem evaluating the
expression.
=head3 expression
A perl expression that will be evaulated in a Safe compartment.
=head3 trueResult
Text that will be returned if the expression is true.
=head3 falseResult
Text that will be returned if the expression is false.
=cut
sub process {
my ($expression, $true, $false) = @_;
my $output = $false;
# Workaround to "Safely" eval $expression
my $compartment = new Safe;
my $return = $compartment->reval($expression);
return sprintf(WebGUI::International::get('eval error', 'Macro_If'),
$@,$expression,$true,$false) if ($@);
$output = $true if ($return);
return $output;
}
1;