perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Christophe Boggio <>
Subject Schrödinger syndrome
Date Thu, 08 Mar 2012 16:37:21 GMT

I have a simple page that finishes with this :

[$ if (1) $]
	<form name="edituser" id="edituser">
			<td><input type="text" name="displayname" id="displayname" value="[+ 1 +]" /></td>
[$ else $]
	<p>User not found</p>
[$ endif $]

But I get *both* results (the form *and* the "user not found" message).

Also, sometimes the input's value shows as "1", sometimes it's "<[+>1"
And it changes randomly between the 2 values when I refresh the page.

So it has to come from what's before that part (although I'd prefer embperl to detect
the problem, it's very confusing).

So, before this part, I have a call to a function :
			%x = $ldap->getuser(
				uid => $fdat{uid},
				attributes => join(',',@attrs)

If I comment it out, the problem disappears.

So the problem comes from this function. Ok.

I am starting to write objects and I don't fully understand how it works (when is
the package recompiled is one question).

I made a package inside which I create my objects :

package omicoldap;

use utf8;
use strict;
use Net::LDAP;
use Net::LDAP::Util qw(ldap_error_name ldap_error_text);

package omicoldapcnx;

use Net::LDAP;
sub new {
	my $class = shift;
	my $self = {
		_serveradr => shift,
	bless $self,$class;
	return $self;

	my $self = shift;

sub connect {
	my $self = shift;
	# do things

sub listusers {
	my ($self,%params) = @_;
	# do things

sub getuser {
	my ($self,%params) = @_;
	# do things


Am I doing things the right way ? Or should I rather remove the initial
"package omicoldap" part and "use omicoldapcnx" directly ?
I did this because I wanted to have a "use" different from the class (so
I could store several classes in the same source code).

BTW, is there a way to use embperl's "warn" mechanism or equivalent from within the
package so I can write messages to apache's logs for debugging purpose ?

Anyway, I still wonder about the very strange behaviour described at the beginning.

Sorry for being so long, I wanted to give as much details as possible.

Thanks for your help,


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message