Sorry I did not see you had your code below.


> ----------
> From:         Guilherme Pinto
> Sent:         Friday, July 6, 2001 3:41 PM
> To:   [EMAIL PROTECTED]; 'Craig Monroe'
> Subject:      RE: Need help with errors - strict the problem?
> 
> I am a newbie myself, but shouldn't it be:
> 
> my $value;  # note the $
> 
> > ----------
> > From:       Craig Monroe
> > Sent:       Friday, July 6, 2001 3:06 PM
> > To:         [EMAIL PROTECTED]
> > Subject:    Need help with errors - strict the problem?
> > 
> > I wrote the following program to find the WAN IP address of router, then
> > send it in an http request to the website of the organization for dns
> > updating. Then, I have a mail message sent to myself notifying me of the
> > update.
> > I received the following errors. I am still somewhat of a newbie, so
> > please have a little patience with me. The error messages are as
> > follows:
> > 
> > 
> > Use of uninitialized value in print at
> > c:\windows\desktop\perl_hacks\dns_lwp-mai
> > l.pl line 87.
> > 
> > Line 87 is print $value;
> > I thought I initialized this with my value;
> > Is this because of strict? How would I pass that value if that is the
> > case?
> > 
> > 
> > ....and the answer is......
> > 
> > good 24.147.206.7
> > 
> > Use of uninitialized value in concatenation (.) at
> > c:\windows\desktop\perl_hacks
> > \dns_lwp-mail.pl line 104.
> > 
> > line 104 is %mail = ( To      => '[EMAIL PROTECTED]',
> > 
> > 
> > 
> > #! c:\perl\bin -w
> > 
> > ############################################################
> > #
> > #   Author: Craig Monroe
> > #   Date:   July 6, 2001
> > #   Abstract: Wrote this utility to automatically update
> > #                   my dnsalias record. Will add mail confirmation.
> > #
> > #
> > 
> > use Mail::Sendmail;
> > use IO::Socket;
> > use IO::File;
> > use strict;
> > 
> > my $cayman = "192.168.1.254";
> > my $ipaddress;
> > my $value;
> > my $ua;
> > my $req;
> > my $res;
> > my $line;
> > my $time;
> > my $dayname;
> > my $month;
> > my $day;
> > my $clocktime;
> > my $year;
> > my $count;
> > my %mail;
> > 
> > $count = "0";
> > #system('cls'); commenting out screen clears for now to get errors
> > 
> > # infinite loop
> > { 
> > 
> > #Get the day and if it matches the criteria, run the program
> > 
> > $time = scalar(localtime);
> > ($dayname, $month, $day, $clocktime, $year) = split (/\s+/, $time);
> > &Title;
> > if ((($day eq "6") && ($count == 0)) || (($day eq "25") && ($count ==
> > 0))) {
> > 
> > # Open a connection to the cayman
> > 
> > my $remote = new IO::Socket::INET(PeerAddr=>$cayman,
> >                                     PeerPort=>23,
> >                                     Proto=>"tcp",
> >                                     Type=>SOCK_STREAM)
> >         or die "Couldn't connect to IP address $cayman\nSystem error: $!";
> >         
> > # set buffering off
> > $remote->autoflush(1);
> >     
> > print $remote "xxxxx\n";
> > sleep('3');
> > print $remote "xxxxx\n";
> > sleep('3');
> > print "\nConnecting to the Cayman at $cayman ....\n\n";
> > sleep('3');
> > print $remote "show ip int\n";
> > print $remote "quit\n";
> > print "\nParsing the output to grab the WAN IP address....\n\n";
> > sleep('3');
> > 
> > while (defined ($line = <$remote>)) {
> >     $line = substr("$line",1);
> >     if ($line =~ /^IP Address/){
> >     ($ipaddress, $value) = split(/\s+:/, $line);
> >     }
> > }
> > 
> > close ($remote);
> > 
> > # Create a web user agent and send the update to dnsalias
> > 
> > #system('cls'); commenting out screen clears for now to get errors
> > # Create a user agent object
> > use LWP::UserAgent;
> > $ua = new LWP::UserAgent;
> > $ua->agent("AgentName/0.1 " . $ua->agent);
> > print "Sending the WAN IP to DNSALIAS.NET\n\n";
> > # Create a request
> > $req = new HTTP::Request GET =>
> > 
>'http://test:[EMAIL PROTECTED]/nic/update?system=dyndns&hostname=test.dnsalias.org&;
> > myip='.'$value'.'&wildcard=OFF&offline=NO';
> > print $value;
> > sleep('3');
> > # Pass request to the user agent and get a response back
> > $res = $ua->request($req);
> > # Check the outcome of the response
> > if ($res->is_success) > {
> > print "....and the answer is......\n\n";
> > print $res->content;
> > print "\n\n";
> > sleep('3');
> > } 
> > else {
> > print "Didn't work\n";
> > }
> > 
> > $count++;
> > 
> > %mail = ( To      => '[EMAIL PROTECTED]',
> >           From    => '[EMAIL PROTECTED]',
> >           Subject => 'Craig\'s DNS Alias Hostname Update',
> >           Message => "On $time your DNS name has been updated with
> > $value");
> > sendmail(%mail) or die $Mail::Sendmail::error;
> > sleep('5');
> > } # end of if
> > else {
> >     #system('cls'); commenting out screen clears for now to get errors> 
> >     &Title;
> >     print "\n\nWaiting 24 Hours from $time to try again..";
> >     sleep ('86400');
> >     $count = 0;
> > } # end of else
> > redo;
> > } # end of while
> > 
> > sub Title {
> > print "DNS Updater\n";
> > print "=================\n\n\n";
> > }
> > 
> > 
> 
> 

Reply via email to