udat and objects

2003-12-02 Thread Benni Baermann
Hi!

Is it correct, that it is impossible to store blessed references (Perl
objects) in udat? Same for mdat?

If yes, is there any workaround? Maybe serializing the object first
with Storable or something like this? But if i interpreted the mails
in the archive correct this still will not work with DBI-Connections?

Is there a way to use only one DBI-Connection for the whole
application?

Benni
-- 
http://www.aymargeddon.de


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



Re: udat and objects

2003-12-02 Thread Luiz Fernando B. Ribeiro
On Tue, 2 Dec 2003 10:36:32 +0100, Benni Baermann <[EMAIL PROTECTED]> wrote:

Hi!

Is it correct, that it is impossible to store blessed references (Perl
objects) in udat? Same for mdat?
If yes, is there any workaround? Maybe serializing the object first
with Storable or something like this? But if i interpreted the mails
in the archive correct this still will not work with DBI-Connections?
Is there a way to use only one DBI-Connection for the whole
application?
I'll give you some suggestions and maybe others may complement it.

I think tha what you mean with "only one DBI-Connection for the whole 
application" is in fact one DBI connection for each Apache child.

There are some ways to do these but the most common is to use Apache::DBI. 
It will do the caching for you. So write a page (component) that starts 
the connection and put it back in the $req_rec reference so it will be 
available to all other Executed pages in the same request.
Example:

connect.epr:
[-
$req = shift;
$req->{dbh} = new DBI(...);
-]
In your pages:
[-
Execute('connect.epr');
$req = shift;
$dbh = $req->{dbh};
# Database stuff...
-]
In other Executed parts:
[-
$req = shift;
$dbh = $req->{dbh};
# More database stuff
-]
This is a simple method and of course there are more elegant approaches 
you could try.

About storing objects in udat I usually avoid it, its better to store 
simple variables.
If you need objects you have to make shure the serialized data are not 
bigger than the capacity of the column in your database (usually 32k).

Good luck,

--
Luiz Fernando B. Ribeiro
Engenho Soluções para a Internet
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


called from embperl? $0 available?

2003-12-02 Thread Benni Baermann
Hi!

I noticed, that $0 is set to "-e" in my module if it is called from
embperl. Is this the normal behaviour or just random? 

Is there another - possible better - way to determine in my modul, if
the function is called from Embperl or from an ordinary script?

Thanks for any help! (and thanks for the helpful answers to my other
question :-)

Benni
-- 
http://www.aymargeddon.de


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



Re: called from embperl? $0 available?

2003-12-02 Thread Sherwin Daganato
On Tue, Dec 02, 2003 at 03:16:33PM +0100, Benni Baermann wrote:
> I noticed, that $0 is set to "-e" in my module if it is called from
> embperl. Is this the normal behaviour or just random? 
> 
> Is there another - possible better - way to determine in my modul, if
> the function is called from Embperl or from an ordinary script?
> 

Try this inside your function:

# tested on HTML-Embperl-1.3.4
if ( (caller)[0] =~ /^HTML::Embperl::DOC::_\d+$/ ) {
  # was called from Embperl
} else {
  # was called from elsewhere
}

HTH

Sherwin

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



Re: Cookie and Cookieless sessions

2003-12-02 Thread Gerald Richter
Hi,

>
> Basically what I want to do is to have standard cookied sessions,
> however if user doesn't support cookies then it falls back to
> cookieless sessions.
>
> Can I
> a)  Have both cookie and cookieless sessions running at the same time
> - if so how do I configure this.

In Embperl 2.0 look at EMBPERL_SESSION_MODE

> b)  Optionally pass the session_id as a param - so if there isn't a
> cookie, but there is a param then it loads the session using the param
> session id.  If so whats the correct name of the session id (as in
> ?session_id=sds232sd23dsgrfgf355565)
>

If you set session_mode correctly Embperl will do this for you automaticly

Gerald


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

--
Gerald Richter ecos electronic communication services gmbh
IT-Securitylösungen * dynamische Webapplikationen * Consulting

Post:   Tulpenstrasse 5  D-55276 Dienheim b. Mainz
E-Mail: [EMAIL PROTECTED]  Voice:   +49 6133 939-122
WWW:http://www.ecos.de/  Fax: +49 6133 939-333
--
|
|   ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
|
+-


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



Re: [$ var $udat $]

2003-12-02 Thread Gerald Richter
Kee Hinckley wrote:
> That particular definition leads to bad things.  In particular,
> eventually you die in SetupSession because tied %HTML::Embperl::udat
> returns undefined.
>
> My guess is that the cleanup of $udat in the module I'm calling
> (loaded by an Execute({ isa }) into a template) is untying them
> somehow.

That might be possible

>  I tried $CLEANUP{'$udat'} = 0, but that gives me errors
> about %CLEANUP not being defined and seemed to have no effect,
> whether or not I defined in.

TRy

[$ var %CLEANUP $]

$CLEANUP{'udat'} = 0 ; # udat without $

I didn't tried it out, but it might work

Gerald

--
Gerald Richter ecos electronic communication services gmbh
IT-Securitylösungen * dynamische Webapplikationen * Consulting

Post:   Tulpenstrasse 5  D-55276 Dienheim b. Mainz
E-Mail: [EMAIL PROTECTED]  Voice:   +49 6133 939-122
WWW:http://www.ecos.de/  Fax: +49 6133 939-333
--
|
|   ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
|
+-


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



Re: udat and objects

2003-12-02 Thread Gerald Richter
Hi,
>
> Is it correct, that it is impossible to store blessed references (Perl
> objects) in udat? Same for mdat?
>

You can store blessed references and objects.

> If yes, is there any workaround? Maybe serializing the object first
> with Storable or something like this? But if i interpreted the mails
> in the archive correct this still will not work with DBI-Connections?
>

You can't store a DBI handle (or file handle). How do you want to store a
handle in a database or flat file, that might be picked up by a different
process...

> Is there a way to use only one DBI-Connection for the whole
> application?
>

Take a look at Apache::DBI

Gerald


> Benni

--
Gerald Richter ecos electronic communication services gmbh
IT-Securitylösungen * dynamische Webapplikationen * Consulting

Post:   Tulpenstrasse 5  D-55276 Dienheim b. Mainz
E-Mail: [EMAIL PROTECTED]  Voice:   +49 6133 939-122
WWW:http://www.ecos.de/  Fax: +49 6133 939-333
--
|
|   ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
|
+-


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



Simple table problem

2003-12-02 Thread Pete Moran
I know this is a really simple problem - and can be fixed using if
statements etc - but wanted to know if there was a standard way of doing
this.

Simply say I have a array

@array = qw/1 2 3 4 5 6 7 8 9 10/;

And I want to create a dynamic table of this data - BUT I want to have a
fixed column length (in this case 4).  The end table should look like


  
1
2
3
4
  
  
5
6
7
8
  
  
9
10
  


Using the dynamic table syntax and the associated magic variables - can
this be achieved - or do I have to add some custom code ?  Have checked
out various examples and searched the mailing list but seems either it
cant be done this way or I am yet again missing the point.



Regards



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