You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Kaare Rasmussen <ka...@webline.dk> on 2000/04/29 20:48:53 UTC

More questions

Hi

1. DBIxRecordset: How do I put the PrevNextForm in a table ? I want to alwas
have the same buttons the same place in the form, like this

First   Previous   Next   Last

If displaying the first rows, 
it would look like

                    Next   Last

Hope it is understandable.

2. Could someone please tell me how I make a persistent database connection
with mod_perl and Embperl ? A step by step intro including
- where do I make the DBI->connect. In startup.pl ?
- How do I reference the database handle? What name does it have ?

According to the mod_perl guide, this is preferable to put in startup.pl

use mymodule();

to save time by including all the routines on startup. But if I do so, I can
not access any routines in mymodule. They are simple not known.
Why ?

-- 
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2582
Howitzvej 75               �ben 14.00-18.00        Email: kar@webline.dk
2000 Frederiksberg        L�rdag 11.00-17.00       Web:      www.suse.dk

RE: More questions

Posted by Gerald Richter <ri...@ecos.de>.
Hi
>
> 1. DBIxRecordset: How do I put the PrevNextForm in a table ? I
> want to alwas
> have the same buttons the same place in the form, like this
>
> First   Previous   Next   Last
>
> If displaying the first rows,
> it would look like
>
>                     Next   Last
>
> Hope it is understandable.
>

Yes, I understand, but the current version don't displays First and
Previous, if you are already at the start of the recordset. If you need
this, you must patch DBIx::Recordset PrevNextForm method.

> 2. Could someone please tell me how I make a persistent database
> connection
> with mod_perl and Embperl ? A step by step intro including
> - where do I make the DBI->connect. In startup.pl ?

Never make a connect in the startup.pl, unless you also make a disconnect!
(because db handles becomes invalid when APache forks it childs)

> - How do I reference the database handle? What name does it have ?
>

In your startup.pl inlcude a

use Apache::DBI ;

afterwards you can just access your database as normal. Apache::DBI takes
care for you.


> According to the mod_perl guide, this is preferable to put in startup.pl
>
> use mymodule();
>
> to save time by including all the routines on startup. But if I
> do so, I can
> not access any routines in mymodule. They are simple not known.
> Why ?
>

Because your routines will live in the main package. Include a

package mymodule ;

at the top of your module and access the functions via

mymodule::foo () ;

Gerald



> --
> Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
> Kaki Data                tshirts, merchandize      Fax:        3816 2582
> Howitzvej 75               Åben 14.00-18.00        Email: kar@webline.dk
> 2000 Frederiksberg        Lørdag 11.00-17.00       Web:      www.suse.dk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>