RE: Server Errors

2003-12-16 Thread Dan Muey
 I've got the below script saved on my server - but every time 
 I use it I get an Internel Server Error! I've set the 
 permission to 755 but still no luck. Any ideas folks?
 
 www.klconsulting.co.uk/cgi-bin/cssc.pl
 
 
If you run it in  abrowser:
1) is it execuatbale?
2) is apache(or whatever webserever) configured to execute .pl files ac cgi
3) therer is no Content-type header 
4) what do the logs say?
5) What happens when you execute it via cli?
6) icmp is , as far as I know, only doable as root. I remember using tcp, 
maybe udp also but  I don't do this very often.

HTH

DMuey

 #!/usr/bin/perl
 use Net::Ping;
 
 @host_array = 
 (192.153.1.10,192.153.0.18,212.241.168.197,212.241.168.
 138,212.
 241.167.11,194.153.21.68,194.153.20.100,194.153.20.51,
 194.153.20
 .52,194.153.20.53,515.35.226.5,212.241.160.12,194.153.
 1.19,194
 .153.1.18,212.35.224.125,212.35.224.126);
 
 $p = Net::Ping-new(icmp);
 
 $p-bind($my_addr);
 
 foreach $host (@host_array)
 {
print $host is ;
print NOT  unless $p-ping($host, 2);
print reachable.\n;
sleep(1);
 }
 
 $p-close();
  
 
 
  
 W. A. Khushil Dep
 Technical Support Agent
 PIPEX Communications Plc 
 Phone  : 0845 077 83 24
 Fax: 08702 434440 
 WWW: www.pipex.net/support 
 
 
 The information transmitted is intended only for the person 
 or entity to which it is addressed and may contain 
 confidential and/or privileged material. Any review, 
 retransmission, dissemination or other use of, or taking of 
 any action in reliance upon, this information by persons or 
 entities other than the intended recipient is prohibited. If 
 you received this in error, please contact the sender and 
 delete the material from any computer. Although PIPEX 
 Internet Limited operates anti-virus programs, it does not 
 accept responsibility for any damage whatsoever that is 
 caused by viruses being passed. If you suspect that the 
 message may have been intercepted or amended, please call the sender.
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
 Behalf Of zentara
 Sent: 15 December 2003 15:16
 To: [EMAIL PROTECTED]
 Subject: Re: pass vars to sub via TK/Button
 
 On Mon, 15 Dec 2003 12:27:34 +0100, [EMAIL PROTECTED] (Oliver
 Schaedlich) wrote:
 
 Greetings,
 
 I'd like to know how to pass variables fetched by TK/entry to a 
 subroutine by using a Button. The Button/-command line in 
 the following 
 script is obviously wrong, but should suffice to illustrate 
 what I want 
 it to do.
 
 I'd be happy if someone could tell me how to do this properly.
 
 #!/usr/bin/perl
 use strict;
 use Tk;
 
 my $main = MainWindow-new;
 
 my $var1 = $main - Entry( -width = 30 );
  $var1 - pack;
 my $var2 = $main - Entry( -width = 30 );
  $var2 - pack;
 
 $main - Button
 ( -text = 'Add',
   -command = sub{\add_item($var1,$var2)}
 ) - pack;
 
 MainLoop;
 
 sub add_item {
my (@widgets) = @_;
print @widgets\n;
my $entry1 = $_[0]-get();
my $entry2 = $_[1]-get();
print Added-$entry1 + $entry2 = ,$entry1+$entry2,\n; 
 return; } __END__
 
 --
 When life conspires against you, and no longer floats your 
 boat, Don't waste your time with crying, just get on your 
 back and float.
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED] 
http://learn.perl.org/ http://learn.perl.org/first-response



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ 
http://learn.perl.org/first-response



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: Server Errors

2003-12-16 Thread Dan Muey
  I've got the below script saved on my server - but every time
  I use it I get an Internel Server Error! I've set the 
  permission to 755 but still no luck. Any ideas folks?
  
  www.klconsulting.co.uk/cgi-bin/cssc.pl
  
  
 If you run it in  abrowser:
   1) is it execuatbale?
   2) is apache(or whatever webserever) configured to 
 execute .pl files ac cgi
   3) therer is no Content-type header 
   4) what do the logs say?
   5) What happens when you execute it via cli?
   6) icmp is , as far as I know, only doable as root. I 
 remember using tcp, maybe udp also but  I don't do this very often.
 
 HTH
 
 Dmuey

Also use strict; and warnings that will help imensely.
It would have told you $my_addr is uninitialized, which may be the problem.
Global symbol $my_addr requires explicit package name at ping.pl line 14.
Execution of ping.pl aborted due to compilation errors.
Also $p-bind() seems off:
Can't locate object method bind via package Net::Ping at ping.pl line 14.

