in reply to readline() on unopened filehandle (was: AOL Messaging)

The reason you get that error is because of the line:

    'allow_srv_settings' => <1>,

You end up trying to read from the filehandle named 1. You probably meant to say:

    'allow_srv_settings' => 1,

The angle brackets in the documentation mean that you should use either 1 or 0.

Also, for this particular case, you shouldn't specify the 'callback' option, since you don't actually define callbackfunction (and don't need to for this simple program). In fact, in general, you shouldn't really need to specify a value for most of the options, as they should have reasonable defaults. You really only need to give it the username and password and it should work correctly.

Hope that helps.

bbfu
Black flowers blossom
Fearless on my breath

Replies are listed 'Best First'.
Re: Re: AOL Messaging
by Anonymous Monk on Apr 09, 2003 at 05:37 UTC
    Ok, thanks. That removed on error and a new error just occured. I get an uninitialized error at @@@@, do you know why? If I remove the my I get the error saying I need to use one under strict but when I get it I get this error.

    Thanks!
    #!/usr/bin/perl use strict; use warnings; # require Net::AOLIM; my $user = "wfgs343R"; my $pass = "iamcool"; my $Version; my $aim; print "Subject's Name:"; chomp(my $destuser = <STDIN>); print "Message:"; chomp(my $message = <STDIN>); use Net::AOLIM; @@@@ $aim = Net::AOLIM->new( 'username' => $user, 'password' => $pass, 'callback' => \&callbackfunction, 'server' => 'toc.oscar.aol.com', 'port' => 1234, 'allow_srv_settings' => 1, 'login_server' => 'login.oscar.aol.com', 'login_port' => 5198, 'login_timeout' => 0, 'aim_agent' => "AOLIM:$Version VERSION\$"); $aim->signon; $aim->toc_send_im($destuser, $message);
      To set aim_agent, you used $Version, which is a variable you my'd earlier, and it is unitialized.

      So you should initialize it, if you want to use it.

      What they actually suggest you to use is $Net::AOLIM::VERSION, which is the version of your AOLIM package. To use this one, you neither need to declare it, nor to initialize it. Those are done for you in the AOLIM package, so you just use it, it is ready for you.
        Thanks for your help, pg. Now I have no errors present on runtime (so it says). The messages I'm trying to send aren't working, but atleast I've got a start on it now.

        Maybe I should have worked with perl a while longer before trying to tackle something like this :S.

        Thanks again.