Re: R: R: using IMPORT

Joel Palmius <[email protected]> Sat, 21 Oct 2006 17:37:35 +0200 (CEST)
Newsgroups gmane.comp.apache.mod-survey.general
Message-ID <[email protected]>
The list of available opcodes are in the Opcode man page (see "man 
Opcode", note capital O).

   // Joel



On Sat, 21 Oct 2006, Luca Notari wrote:

> I get this error: Security exception: 'require' trapped by operation
> mask at (eval 2616) line 2,  line 14.
>
> This is the code for snippet:
> {&
>
> use DBI;
> use strict;
> my $dbh = DBI->connect('DBI:mysql:dbname:localhost','user','pass') or
> die "Couldn't connect to database: ";
>
> &}
>
> Where i can find documentation for a COMPLETE list of perl packages? (no
> match for filesys_read or sys_db in cpan.org)
> -----Messaggio originale-----
> Da: [email protected]
> [mailto:[email protected]] Per conto di Joel
> Palmius
> Inviato: martedì 17 ottobre 2006 11.31
> A: [email protected]
> Oggetto: Re: R: survey-discussion-list: using IMPORT
>
>
> My suggestion would be to remove the security restrictions from the perl
>
> snippets and do selection on your own. Change line 261 in Display.pm
> from
>
>   $compartment->permit(qw(:browse));
>
> to
>
>   $compartment->permit(qw(:browse :filesys_read :sys_db :filesys_open
> :filesys_write :subprocess));
>
> I have not tested this, but these permissions should allow you to run
> DBI
> directly from a perl snippet. Easiest way to make variables available to
>
> the rest of the survey would then be to place them in the session.
>
>   $session->setValue("dogs",$dogs);
>
> and in the survey include them with for example
>
>   {_dogs_}
>
> (note that {$..$} is only for submitted variables while {_.._} is for
> session variables).
>
>   // Joel
>
>
> On Tue, 17 Oct 2006, Luca Notari wrote:
>
>> The example below works fine, but what if I need more variables from a
>
>> DB in a page? I've noticed that the import tag can exist once in a
>> page (2 import tags containing 2 different variables returned a
>> document error for
>> me...) , and, unfortunately, FILTER tag once, too.
>>
>> My needs are to retrieve 8 variables from 8 different columns using
>> filter (myvar1=1, myvar2=1....) using the count function...
>>
>> So, my problem is to retrieve 8 variables, from values previously
>> accumulated by respondents during the survey, and pick from those the
>> lowest value (with a perl snippet) . In other environments I've used
>> simple text files
>> (myvar1.txt,myvar2.txt...) which contained simply a number value (the
>> total respondent that affected this variable).
>>
>> May I have to "break" the survey (for example with a php page), or is
>> possible also, for example have an access and write to a simple .txt
>> file in the filesystem?
>>
>>
>> -----Messaggio originale-----
>> Da: [email protected]
>> [mailto:[email protected]] Per conto di Joel
>> Palmius
>> Inviato: lunedì 16 ottobre 2006 13.52
>> A: [email protected]
>> Oggetto: Re: survey-discussion-list: using IMPORT
>>
>>
>> Hrm, I'm not exactly sure I understand what you want to do, but
>> perhaps something like this?
>>
>> <SURVEY TITLE="import">
>>   <IMPORT DBIDSN="DBI:Pg:dbname=joepal" DBITABLE="armorbrand"
>> DBIUSER="joepal">
>>     <VARIABLE NAME="arm" FIELD="count(*) as armors" />
>>     <FILTER CRITERIA="NOT name ISNULL" />:
>>   </IMPORT>
>>   <TEXT NAME="armor" CAPTION="Add new brand (there are currently
>> {$arm$} brands in DB)" /> </SURVEY>
>>
>> Idea is to import a count() as a variable and then use it with {$..$}
>> in
>>
>> output.
>>
>> Bugant probably has a better way to do this, I never worked much with
>> the IMPORT tag.
>>
>>   // Joel
>>
>>
>>
>> On Fri, 13 Oct 2006, Luca Notari wrote:
>>
>>> Hi all,
>>>
>>> I'm using for a survey DBI instruction for saving data in a database.
>
>>> I have a question about IMPORT tag and his sub-tags.
>>>
>>> this is what I have to do (is possible using an SQL statement):
>>>
>>> I have to ask a question, that requires checking back a sum of
>>> responses
>>> (quota) by precedent respondents.
>>>
>>> a question possible is: "do you have a dog? So far, we've collected
>>> XX
>>
>>> dog(s)".
>>>
>>> with a SQL statement such "select count(the_dog_column) from
>>> people_table where the_dog_column='yes'" i can fetch data that i
>>> need.
>>>
>>> Shortly, I have to retrieve this data but I don't want to populate a
>>> list.
>>>
>>> do subtags as filter, variable supports retrieving a sum of records
>>> matching a criteria from a database?
>>>
>>> regards,
>>>
>>> Luca Notari
>>>
>>> --
>>> No virus found in this outgoing message.
>>> Checked by AVG Free Edition.
>>> Version: 7.1.408 / Virus Database: 268.13.3/473 - Release Date:
>>> 12/10/2006
>>>
>>>
>> Skickat av Joel Palmius <[email protected]>
>> till survey-discussion
>>
>> --
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.1.408 / Virus Database: 268.13.3/473 - Release Date:
>> 12/10/2006
>>
>>
>> --
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition.
>> Version: 7.1.408 / Virus Database: 268.13.3/473 - Release Date:
>> 12/10/2006
>>
>>
>>
>>
>> Skickat av "Luca Notari" <[email protected]>
>> till survey-discussion
>>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.408 / Virus Database: 268.13.3/473 - Release Date:
> 12/10/2006
>
>
> -- 
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.408 / Virus Database: 268.13.9/490 - Release Date:
> 20/10/2006
>
>
>
>
> Skickat av "Luca Notari" <[email protected]>
> till survey-discussion
>