What is bind(0 supposed to be form/do?


Try this version: (it will ping either the hostname of the server or whatever you 
specify as arguments)
./ping.pl
Or 
./ping.pl google.com joemama.com etc.com
Once oyu get this oing then add your array and you'll be all set!

#!/usr/bin/perl -w
use strict;

use Net::Ping;

my $hstnm = `hostname`; # there are more modular ways of doing this but hey I have the 
flu!
chomp($hstnm);

my @hosts = @ARGV;
if([EMAIL PROTECTED]) { push @hosts, $hstnm; }

my $p = Net::Ping-new('tcp');

for(@hosts) {
print $_ :;
print ' NOT' unless $p-ping($_);
print  pingable.\n;
sleep(1);
}
$p-close();

HTH
DMuey
 
  #!/usr/bin/perl
  use Net::Ping;
  
  @host_array =
  (192.153.1.10,192.153.0.18,212.241.168.197,212.241.168.
  138,212.
  241.167.11,194.153.21.68,194.153.20.100,194.153.20.51,
  194.153.20
  .52,194.153.20.53,515.35.226.5,212.241.160.12,194.153.
  1.19,194
  .153.1.18,212.35.224.125,212.35.224.126);
  
  $p = Net::Ping-new(icmp);
  
  $p-bind($my_addr);
  
  foreach $host (@host_array)
  {
 print $host is ;
 print NOT  unless $p-ping($host, 2);
 print reachable.\n;
 sleep(1);
  }
  
  $p-close();
   
  
  
  
  W. A. Khushil Dep
  Technical Support Agent
  PIPEX Communications Plc 
  Phone  : 0845 077 83 24
  Fax: 08702 434440 
  WWW: www.pipex.net/support 
  
  
  The information transmitted is intended only for the person
  or entity to which it is addressed and may contain 
  confidential and/or privileged material. Any review, 
  retransmission, dissemination or other use of, or taking of 
  any action in reliance upon, this information by persons or 
  entities other than the intended recipient is prohibited. If 
  you received this in error, please contact the sender and 
  delete the material from any computer. Although PIPEX 
  Internet Limited operates anti-virus programs, it does not 
  accept responsibility for any damage whatsoever that is 
  caused by viruses being passed. If you suspect that the 
  message may have been intercepted or amended, please call 
 the sender.
  
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
  Behalf Of zentara
  Sent: 15 December 2003 15:16
  To: [EMAIL PROTECTED]
  Subject: Re: pass vars to sub via TK/Button
  
  On Mon, 15 Dec 2003 12:27:34 +0100, [EMAIL PROTECTED] (Oliver
  Schaedlich) wrote:
  
  Greetings,
  
  I'd like to know how to pass variables fetched by TK/entry to a
  subroutine by using a Button. The Button/-command line in 
  the following
  script is obviously wrong, but should suffice to illustrate
  what I want
  it to do.
  
  I'd be happy if someone could tell me how to do this properly.
  
  #!/usr/bin/perl
  use strict;
  use Tk;
  
  my $main = MainWindow-new;
  
  my $var1 = $main - Entry( -width = 30 );
   $var1 - pack;
  my $var2 = $main - Entry( -width = 30 );
   $var2 - pack;
  
  $main - Button
  ( -text = 'Add',
-command = sub{\add_item($var1,$var2)}
  ) - pack;
  
  MainLoop;
  
  sub add_item {
 my (@widgets) = @_;
 print @widgets\n;
 my $entry1 = $_[0]-get();
 my $entry2 = $_[1]-get();
 print Added-$entry1 + $entry2 = ,$entry1+$entry2,\n;
  return; } __END__
  
  --
  When life conspires against you, and no longer floats your
  boat, Don't waste your time with crying, just get on your 
  back and float.
  
  --
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED] 
 http://learn.perl.org/ http://learn.perl.org/first-response
 
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED] 
http://learn.perl.org/ http://learn.perl.org/first-response



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

RE: Server Errors

2003-12-15 Thread Steven Kreuzer
Your script is erroring out for some reason, and it might be because you
never defined $my_addr.

$p-bind($my_addr) Sets the source address from which pings will be
sent. This must be the address of one of the interfaces on the local
host. $my_addr may be specified as a hostname or as a text IP address
such as 192.168.1.1.

Try the above, and if that doesn't work, run the script from the command
line and copy and paste the error message you get.

Also, you may want to add this line somewhere near the top of your
script since you are running it as a CGI:

Print Content-type: text/plain\n\n;

Steven Kreuzer
Linux Systems Administrator
Etagon, Inc
W: 646.728.0656
F: 646.728.0607
E: [EMAIL PROTECTED]


