perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Galbraith <p...@patg.net>
Subject Migrating from regular mod perl scripts
Date Mon, 16 Jun 2003 20:55:53 GMT
Hi there,

I'm in the process of trying to see if Embperl is a good templating 
solution, but am not sure where to start. Also, I'm wondering one simple 
thing. How would you use Embperl to do what regular mod perl script 
does... something like:

#!/usr/bin/perl

use MyLib::Util;
use MyLib::DB;
my $util = new MyLib::Util;
my $db = new MyLib::DB; # this is imaginary...
my $form = $util->getForm();

my $op = $form->{op} # form parameter from a post...

my $ops = {
	'foo1' => \&fooOp1,
	'foo2' => \&fooOp2
};

$opts->{$op}->($db,$form);

sub fooOp1 {
 my ($db,$form) = @_;

 print <<EOT;
lots of html tags... blah blah $form->{valuewhatever}
EOT

}

sub fooOp2 {
 my ($db,$form) = @_;

 $recordsorwhatever = $db->getData();

 if($recordsorwhatever) {
	print "html stuff... ";
	... loop through records...
 } else {
	print "print that record isn't there... blah...";
 }
}

So, this is code that display html vs. something like embperl that has 
logic in the content. Do you have a template that has mostly code in it 
and then the logic calls more content laden templates?

It's just a different approach, one that I'd like to take advantage of 
with what Embperl purports as it's features.

Note: we used Template::Toolkit with Slash, but I think I want something 
speedier. We also ran perl scripts that had a SlashDisplay that called 
Template::Toolkit templates.

regards,

Patrick

 -- 
Patrick Galbraith
Senior Software Developer
pgalbraith@classmates.com
patg@patg.net capttofu@slashdot.org


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message