First...You have to define a table somewhere in the [perl ]
tag... Look in the archive, as I don't know the exact setup off the top of my
head.
Try:
[perl global=1 tables=products interpolate=1]
As for the error, in perl @ is a reserved word. That makes
e-mail addresses sort of a problem..the easy fix is this:
my $tvar = q! e-mail address goes here !;
which will take care of the formatting issues (turning @ into
the escape \@). Then you can proceed with the rest of the script as
usual.
The only other issue is to make sure your catalog has global
access..you can do that by adding:
AllowGlobal catalog_name
to your minivend.cfg (located in root minivend
directory)
Hope this helps:)
Nick
Hi Nick and thanks for your reply,
I changed my code as follows:
[comment] [seti newsletter]
[tag flag write]newsletter[/tag] [try] [import table=newsletter type=LINE
continue=NOTES] subscribers: [value email]
active: 1 [/import] [/try] [catch] There was an error adding the
newsletter. [/catch] [/seti] [/comment]
[seti rval] [perl interpolate=1
global=1]
my $stmt = $dbh->prepare("Insert into newsletter
(subscribers, active) value ([value email], 1)"); $stmt->execute() or return "Error"; return "success"; [/perl] [/seti] <p> <font color="red">[scratch rval]</font> <p>
But I get this in my error log:
[31/May/2000:17:15:28 -0500] process.html Safe: In string,
@domain now must be written as \@domain at (eval 204) line 4, near "Insert
into newsletter (subscribers, active) value (email@domain"
[31/May/2000:17:47:06 -0500] process.html Safe: Can't call
method "prepare" on an undefined value at (eval 204) line 3.
I think my syntax is incorrect or I've left something
undefined. Any suggestions?
Thanks,
Cameron
|