-Original Message-
From: Mr. W. A. Khushil Dep [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 15, 2003 10:35 AM
To: [EMAIL PROTECTED]
Subject: Server Errors

I've got the below script saved on my server - but every time I use it I
get an Internel Server Error! I've set the permission to 755 but still
no
luck. Any ideas folks?

www.klconsulting.co.uk/cgi-bin/cssc.pl


#!/usr/bin/perl
use Net::Ping;

@host_array =
(192.153.1.10,192.153.0.18,212.241.168.197,212.241.168.138,212.
241.167.11,194.153.21.68,194.153.20.100,194.153.20.51,194.153.20
.52,194.153.20.53,515.35.226.5,212.241.160.12,194.153.1.19,194
.153.1.18,212.35.224.125,212.35.224.126);

$p = Net::Ping-new(icmp);

$p-bind($my_addr);

foreach $host (@host_array)
{
   print $host is ;
   print NOT  unless $p-ping($host, 2);
   print reachable.\n;
   sleep(1);
}

$p-close();
 


 
W. A. Khushil Dep
Technical Support Agent
PIPEX Communications Plc

Phone  : 0845 077 83 24
Fax: 08702 434440 
WWW: www.pipex.net/support 


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the
material from any computer. Although PIPEX Internet Limited operates
anti-virus programs, it does not accept responsibility for any damage
whatsoever that is caused by viruses being passed. If you suspect that
the message may have been intercepted or amended, please call the
sender.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
zentara
Sent: 15 December 2003 15:16
To: [EMAIL PROTECTED]
Subject: Re: pass vars to sub via TK/Button

On Mon, 15 Dec 2003 12:27:34 +0100, [EMAIL PROTECTED] (Oliver
Schaedlich) wrote:

Greetings, 

I'd like to know how to pass variables fetched by TK/entry to a
subroutine by using a Button. The Button/-command line in the
following script is obviously wrong, but should suffice to illustrate
what I want it to do.

I'd be happy if someone could tell me how to do this properly.

#!/usr/bin/perl
use strict;
use Tk;

my $main = MainWindow-new;

my $var1 = $main - Entry( -width = 30 );
 $var1 - pack;
my $var2 = $main - Entry( -width = 30 );
 $var2 - pack;

$main - Button
( -text = 'Add',
  -command = sub{\add_item($var1,$var2)}
) - pack;

MainLoop;

sub add_item {
   my (@widgets) = @_;
   print @widgets\n;
   my $entry1 = $_[0]-get();
   my $entry2 = $_[1]-get();
   print Added-$entry1 + $entry2 = ,$entry1+$entry2,\n;
return;
}
__END__

--
When life conspires against you, and no longer floats your boat,
Don't waste your time with crying, just get on your back and float.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Server Errors

2003-12-15 Thread John W. Krahn
Mr. W. A. Khushil Dep wrote:
 
 I've got the below script saved on my server - but every time I use it I
 get an Internel Server Error! I've set the permission to 755 but still
 no
 luck. Any ideas folks?
 
 www.klconsulting.co.uk/cgi-bin/cssc.pl
 
 #!/usr/bin/perl
 use Net::Ping;
 
 @host_array =
 (192.153.1.10,192.153.0.18,212.241.168.197,212.241.168.138,212.
 241.167.11,194.153.21.68,194.153.20.100,194.153.20.51,194.153.20
 .52,194.153.20.53,515.35.226.5,212.241.160.12,194.153.1.19,194
 .153.1.18,212.35.224.125,212.35.224.126);
 
 $p = Net::Ping-new(icmp);

You can't use ICMP unless you are running as root.  Use UDP or TCP
instead.


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Server Errors

2003-12-15 Thread R. Joseph Newton
Mr. W. A. Khushil Dep wrote:

 I've got the below script saved on my server - but every time I use it I
 get an Internel Server Error! I've set the permission to 755 but still
 no
 luck. Any ideas folks?

 www.klconsulting.co.uk/cgi-bin/cssc.pl

 #!/usr/bin/perl
 use Net::Ping;

 @host_array =
 (192.153.1.10,192.153.0.18,212.241.168.197,212.241.168.138,212.
 241.167.11,194.153.21.68,194.153.20.100,194.153.20.51,194.153.20
 .52,194.153.20.53,515.35.226.5,212.241.160.12,194.153.1.19,194
 .153.1.18,212.35.224.125,212.35.224.126);

 $p = Net::Ping-new(icmp);

 $p-bind($my_addr);

 foreach $host (@host_array)
 {
print $host is ;
print NOT  unless $p-ping($host, 2);
print reachable.\n;
sleep(1);
 }

 $p-close();

This looks like a script that might run by telnet [highly unlikely, since
the crowding of already dense strings and lack of formatting is likely to
cause logic or other human errors, but at least it might].  It sounds,
though, like you are trying to do this from CGI.  Unfortunately, you have
nothing in the script to support CGI communication.  Nor does your script
output html.  If you:
use CGI;
you will have tools available to do both very simply.

perldoc CGI

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response