Hello,

I have a simple page that finishes with this :

[$ if (1) $]
        <form name="edituser" id="edituser">
                <table>
                        <td>identity</td>
                        <td><input type="text" name="displayname" id="displayname" value="[+ 
1 +]" /></td>
                </table>
        </form>
[$ 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;
}

sub DESTROY {
        my $self = shift;
        $self->{_connexion}->unbind;
}

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

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

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

1;


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,

JC

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscr...@perl.apache.org
For additional commands, e-mail: embperl-h...@perl.apache.org

Reply via email to