On Sunday, Jul 27, 2003, at 12:06 US/Pacific, awarsd wrote: [..]
to do backup of my MYSQL tables I would prefer to do it directly from my
computer no need to upload -save -download etc... the problem to access to
my mysql server it has .htaccess and i was wondering if LWP or something
could input directly the login and password.
For the moment to access website i use LWP.
[..]

If I understand your problem, you are asking

        so how do I pass that user/passwd information
        through an LWP user agent...

well either you want to have the tool
query you at the command line

cf:
<http://www.wetware.com/drieux/pbl/Sys/Admin/passwdGame.txt>

or you will have hidden that safely somewhere...

then you can of course take that and stuff it
into your basic user agent like

         my $ua = LWP::UserAgent->new;
         my ($user, $pword) = gbc($realm, $uri);
        die "No $pword" unless $pword ;
        $ua->credentials($uri->host_port, $realm, $user, $pword)
        .....
        # the usual Request side stuff
        ...
    my $res = $ua->request($req);
    if ($res->is_success) {
        parseTreeBack($res);
    } else {
        print $res->error_as_HTML if ($res->is_error);
        print "Your Request Failed\n";
    }

HTH.

ciao
drieux

---

an implementation of 'gbc()'
you might tailor it to your personal needs..

sub gbc {

        my($realm, $uri) = @_;
#        if ($main::options{'C'}) {
#            return split(':', $main::options{'C'}, 2);
#        } elsif (-t) {
    if(-t) {  # are we attached to a tty???
            my $netloc = $uri->host_port;
            print "Enter username for $realm at $netloc: ";
            my $user = <STDIN>;
            chomp($user);
            return (undef, undef) unless length $user;
            print "Password: ";
            system("stty -echo");
            my $password = <STDIN>;
            system("stty echo");
            print "\n";  # because we disabled echo
            chomp($password);
            return ($user, $password);
        } else {
            return (undef, undef)
        }

} # end gbc - the get_basic_credentials


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



Reply via email to