about DBI

"Luca Notari" <[email protected]> Fri, 15 Feb 2008 12:36:13 +0100
Newsgroups gmane.comp.apache.mod-survey.general
Message-ID <003301c86fc6$f7e31000$0400a8c0@asus01>
This is a multi-part message in MIME format.

------=_NextPart_000_0034_01C86FCF.59A77800
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Using IMPORT tag I can access a database via VARIABLE or ARRAY, and this
variable is included in the list of variables of the survey.
 
 
But what if I don't want to include the variable?
 
to do this, I've tried to use DBI in perl snippet but In all cases,
doesn't work for me(continuous document error or display error; I've
opened the compartment->permit 
$compartment->permit(qw(:browse :filesys_read :sys_db :filesys_open
:filesys_write :subprocess :base_core :default :base_io :others require
caller))
both in Display.pm and Document.pm  
 
I've also tried to use open function: open FILE,"myfile.txt", but, again
nothing works:
 

Document error

Security exception: Undefined subroutine &Carp::longmess_heavy called at
/usr/lib/perl5/5.8.3/Carp.pm line 166, line 30. 
 
Platform: linux-suse
Modsurvey version 3.2.4
Perl 5.8.3
mod_perl 1.99
 
 
 
The reason for which I have to fetch data from external is: check
quotas. If I'm a respondent out of quotas, I have to route to a page
named i.e. quotafull.survey.
To do this, I 1) have to query my DBMS or 2) read a text data or csv
data from external
 
Is there any possibility to fetch data from external source (text files,
databases) and put in a .survey script page with Perl snippets?
 
 
(I can easy do this with php script, and try to call it via XMLHttp
using javascript; but, according my knowledge, i have to put variables
fetched somewhere in the page,
for example using an 'hidden' field; but for variables to be available
for perl, i think i have to submit them ; this is a problem as I need
variables available in the same page)
 
thanks,
 
Luca Notari
 

------=_NextPart_000_0034_01C86FCF.59A77800
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Messaggio</TITLE>

<META content=3D"MSHTML 6.00.6000.16608" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial size=3D2>Using =
IMPORT tag I=20
can access a database via VARIABLE or ARRAY, and this variable is =
included in=20
the list of variables of the survey.</FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial size=3D2>But =
what if I don't=20
want to include the variable?</FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial size=3D2>to do =
this, I've=20
tried to use DBI in perl snippet but In all cases, doesn't work for=20
me(continuous document error or display error; I've opened the=20
compartment-&gt;permit </FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial=20
size=3D2>$compartment-&gt;permit(qw(:browse :filesys_read :sys_db =
:filesys_open=20
:filesys_write :subprocess :base_core :default :base_io :others require=20
caller))</FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial size=3D2>both =
in Display.pm=20
and Document.pm&nbsp; </FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial size=3D2>I've =
also tried to=20
use open function: open FILE,"myfile.txt", but, again nothing=20
works:</FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV><SPAN class=3D859424510-15022008>
<H1 class=3Dbad>Document error</H1>
<DIV><B>Security exception: Undefined subroutine =
&amp;Carp::longmess_heavy=20
called at /usr/lib/perl5/5.8.3/Carp.pm line 166, <FIL>line 30. =
</B></DIV>
<DIV><B></B>&nbsp;</DIV>
<DIV><B></FIL></B></SPAN><SPAN class=3D859424510-15022008><FONT =
face=3DArial=20
size=3D2>Platform: linux-suse</FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial =
size=3D2>Modsurvey version=20
3.2.4</FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial size=3D2>Perl=20
5.8.3</FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial =
size=3D2>mod_perl=20
1.99</FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial size=3D2>The =
reason for which=20
I have to fetch data from external is: check quotas. If I'm a respondent =
out of=20
quotas, I have to route to a page named i.e.=20
quotafull.survey.</FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial size=3D2>To do =
this, I 1)=20
have to query my DBMS or 2) read a text data or csv data from=20
external</FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial size=3D2>Is =
there any=20
possibility to fetch data from external source (text files, databases) =
and put=20
in a .survey script page with Perl snippets?</FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial size=3D2>(I can =
easy do this=20
with php script, and try to call it via XMLHttp using javascript; but, =
according=20
my knowledge, i have to put variables fetched somewhere in the=20
page,</FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial size=3D2>for =
example using an=20
'hidden' field; but for variables to be available for perl, i think i =
have to=20
submit them ; this is a problem as I need variables available in the =
same=20
page)</FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial=20
size=3D2>thanks,</FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial size=3D2>Luca=20
Notari</FONT></SPAN></DIV>
<DIV><SPAN class=3D859424510-15022008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0034_01C86FCF.59A77800--

Skickat av "Luca Notari" <[email protected]>
till survey-discussion