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: Get Terminal Width and Height, Pure Perl

2003-12-15 Thread Steven Kreuzer
>> You might be able to get away with something as simple as querying
the
>> LINES and COLUMNS environment variables. Or use the output from 'tput
>> lines' and 'tput columns'. It all depends on your platform...

Actually, its tput cols

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

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




RE: Users executing perl scripts

2003-12-17 Thread Steven Kreuzer
Create symlinks to the perl scripts and place the links into a directory
in their $PATH

Example:

$ ln -s /usr/bin/scripts/somescript.pl /bin/somescript

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


-Original Message-
From: Hemond, Steve [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 17, 2003 9:11 AM
To: [EMAIL PROTECTED]
Subject: Users executing perl scripts

Hi people,

I have finished some little perl scripts that gives basic infos to my
users. I want to make these perl scripts available to all users (so I
would probably put them in /usr/local/bin).

However, my perl scripts has the .pl extension, and I would like them to
keep this extension for finding purposes (like if I need to find all .pl
files are in /usr/local for example). The users are used to enter a
command without having to type the extension (ls, who, etc.) so that
wouldn't be a good idea for them to call my perl script with the
extension. What would be the best thing to do if I don't wanna lose the
.pl extension?

** I personnaly think it wouldn`t be a good idea to include aliases in
the users .profile, because each time I would finish a new script I
would have to
   modify their .profile each time.

Thanks in advance for your help,

Best regards,

Steve Hemond
Programmeur Analyste / Analyst Programmer
Smurfit-Stone, Ressources Forestieres
La Tuque, P.Q.
Tel.: (819) 676-8100 X2833
[EMAIL PROTECTED] 


-- 
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: Hi & a question

2003-12-26 Thread Steven Kreuzer
Why not just make DIR1, DIR2, IPADDR AND IPPORT global variables within
the script, rather then requiring user to set env variables, which can
become a pain in the ass.

Your best bet would be to set them to some default variable, and then if
the user needs to, she can override the default values by passing the
new values as parameters. Hope that helps.

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


-Original Message-
From: John McKown [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 26, 2003 12:38 PM
To: Perl Beginners Mailing List
Subject: Hi & a question

I'm new here and a very novice Perl coder. And I have a question, of 
course .

Is it more "Perl-like" to get information from the shell via UNIX 
Environment Variables or via the command line? For an example, I have 
writing a Perl program which reacts to messages sent to it. It has four 
input parameters. The current program gets this information, which is
two 
distinct subdirectories, a port number, and an IP address, via four 
different environment variables. My question is should I do it that way
or 
should I pass this information in via the command line. 

E.g.

export DIR1=...
export DIR2=...
export IPADDR=...
export IPPORT=...
perl-script.perl

or

perl-script.perl DIR1 DIR2 IPADDR IPPORT

Although my current code uses the first way, I'm beginning to think that

the second is preferrable because it would be more portable to non-UNIX 
environments.

I hope everybody is having a good holiday.

--
Maranatha!
John McKown


-- 
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: Newbie problems with > in a string

2003-12-26 Thread Steven Kreuzer
Try changing
$title = $query->param("Title");

to

$title = $query->param('Title');

and do the same thing for the owner param

Also, if you have an if statement that only executes one line of code
when the statement evaluates true, you can do this:

$Meta = "\n" if ($title ne "");

IMHO, this is much "cleaner", just thought I would throw that in there.

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


-Original Message-
From: Albert Browne [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 26, 2003 11:16 AM
To: [EMAIL PROTECTED]
Subject: Newbie problems with > in a string

I am using the code below in part of a subroutine. It displays ok later
in
the routine within a  block.
But when I try to use $Meta elsewhere the string appears to be empty.
Further investigation shows the string is ok until it gets to the >
in the string.  The string  looks like this and does in the TEXTAREA
block which is correct.
I have tried printing the string a bit at a time it is ok until it gets
to
the >. The string then appears to be empty. What am I missing?

Regards

Albert

$title = $query->param("Title");

if ($title ne "") {$Meta = "\n"} ;

$Owner = $query->param("Owner");

if ($Author ne "") {$Meta .= "\n"}
;


-- 
[EMAIL PROTECTED]
http://www.allroadsleadhere.co.uk





-- 
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>