Can't call method "send" on an undefined value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jabdulius
    New Member
    • Jun 2007
    • 3

    Can't call method "send" on an undefined value

    Hi all, newb to Perl here. I'm trying to use the Net:SNPP package to send a page, and getting the above error when trying to send. Here's my code:
    Code:
    my $host = "snpp.cingular.com:444";
    
    my $snpp = Net::SNPP->new( $host );
    
    $snpp->send( Pager => $to, Message => $message,);
    
    $snpp->quit;
    I think that the problem may be that we're running Apache on top of a windows server as that seemed to introduce some other problems, but this doesn't make sense to me since I'm definitely defining $snpp, aren't I?

    Thanks in advance.
    -Karim Varela
  • miller
    Recognized Expert Top Contributor
    • Oct 2006
    • 1086

    #2
    Whenever connecting to an external host, add error checking that verifies the connection was established.

    [CODE=perl]my $snpp = Net::SNPP->new( $host ) or die "Unable to create Net::SNPP object";
    [/CODE]

    We can predict that the above line will fail because you've already received an error message that says that $snpp is undefined (hence why you can't call "send" on it). It will be up to you to determine why you can't connect.

    - Miller

    Comment

    Working...