HELP PLS: $ent->get_text and LDAP Weirdness



I  think I'm losing it......

Here's my problem:

Upon filling in a value on an entry, the user clicks the
button.

I go to a sub and take the value of the entry and feed it
to the Net::LDAP object, as a filter.

It hangs!

If I put a print statement in the sub, I can see the value
is correct, but it does not like coming from the entry
widget!

If I set the variable manually to the filled in value ( ie
$uname = "dvdwalt") it works 100%!

Am I missing something here?

I've tried connecting to slapd and NetWare LDAP servers,
still the same results!

Why does it not like the ?my $uname = $ent->get_text;?
statement?

I'm including a simple script that can be used to test in
your environment

-------------------

#! /usr/bin/perl -w
#
use strict;
use Gtk2 '-init';

use Net::LDAP;

use constant FALSE => 0;
use constant TRUE  => 1;


my $window = Gtk2::Window->new('toplevel');
        $window ->signal_connect(delete_event => sub {
Gtk2->main_quit; return FALSE;});
        $window->set_title("n-client II");
                
        my $button = Gtk2::Button->new("PRESS");
        $button->signal_connect(clicked => sub { &xtra_mount; });
        
        my $ent= Gtk2::Entry->new;
        
        my $vbox = Gtk2::VBox->new(0,3);
        $vbox ->set_border_width(5);
        
        $vbox->pack_start($button,0,0,2);
        $vbox->pack_start($ent,0,0,2);
        
        $window->add($vbox);
        
        $window ->show_all();
        
Gtk2->main;
        0;
        

sub xtra_mount {

                my $uname = $ent->get_text;
                
                #--------------------------
                my $ldap= Net::LDAP->new("146.64.9.186")or die "$@";

                $ldap->bind;
                
                #set $uname = "dvdwalt" and it will go through
                #$uname = "dvdwalt";
                
                #enter "dvdwalt" on the entry and it does not go through
                # (Comment the above out! -> type the name in on the
entry) 

                my $val = "cn = $uname";
                                
                my $mesg = $ldap->search( 
                base => "o=csir",
                scope => "sub",
                filter  => "($val)",
                attrs   => ['dn'],
        );
        
        $mesg->code && warn $mesg->error;
        
        print("IT GOT THROUGH!\n");
        
}
        



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]