Hello.
>
> I have some questions about the embperl_object_app.
> 1. Will that application object called every time if a page is requested?

Once for every http request, _not_ for every file you include with Execute

> 2. I have a configuration file similar to the configuration file in the
web
> example that comes with embperl-2.0b8. How can i access the variables
> defined there in the webpages?
> For example:
> config.pl:
>
> sub new {
>     my ($self, $req) = @_;
> ...
> $self->{dbdsn} = 'dbi:Oracle:host=dbhost;sid=dbsid';
> $self->{dbusr} = 'dbuser';
> $self->{dbpwd} = 'secret';
>
>
> webapp.pl:
>

If you have

sub init
    {
    my ($self, $req) = @_ ;

> $config = Execute({object => 'config.pl', syntax => 'Perl'});
> $config->new($req);
> $req->{config} = $config;
>
> # so how i understand this
> $req->{dbuser} = $req->{config}->{dbusr};
> $req->{dbpwd} = $req->{config}->{dbpwd};
> $req->{dsn} = $req->{config}->{dbdsn};
>
> $req->{dbh} = DBI->connect("$req->{dsn}",
"$req->{dbuser}","req->{dbpwd}");
>

typo: missing $ before req->{dbpwd}
you don't need the " " around the three vars. In case you leave it out, the
Perl compiler will catch such typos

> somepage.epl:
> [-
>    $req = shift;
>    ...
>    $sth = $req->{dbh}->prepare($stmt);
>    ...
> -]
>
> But $req->{dbh} is undefined.
>

It is correct and should work

Did you check that the connect work, e.g. write

$req->{dbh} = DBI->connect($req->{dsn}, $req->{dbuser},$req->{dbpwd}) or die
"Cannot connect: $DBI::errstr" ;

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     [EMAIL PROTECTED]         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to