User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 373,912 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,780 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1334 | Replies: 0
Reply
Join Date: Feb 2004
Posts: 196
Reputation: ! ! is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
! ! ! ! is offline Offline
Banned

News Bricolage - PHP5 & Mod Perl

  #1  
Aug 26th, 2005
http://www.justatheory.com/bricolage/1.9.0.html


And finally—yes, you heard right—Bricolage now supports PHP 5 templating in addition to the existing Perl-based templating architectures (Mason, Template Toolkit, and HTML::Template). So how did we add PHP 5 templating to a mod_perl application? Easy: we hired George Schlossnagle of Omni TI to write PHP::Interpreter, an embedded PHP 5 interpreter. Now anyone can natively execute PHP 5 code from a Perl application. Not only that, but the PHP 5 code can reach back into the Perl interpreter to use Perl modules and objects! Here’s an example that I like to show off to the PHP crowd:

[PHP]<?php
$perl = Perl::getInstance();
$perl->eval("use DBI");
$perl->eval("use DateTime");
$dbh = $perl->call("DBI::connect", "DBI", "dbiQLite:dbname=dbfile");
$dbh->do("CREATE TABLE foo (bar TEXT, time DATETIME)");
$now = $perl->call("DateTime::now", "DateTime");
$ins = $dbh->prepare("INSERT INTO foo VALUES (?, ?)");
$ins->execute("This is a test", $now);
$sel = $dbh->prepare("SELECT bar, time FROM foo");
$sel->execute();
$a = array("foo", "bar");
foreach ($sel->fetch() as $val) {
echo "$val\n";
}
$sel->finish();
$dbh->do("DROP TABLE foo");
$dbh->disconnect();
?> [/PHP]
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 5:10 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC