Gossamer Forum
Home : General : Perl Programming :

GT Module and SCALAR tags

Quote Reply
GT Module and SCALAR tags
I am using the GT::Mail::POP3 module to hit a POP3 server and verify if a user (and correct password) exist on the server. It is currently setup as a global variable. Here is the code:

sub {
# ------------------------------------------------------------------
# Used to check the Mail server for new messages.
#
use GT::Mail::POP3;
my $tags = GT::Template->tags;

my $id = $tags->{"chpdcmail"};
$id =~ s/\s+$//;

my $password = $tags->{"Password"};
$password =~ s/\s+$//;

open(OLD_STDERR,">&STDERR") or die "Failed to save STDERR";
open(STDERR,">script.err") or die "Failed to redirect STDERR";

# Constructors
my $pop = new GT::Mail::POP3 (
host => 'mail.alliedhealthsystems.com',
port => 110,
user => $id,
pass => $password,
auth_mode => 'PASS',
Timeout => '5',
debug => 1
);

my $count = $pop->connect;

if($count > 0) {
$tags->{home}->{sql}->table('Claims_Users')->update ( { SamePass => '1'}, { Username => $tags->{Username}} );
}
else { $tags->{home}->{sql}->table('Claims_Users')->update ( { SamePass => '0'}, { Username => $tags->{Username}} ); }

$pop->quit;

open(STDERR,">&OLD_STDERR") or die "Failed to restore STDERR";

return $count;
}

When I run the script, it runs correctly but never does what you expect. I captured the STDERR from the script and this is what I got:

GT::Mail::POP3 (6682): Attempting to connect .. at /website/ahs/public_html/code/admin/GT/Mail/POP3.pm line 215.
GT::Mail::POP3 (6682): Connected to mail.alliedhealthsystems.com on port 110 at /website/ahs/public_html/code/admin/GT/Mail/POP3.pm line 233.
GT::Mail::POP3 (6682): Going to login at /website/ahs/public_html/code/admin/GT/Mail/POP3.pm line 241.
GT::Mail::POP3 (6682): Attempting to log in via clear text ... at /website/ahs/public_html/code/admin/GT/Mail/POP3.pm line 288.
GT::Mail::POP3 (6682): --> USER SCALAR(0x97c65e0) at /website/ahs/public_html/code/admin/GT/Mail/POP3.pm line 154.
GT::Mail::POP3 (6682): <-- +OK SCALAR(0x97c65e0) at /website/ahs/public_html/code/admin/GT/Mail/POP3.pm line 163.
GT::Mail::POP3 (6682): --> PASS admin at /website/ahs/public_html/code/admin/GT/Mail/POP3.pm line 154.
GT::Mail::POP3 (6682): <-- -ERR Unknown user or incorrect password at /website/ahs/public_html/code/admin/GT/Mail/POP3.pm line 163.
GT::Mail::POP3 (6682): An error occured while logging in: PASS POP Login failed: -ERR Unknown user or incorrect password at (eval 24) line 31.
GT::Mail::POP3 (6682): --> QUIT at /website/ahs/public_html/code/admin/GT/Mail/POP3.pm line 154.
GT::Mail::POP3 (6682): <-- +OK mail.alliedhealthsystems.com closing connection at /website/ahs/public_html/code/admin/GT/Mail/POP3.pm line 163.

So basically I see the problem... It is sending the text "SCALAR(0x97c65e0)" as the username (and probably the password). Which obviously the mailserver does not understand. So how do I get it to send the actual value of the variable and not the scalar reference???
Subject Author Views Date
Thread GT Module and SCALAR tags LanceWilson2 8139 Apr 11, 2007, 11:35 AM
Thread Re: [LanceWilson2] GT Module and SCALAR tags
Andy 7889 Apr 12, 2007, 1:33 AM
Thread Re: [Andy] GT Module and SCALAR tags
LanceWilson2 7884 Apr 12, 2007, 7:16 AM
Post Re: [LanceWilson2] GT Module and SCALAR tags
Andy 7960 Apr 12, 2007, 7:23 AM
Thread Re: [LanceWilson2] GT Module and SCALAR tags
brewt 7892 Apr 12, 2007, 6:54 PM
Post Re: [brewt] GT Module and SCALAR tags
Andy 7835 Apr 13, 2007, 1:14 AM
Thread Re: [brewt] GT Module and SCALAR tags
LanceWilson2 7891 Apr 13, 2007, 10:02 AM
Post Re: [LanceWilson2] GT Module and SCALAR tags
Andy 7891 Apr 13, 2007, 10:42 AM