R: IMPORT to ARRAY

"Luca Notari" <[email protected]> Wed, 12 Mar 2008 14:56:41 +0100
Newsgroups gmane.comp.apache.mod-survey.general
Message-ID <000a01c88448$e6652840$6f01a8c0@asus01>
Joel,=20
Should I consider myself strange & nerd, also if I'm newbie to perl?!?=20
If so, I'll take into account to look at something different, perhaps
fishing.....=20

:-))

Luca

-----Messaggio originale-----
Da: [email protected]
[mailto:[email protected]] Per conto di Joel
Palmius
Inviato: mercoled=EC 12 marzo 2008 13.08
A: [email protected]
Oggetto: Re: survey-discussion-list: IMPORT to ARRAY


Hmm.. I'm surprised your usage of {$..$} worked anywhere in IMPORT. It=20
shouldn't have.

To explain we have to be aware that perl/variable parsing can happen at=20
two different times: before parse and at display. The {$..$} syntax is
for=20
modifying text output at display time. It only modifies visible text=20
output. The <IMPORT> tag happens before display and should not be
possible=20
to modify by {$..$}. Here you should rather use perl dynamics which=20
happens before parse.

I assume "u_id" is a variable which has been submitted on an earlier
page.=20
Then the following could work:

<IMPORT DBIDSN=3D"dbi:mysql:database=3Dtest" DBIUSER=3D"user" DBIPASS=3D"=
user"
DBITABLE=3D"places" VISIBLE=3D"yes">
   <ARRAY NAME=3D"place" FIELD=3D"place" />
   <ARRAY NAME=3D"p_cap" FIELD=3D"place_label" />
   <FILTER CRITERIA=3D"user_id=3D{& print
$session->getValue("SUBMITTED_u_id"); &}" /> </IMPORT>

I don't have a database available for testing at the moment, but the
above=20
should work. If it doesn't, mail any error messages and I'll take a look

at it again.

Don't worry that you don't know perl. It's rather a sign of health. Only

really strange people and notorious nerds know perl anyway. :-)

   // Joel




On Wed, 12 Mar 2008, Jo=E3o Ranito wrote:

> Hi all,
>
> This is my 5th day of battle with mod_survey, and my first post here=20
> on this
> group, and i want first of all, to congratulate all the people
involved on=20
> this project.
>
> Long story short, my problem is this:
>
> <IMPORT DBIDSN=3D"dbi:mysql:database=3Dtest" DBIUSER=3D"user" DBIPASS=3D=
"user"
> DBITABLE=3D"places" VISIBLE=3D"yes">
>   <ARRAY NAME=3D"place" FIELD=3D"place" />
>   <ARRAY NAME=3D"p_cap" FIELD=3D"place_label" />
>   <FILTER CRITERIA=3D"user_id=3D{$u_id$}" />
> </IMPORT>
>
> Running this, my Apache will say "500" after being told by MySQL to=20
> check for
> the right syntax near '}'.
>
> u_id is ok, i checked it. It has been submitted from the previous=20
> page, and i
> can see it printed ok on this page as well.
>
> When i replace the ARRAY by VARIABLE, i get the values of the first=20
> row of
> that query, as expected, so VARIABLE works ok with {$u_id$}.
>
> When i replace the {$u_id$} in the FILTER by, say 1, i get all the=20
> results
> ok, filtered by that id. And yes, u_id is 1 on my tests...
>
> So my guess is, there must be something wrong with the parsing of the
> criteria on an array import. Could this be?
>
> The real problem is, when it comes to Perl, my level of proficiency=20
> will
> allow me to develop a complete "hello world" program (standard
edition, not=20
> even enterprise), which means, when it comes to Perl, i am totally and

> utterly ignorant.
>
> So i was wondering, could someone please help me to find out what is=20
> wrong?
> is it my import? is there a way i can get those nice arrays and put
them into=20
> those cool LISTs on my survey so my users can gracefully pick their
place?=20
> that would be real nice...
>
> My mod_survey is 3.5.2 stable running on Apache/2.2.4 (Ubuntu)
> mod_python/3.3.1 Python/2.5.1 PHP/5.2.3-1ubuntu6.3 mod_perl/2.0.2
Perl/v5.8.8=20
> Server at 10.0.1.90 Port 80
>
> Thanks to everyone and,
> Greetings from Portugal(*)
>
> Jo=E3o Ranito.
> (*) Yes, mod_survey has come to the sunniest side of Europe ;)
>
>
>
> Skickat av =3D?ISO-8859-1?Q?Jo=3DE3o_Ranito?=3D <[email protected]>=
 till

> survey-discussion
>


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