testing for substrings

2003-10-05 Thread Dan Langille
Hi, I have a perl regex to test if a file resides under a particular directory. The test looks like this: if ($filename =~ $directory) { # yes, this filename resides under directory } This is working for most cases. However, it fails is the directory contains a +. For example: $filename

Re: testing for substrings

2003-10-05 Thread John W. Krahn
Dan Langille wrote: Hi, Hello, I have a perl regex to test if a file resides under a particular directory. The test looks like this: if ($filename =~ $directory) { # yes, this filename resides under directory } This is working for most cases. However, it fails is the directory

Testing Uninitialized Vars

2003-10-02 Thread perl
I wan to write a sub return true or false if the var was initialized. Can someone correct this sub or is it good? ... if(isNULL($x) { print it is null\n); else { print it is NOT null\n); ... sub isNULL { return $_[0] =~ // } thanks, -rkl -- To unsubscribe, e-mail: [EMAIL

Re: Testing Uninitialized Vars

2003-10-02 Thread James Edward Gray II
On Thursday, October 2, 2003, at 04:25 PM, [EMAIL PROTECTED] wrote: I wan to write a sub return true or false if the var was initialized. We can do that, but I really don't think we need a sub for it, since there is a built-in. Can someone correct this sub or is it good? No, I wouldn't call it

Re: Testing Uninitialized Vars

2003-10-02 Thread perl
if ( ! defined $x ) I read up on defined and undefined. But I'm looking for a test that will this return true or false to a var condition: ... sub isNULL { return undefined $_[0] $_[0] eq '' $_[0] eq ; } # my goal is all three return the same as # my proposed sub isNULL() my $x; #

Re: Testing Uninitialized Vars

2003-10-02 Thread James Edward Gray II
On Thursday, October 2, 2003, at 05:09 PM, [EMAIL PROTECTED] wrote: if ( ! defined $x ) I read up on defined and undefined. But I'm looking for a test that will this return true or false to a var condition: perldoc -f defined perldoc -f undef The second is a little different than what you

Re: Testing Uninitialized Vars

2003-10-02 Thread perl
Are you saying this would do everything that I want? #I'm considering undefined var and '' and 0s are the same thing. if($x) ... true - do_something -rkl On Thursday, October 2, 2003, at 05:09 PM, [EMAIL PROTECTED] wrote: if ( ! defined $x ) I read up on defined and undefined. But I'm

Re: Testing Uninitialized Vars

2003-10-02 Thread James Edward Gray II
On Thursday, October 2, 2003, at 06:29 PM, [EMAIL PROTECTED] wrote: Are you saying this would do everything that I want? #I'm considering undefined var and '' and 0s are the same thing. if($x) ... true - do_something I said it would, if you don't mind 0 being false. James -- To unsubscribe,

Re: Testing Uninitialized Vars

2003-10-02 Thread perl
you mean $x=0; would be false? On Thursday, October 2, 2003, at 06:29 PM, [EMAIL PROTECTED] wrote: Are you saying this would do everything that I want? #I'm considering undefined var and '' and 0s are the same thing. if($x) ... true - do_something I said it would, if you don't mind 0

Re: Testing Uninitialized Vars

2003-10-02 Thread James Edward Gray II
On Thursday, October 2, 2003, at 07:08 PM, [EMAIL PROTECTED] wrote: you mean $x=0; would be false? Yep. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Testing Uninitialized Vars

2003-10-02 Thread LoBue, Mark
-Original Message- From: James Edward Gray II [mailto:[EMAIL PROTECTED] Sent: Thursday, October 02, 2003 5:20 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Testing Uninitialized Vars On Thursday, October 2, 2003, at 07:08 PM, [EMAIL PROTECTED] wrote: you mean

Re: Testing Uninitialized Vars

2003-10-02 Thread James Edward Gray II
On Thursday, October 2, 2003, at 07:23 PM, LoBue, Mark wrote: -Original Message- From: James Edward Gray II [mailto:[EMAIL PROTECTED] Sent: Thursday, October 02, 2003 5:20 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Testing Uninitialized Vars On Thursday, October 2, 2003

RE: Testing Uninitialized Vars

2003-10-02 Thread perl
- From: James Edward Gray II [mailto:[EMAIL PROTECTED] Sent: Thursday, October 02, 2003 5:20 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Testing Uninitialized Vars On Thursday, October 2, 2003, at 07:08 PM, [EMAIL PROTECTED] wrote: you mean $x=0; would be false? Yep

RE: Testing Uninitialized Vars

2003-10-02 Thread Jeff 'japhy' Pinyan
On Oct 2, [EMAIL PROTECTED] said: To recap, I want to test if a var is undefined or ''. if(undefined $x length($x)==0) There IS no 'undefined' function in Perl, and you don't want to use , you'd want to use ||, since the empty string IS defined. if (not defined($x) or length($x) == 0) {

RE: Testing Uninitialized Vars

2003-10-02 Thread perl
if (defined $x and length $x) So, is this the opposite? if (! defined $x and length $x) or do I have to parenthesis if (! (defined $x and length $x)) -rkl On Oct 2, [EMAIL PROTECTED] said: To recap, I want to test if a var is undefined or ''. if(undefined $x length($x)==0) There IS

Re: Testing Uninitialized Vars

2003-10-02 Thread Steve Grazzini
On Thu, Oct 02, 2003 at 07:03:02PM -0700, [EMAIL PROTECTED] wrote: if (defined $x and length $x) So, is this the opposite? if (! defined $x and length $x) Nope; you've got a precedence problem. unless( defined $x and length $x ) { } -- Steve -- To unsubscribe, e-mail: [EMAIL

Re: Testing Uninitialized Vars

2003-10-02 Thread perl
unless understood, how about this. if (defined $x and length $x) So, is this the opposite? if (! defined $x and ! length $x) -rkl On Thu, Oct 02, 2003 at 07:03:02PM -0700, [EMAIL PROTECTED] wrote: if (defined $x and length $x) So, is this the opposite? if (! defined $x and length $x)

Re: Testing Uninitialized Vars

2003-10-02 Thread Steve Grazzini
On Thu, Oct 02, 2003 at 07:41:41PM -0700, [EMAIL PROTECTED] wrote: unless understood, how about this. if (defined $x and length $x) So, is this the opposite? if (! defined $x and ! length $x) Nope; now you've got a boolean logic problem. Either of these would work, but unless() is

RE: Testing Uninitialized Vars

2003-10-02 Thread TN
if (defined $x and length $x) So, is this the opposite? if (! defined $x and ! length $x) I don't think so. It's basic Aristotelian logic and can be determined by truth tables or testing. Questions are mere conjecture :) The negative of a statement, A, is: not A. That can be writted

Re: Testing for the existence of a file

2003-08-30 Thread Randal L. Schwartz
Kevin == Kevin Struckhoff [EMAIL PROTECTED] writes: Kevin Actually, using glob works easily enough: Kevin $file = glob $DATA_HOME/KeyLinks\*.csv; Kevin print $file; Kevin print \n; Using glob() in a scalar context like that will give you gas, and make your coding life miserable. You want this

Testing for the existence of a file

2003-08-29 Thread Kevin Struckhoff
Using Perl 5.6.1 on HP-UX. I need to test for the existence of a file every day. The filename changes each day because the filename contains a data and time stamp. For example, today's filename is KeyLinks_082903_120712.csv. So I would like to test for KeyLinks*.csv My code is as follows:

RE: Testing for the existence of a file

2003-08-29 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Kevin Struckhoff wrote: Using Perl 5.6.1 on HP-UX. I need to test for the existence of a file every day. The filename changes each day because the filename contains a data and time stamp. For example, today's filename is KeyLinks_082903_120712.csv. So I would like to test for KeyLinks*.csv

RE: Testing for the existence of a file

2003-08-29 Thread Kevin Struckhoff
: Friday, August 29, 2003 10:59 AM To: Kevin Struckhoff; [EMAIL PROTECTED] Subject: RE: Testing for the existence of a file Sorry that this is ugly - I wrote it quickly one day... It checks for the file, and makes sure the date stamp is within 10 minutes. (Date::Manip was overkill for this). Who

RE: Testing for the existence of a file

2003-08-29 Thread perl
crontab to run this every 10 minutes. -Original Message- From: Kevin Struckhoff [mailto:[EMAIL PROTECTED] Sent: Friday, August 29, 2003 10:24 AM To: [EMAIL PROTECTED] Subject: Testing for the existence of a file Using Perl 5.6.1 on HP-UX. I need to test for the existence of a file every

testing

2003-08-06 Thread Michael Adrian
test --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.505 / Virus Database: 302 - Release Date: 7/30/2003

Re: testing an argument's type

2003-07-05 Thread david
David Storrs [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've got a function that takes several arguments, the first of which should be a scalar (specifically, a string). I'd like to have a precondition to verify that the argument is, in fact, a scalar. Is there a way to do

Re: testing an argument's type

2003-07-05 Thread Bob Showalter
David Storrs wrote: I've got a function that takes several arguments, the first of which should be a scalar (specifically, a string). I'd like to have a precondition to verify that the argument is, in fact, a scalar. Is there a way to do that (preferably without using modules--I'm trying to

Re: testing an argument's type

2003-07-05 Thread David Storrs
On Fri, Jul 04, 2003 at 06:02:21PM -0400, Steve Grazzini wrote: On Fri, Jul 04, 2003 at 02:18:40PM -0700, David Storrs wrote: I've got a function that takes several arguments, the first of which should be a scalar (specifically, a string). I'd like to have a precondition to verify that

Re: testing an argument's type

2003-07-05 Thread David Storrs
On Fri, Jul 04, 2003 at 06:03:55PM -0400, Casey West wrote: It was Friday, July 04, 2003 when David Storrs took the soap box, saying: : I've got a function that takes several arguments, the first of which : should be a scalar (specifically, a string). I'd like to have a : precondition to

RE: testing an argument's type

2003-07-05 Thread Charles K. Clarkson
David Storrs [EMAIL PROTECTED] wrote: : : I was trying to avoid prototypes, because I wanted : people to be able to pass the arguments in as : function(@args), but maybe this is the way to go. : Or maybe I just won't worry about it. From your other posts it seems like your trying to avoid a

Re: testing an argument's type

2003-07-05 Thread David Storrs
On Sat, Jul 05, 2003 at 12:29:46PM -0400, Bob Showalter wrote: David Storrs wrote: I've got a function that takes several arguments, the first of which should be a scalar (specifically, a string). I'd like to have a precondition to verify that the argument is, in fact, a scalar. Is

testing an argument's type

2003-07-04 Thread David Storrs
I've got a function that takes several arguments, the first of which should be a scalar (specifically, a string). I'd like to have a precondition to verify that the argument is, in fact, a scalar. Is there a way to do that (preferably without using modules--I'm trying to write an entirely

Re: testing an argument's type

2003-07-04 Thread Casey West
It was Friday, July 04, 2003 when David Storrs took the soap box, saying: : I've got a function that takes several arguments, the first of which : should be a scalar (specifically, a string). I'd like to have a : precondition to verify that the argument is, in fact, a scalar. Is : there a way to

Re: testing an argument's type

2003-07-04 Thread Steve Grazzini
On Fri, Jul 04, 2003 at 02:18:40PM -0700, David Storrs wrote: I've got a function that takes several arguments, the first of which should be a scalar (specifically, a string). I'd like to have a precondition to verify that the argument is, in fact, a scalar. I'll recommend that you

Re: testing an argument's type

2003-07-04 Thread John W. Krahn
David Storrs wrote: I've got a function that takes several arguments, the first of which should be a scalar (specifically, a string). I'd like to have a precondition to verify that the argument is, in fact, a scalar. Is there a way to do that (preferably without using modules--I'm trying

Testing to see if a socket is in use

2003-06-17 Thread Motherofperls
I'm curious if it's possible to make a web page that controls: 1. testing to see if a socket is available 2. if not searching for another socket # 3. use html buttons to open and close sockets. Does anyone have an example of this?

Testing.....

2003-03-07 Thread Li Ngok Lam

Testing.....

2003-03-07 Thread Li Ngok Lam

RE: image property testing... take II

2003-02-28 Thread Ramón Chávez
Wilson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 27, 2003 11:06 AM Subject: image property testing... take II ok, i have cleaned up the code, and fixed all of the mistakes that i can find, but i still can't get this tying to compile and run. and, my code surely isn't written

RE: image property testing... take II

2003-02-28 Thread Dan Muey
11:06 AM Subject: image property testing... take II ok, i have cleaned up the code, and fixed all of the mistakes that i can find, but i still can't get this tying to compile and run. and, my code surely isn't written stout enough to handle a 'use strict'. if someone could

image property testing... take II

2003-02-27 Thread Shawn Wilson
ok, i have cleaned up the code, and fixed all of the mistakes that i can find, but i still can't get this tying to compile and run. and, my code surely isn't written stout enough to handle a 'use strict'. if someone could tell me what i am STILL doing wrong i'd appreciate it. The Code:

RE: image property testing... take II

2003-02-27 Thread Dan Muey
ok, i have cleaned up the code, and fixed all of the mistakes that i can find, but i still can't get this tying to compile and run. and, my code surely isn't written stout enough to handle a 'use strict'. if someone could tell me what i am STILL doing wrong i'd appreciate it. The

Re: image property testing... take II

2003-02-27 Thread R. Joseph Newton
Shawn Wilson wrote: ... my code surely isn't written stout enough to handle a 'use strict'. if someone could tell me what i am STILL doing wrong i'd appreciate it. Hi Shawn, Please re-examine your operating precepts. By not using strict, you are passing up the best help you can get. If

image property testing program.

2003-02-26 Thread Shawn Wilson
This is pretty much my first perl program, so please escuse me if there are loads of errors, but i only get two reported to me which i can't figure out, any help would be appreciated. #!/usr/bin/perl use File::Find; use File::Removeqw(remove); use Image::Info; use File::Scan; sub

Re: image property testing program.

2003-02-26 Thread John W. Krahn
Shawn Wilson wrote: This is pretty much my first perl program, so please escuse me if there are loads of errors, but i only get two reported to me which i can't figure out, any help would be appreciated. #!/usr/bin/perl You should enable warnings and strict while developing your program.

Ignore. Just Testing

2002-11-08 Thread Michael J Alexander
Tried to send something yesterday but it didn't go through. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.408 / Virus Database: 230 - Release Date: 10/24/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

RE: Testing for hidden or system files

2002-10-27 Thread ss004b3324
Hi, Does anyone know how to test for a hidden or system file under Windows 95/2000? This works: use strict; use Win32::File; my $attr; my $file = 'C:\Perl\Scripts\test.txt'; Win32::File::GetAttributes($file,$attr ); if ($attr HIDDEN || $attr SYSTEM) { print $file attributes are:

Testing for hidden or system files

2002-10-26 Thread Tin-Shan Chau
Does anyone know how to test for a hidden or system file under Windows 95/2000? Thanks in advance for your help.

Re: Testing for hidden or system files

2002-10-26 Thread Tanton Gibbs
file!; } elsif( $fileattr SYSTEM ) { print System file!; } Tanton - Original Message - From: Tin-Shan Chau [EMAIL PROTECTED] To: Help on PERL [EMAIL PROTECTED] Sent: Saturday, October 26, 2002 6:34 PM Subject: Testing for hidden or system files Does anyone know how to test

RE: File testing

2002-09-25 Thread Bob Showalter
-Original Message- From: Thomas 'Gakk' Summers [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 25, 2002 8:34 AM To: [EMAIL PROTECTED] Subject: File testing Warning: Perl Novice Alert! I'm trying to: 1. read in a list of files, 2. test for text, 3. convert the text

RE: File testing

2002-09-25 Thread Shishir K. Singh
-Original Message- From: Thomas 'Gakk' Summers [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 25, 2002 8:34 AM To: [EMAIL PROTECTED] Subject: File testing Warning: Perl Novice Alert! I'm trying to: 1. read in a list of files, 2. test for text, 3. convert the text files from '\n

Re: File testing

2002-09-25 Thread Thomas 'Gakk' Summers
. Singh [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... -Original Message- From: Thomas 'Gakk' Summers [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 25, 2002 8:34 AM To: [EMAIL PROTECTED] Subject: File testing Warning: Perl Novice Alert! I'

RE: File testing

2002-09-25 Thread david
Bob Showalter wrote: A more idiomatic way to write this is: for my $i (0 .. @files) { you probably mean: for my $i (0 .. $#files){ } the range operator is inclusive. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: File testing

2002-09-25 Thread John W. Krahn
Thomas 'Gakk' Summers wrote: Warning: Perl Novice Alert! I'm trying to: 1. read in a list of files, 2. test for text, 3. convert the text files from '\n' unix to '\r\n' dos 4. write them to a temporary location. The code below produces an error: 'Use of uninitialized value in -f

Re: File testing

2002-09-25 Thread Thomas 'Gakk' Summers
Thanks for your help. I rewrote it using a mix of your suggestions and it works fine now. FYI: The 'chomp' statement was eliminating the '/n' so the pattern match was not occuring. That's fixed now too. Tom. Thomas 'Gakk' Summers [EMAIL PROTECTED] wrote in message [EMAIL

testing CGI without webserver on NT?

2002-06-10 Thread Alaric J. Hammell
On Windows2000. I have an html page that calls a perl script in a form but IE does not execute the script but rather asks that it be downloaded. Perl is installed in E:\foo\Perl and not the usual C:\Perl directory. could this have something to do with it? Thanks, Al -- To unsubscribe,

RE: testing CGI without webserver on NT?

2002-06-10 Thread Mike Rapuano
] Cc: Subject: testing CGI without webserver on NT? On Windows2000. I have an html page that calls a perl script in a form but IE does not execute the script but rather asks that it be downloaded. Perl

RE: Testing for command success

2002-05-07 Thread Ho, Tony
: 07 May 2002 17:38 To: [EMAIL PROTECTED] Subject: Testing for command success I'd like to test the following command to see if it ran successfully? Have no idea how or which variable stores the success of a command ($!, $], $_ )? system tar cvf ../test.tar *.grib; Tried: if (system tar cvf

Re: Testing for command success

2002-05-07 Thread Chas Owens
On Tue, 2002-05-07 at 11:37, siren jones wrote: I'd like to test the following command to see if it ran successfully? Have no idea how or which variable stores the success of a command ($!, $], $_ )? system tar cvf ../test.tar *.grib; Tried: if (system tar cvf ../test.tar *.grib;)

RE: Testing for command success

2002-05-07 Thread Timothy Johnson
The return code is also returned by the system() function. It looks to me like the system isn't understanding what you're sending to it. Maybe you could try single quotes? -Original Message- From: Ho, Tony To: 'siren jones'; [EMAIL PROTECTED] Sent: 5/7/02 8:46 AM Subject: RE: Testing

Testing for Success

2002-05-07 Thread siren jones
Tony and Chas, thanks for the help. First problem was using switched from DOS PC to UNIX system which had no idea what #! c:\perl was since it wanted #! /usr/global/perl. Don't really understand how $exit_value = $? 8; $signal_num = $? 127; $dumped_core = $?

Re: Testing for Success

2002-05-07 Thread Jonathan E. Paton
Yeah, Tony your sturcture worked fine... except system tar cvf ./test.tar *.grib if ($? == 0) { print \nSuccess!\n; } else { print \nUnsuccessful!\n; } Perl programmers are lazy, and don't use things like '== 0' almost 100% of the time. The following should work

Re: developing and testing first CGI/Perl application

2002-05-03 Thread drieux
On Friday, May 3, 2002, at 06:22 , Maureen E Fischer wrote: I am about to write my first CGI/Perl application. I have read Learning Perl and I now am reading the Castro Perl and CGI book and the O'Reilly CGI book. I was going to write and test my work using IIS on Windows because it

Re: developing and testing first CGI/Perl application

2002-05-03 Thread james
drieux, i've been monitoring this list and couldn't help but notice the volume of your posts. i have to ask: do you ever sleep? :) james - Original Message - From: drieux [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: May 03, 2002 08:45 Subject: Re: developing and testing first CGI/Perl

Re: developing and testing first CGI/Perl application

2002-05-03 Thread Tor Hildrum
From: james [EMAIL PROTECTED] Date: Fri, 3 May 2002 08:54:49 -0500 To: [EMAIL PROTECTED] Subject: Re: developing and testing first CGI/Perl application drieux, i've been monitoring this list and couldn't help but notice the volume of your posts. i have to ask: do you ever sleep

RE: developing and testing first CGI/Perl application

2002-05-03 Thread Nikola Janceski
To: Perl Subject: Re: developing and testing first CGI/Perl application From: james [EMAIL PROTECTED] Date: Fri, 3 May 2002 08:54:49 -0500 To: [EMAIL PROTECTED] Subject: Re: developing and testing first CGI/Perl application drieux, i've been monitoring this list and couldn't

[ WAY OT ]Re: developing and testing first CGI/Perl application

2002-05-03 Thread drieux
On Friday, May 3, 2002, at 06:54 , james wrote: [..] i've been monitoring this list and couldn't help but notice the volume of your posts. i have to ask: do you ever sleep? when I can. ( no smiley ) :) james may I recommend: http://www.wetware.com/drieux/screeds/LiNox.html actually you

Testing for null strings and/or input...

2002-04-23 Thread Ron Powell
Basically, I have 30 records in one file and another file with 25 records... these files are opened for reading, a record from the first file is paired with a record from the second file and output a 3rd file. Obviously, the first 25 records are fine, but the last five records are being paired

Re: Testing for null strings and/or input...

2002-04-23 Thread Chas Owens
On Tue, 2002-04-23 at 17:00, Ron Powell wrote: Basically, I have 30 records in one file and another file with 25 records... these files are opened for reading, a record from the first file is paired with a record from the second file and output a 3rd file. Obviously, the first 25 records

Problem testing variable

2002-04-05 Thread Glenn Cannon
open (RSTDATA, rst/r.$event..rst)|| print Oops; $winner = RSTDATA; if ($winner eq na) { print FinalistsbrDid Not Play; } else { print $winner; } Why does the above code always print the value of $winner, and never FinalistsbrDid Not Play, even when the line of text in the file is just the

RE: Problem testing variable

2002-04-05 Thread Nikola Janceski
, April 05, 2002 3:57 PM To: [EMAIL PROTECTED] Subject: Problem testing variable open (RSTDATA, rst/r.$event..rst)|| print Oops; $winner = RSTDATA; if ($winner eq na) { print FinalistsbrDid Not Play; } else { print $winner; } Why does the above code always print the value of $winner

Re: Problem testing variable

2002-04-05 Thread Agustin Rivera
chomp($winner) before your if statements. or do if ($winner eq na\n) Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com - Original Message - From: Glenn Cannon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 05, 2002 12:56 PM Subject: Problem testing variable

RE: Problem testing variable

2002-04-05 Thread Balint, Jess
You may want to cycle through the file, line by line: while(RSTDATA){ chomp; if( . . . } } That should do it. -Original Message- From: Glenn Cannon [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 3:57 PM To: [EMAIL PROTECTED] Subject: Problem testing

Testing for unimplemented

2002-03-30 Thread Jonathan E. Paton
i list, I'll swap from answering questions to asking question today. Hopefully, I wouldn't be the only person to learn something this way :) Anyway, within some code (a module for CPAN actually), I want to write: alarm $timeout unless not implemented(alarm); which reads rather nicely.

RE: Testing for filehandles

2002-03-28 Thread Bob Showalter
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 6:16 PM To: Beginners Perl Mailing List Subject: RE: Testing for filehandles On Wed, 27 Mar 2002, Bob Showalter wrote: You can pass a filehandle glob to IO::Handle::opened

RE: Testing for filehandles

2002-03-28 Thread eric-perl
maybe should be defined(fileno(F)) Since 0 is a valid file number (STDIN). So, technically, I should be testing for definedness instead of truth. i.e., From `perldoc -f fileno`: Returns the file descriptor for a filehandle, or undefined if the filehandle is not open. If you're

Testing for filehandles

2002-03-27 Thread eric-perl
Hello, All: I've looked around for an answer to this (The Camel Book, The Ram Book, perldoc, google.com, etc.) but can't find a thing: Is it possible to test for the existence of a filehandle? I've got a small script that optionally opens a filehandle. If that filehandle exists, I'd like to

RE: Testing for filehandles

2002-03-27 Thread Timothy Johnson
You'd probably have better luck testing for the open() command's success use Getopts::Std; getopts(n); if($opt_n){ open(OPT_LOG,/tmp/foo.txt) || die Could not open foo.txt!\n; } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 12

Re: Testing for filehandles

2002-03-27 Thread Chas Owens
On Wed, 2002-03-27 at 15:18, [EMAIL PROTECTED] wrote: Hello, All: I've looked around for an answer to this (The Camel Book, The Ram Book, perldoc, google.com, etc.) but can't find a thing: Is it possible to test for the existence of a filehandle? I've got a small script that optionally

RE: Testing for filehandles

2002-03-27 Thread eric-perl
Tim: I know, I know: I excluded the or die portion for readability/simplicity. On Wed, 27 Mar 2002, Timothy Johnson wrote: You'd probably have better luck testing for the open() command's success I wrote: use Getopts::Std; getopts(n); open(OPT_LOG,/tmp/foo.txt) if ($opt_n); while

Re: Testing for filehandles

2002-03-27 Thread Agustin Rivera
Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 27, 2002 1:32 PM Subject: RE: Testing for filehandles You'd probably have better luck testing for the open() command's success use Getopts::Std; getopts(n); if($opt_n){ open(OPT_LOG,/tmp/foo.txt) || die Could not open foo.txt!\n

RE: Testing for filehandles

2002-03-27 Thread Timothy Johnson
, 2002 1:46 PM To: Timothy Johnson; Beginners Perl Mailing List Subject: Re: Testing for filehandles How would that work with use strict;? I tried it once and when I declared my $opt_n before using getopts, it wouldn't work. Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com

Re: Testing for filehandles

2002-03-27 Thread eric-perl
On Wed, 27 Mar 2002, Agustin Rivera wrote: How would that work with use strict;? I tried it once and when I declared my $opt_n before using getopts, it wouldn't work. Agustin: From the Getopt::Std man page: Note that, if your code is running under the recommended `use strict

Re: Testing for filehandles

2002-03-27 Thread Chas Owens
] Sent: Wednesday, March 27, 2002 1:32 PM Subject: RE: Testing for filehandles You'd probably have better luck testing for the open() command's success use Getopts::Std; getopts(n); if($opt_n){ open(OPT_LOG,/tmp/foo.txt) || die Could not open foo.txt!\n; } -Original

Re: Testing for filehandles

2002-03-27 Thread eric-perl
On 27 Mar 2002, Chas Owens wrote: Getopt::Std creates the $opt_n variables. To use it with use strict; in place you must use the use vars ($opt_n); pragma as well. or just use the getopts('n', \%opts); call. Then you can say $opts{n}. Agustin: Also from the Getopt::Std man page:

RE: Testing for filehandles

2002-03-27 Thread Bob Showalter
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 3:18 PM To: Beginners Perl Mailing List Subject: Testing for filehandles Hello, All: I've looked around for an answer to this (The Camel Book, The Ram Book, perldoc

Re: Testing for filehandles

2002-03-27 Thread Agustin Rivera
Owens [EMAIL PROTECTED] To: Agustin Rivera [EMAIL PROTECTED] Cc: Beginners Perl Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 27, 2002 1:51 PM Subject: Re: Testing for filehandles Getopt::Std creates the $opt_n variables. To use it with use strict; in place you must use the use vars ($opt_n

Re: Testing for filehandles

2002-03-27 Thread eric-perl
On Wed, 27 Mar 2002, Agustin Rivera wrote: Ok, I've tried it both ways and it returns 1 (true) as the value. What am I doing wrong? Agustin: 1. What *exactly* do you mean both ways? 2. References... From the Getopt::Std man page: getopt('oDI'); # -o, -D -I take arg. Sets

RE: Testing for filehandles

2002-03-27 Thread eric-perl
On Wed, 27 Mar 2002, Bob Showalter wrote: You can pass a filehandle glob to IO::Handle::opened(): Thanks, Bob! After reading the IO::Handle man page, I decided to distill this approach a bit further: print F if fileno(F); -- Eric P. Los Gatos, CA -- To unsubscribe, e-mail: [EMAIL

Re: testing for a dir

2002-02-02 Thread Jonathan E. Paton
--- Alex Harris [EMAIL PROTECTED] wrote: What is the best way, using rsh, to test if a directory exists on another server? Don't use rsh, it writes passwords on the back of postcards and posts it to every employee in the building, possibily outside it too. Or in other words: rsh DOES NOT

Re: testing for a dir

2002-02-01 Thread Jason Purdy
Well, I'm not sure about rsh, but with ssh: ssh www.journalistic.com perl -e 'print ( (-d \data\) ? \DIR\n\ : \Not DIR\n\ );' Change data to whatever your dirname is... Jason If memory serves me right, on Friday 01 February 2002 10:18, Alex Harris wrote: What is the best way, using rsh, to

help needed with testing variable in an if statement

2002-01-21 Thread A Taylor
Hi all, I am trying to test three variables in an 'if' statement eg: if ($a eq abc and $b eq efg and $c eq hi) { do some code . } how do i do this in perl Thanks in advance Anadi _ Send and receive Hotmail on your

Re: help needed with testing variable in an if statement

2002-01-21 Thread Vicky Lorenzo
Hi Anadi, Hope this helps: #!/tools/bin/perl -w print enter a number\n; $a = STDIN; if ($a == 12 or $a== 8) {print right\n;} else {print incorrect\n;} #end of script -vicky --- A Taylor [EMAIL PROTECTED] wrote: Hi all, I am trying to test three variables in an 'if' statement eg: if

RE: help needed with testing variable in an if statement

2002-01-21 Thread Thisell, Andrea
. if ($answer eq N or $answer eq NO) { fatal_error(Error message.); } -Andrea -Original Message- From: A Taylor [mailto:[EMAIL PROTECTED]] Sent: Monday, January 21, 2002 11:57 a To: [EMAIL PROTECTED] Subject: help needed with testing variable in an if statement Hi all, I am

Sorry, just Testing...

2002-01-05 Thread Connie Chan

Re: testing input/loops

2001-12-19 Thread Chris Zubrzycki
wow, thanks. this is the closest to what i wanted to do first, so i'll use this. my $response = 0; while ( $response != 1 and $response != 2 and $response != 3 ) { print What would like to do?\n; print 1. Start a new file\n; print 2.

testing input/loops

2001-12-18 Thread Chris Zubrzycki
Hey everybody. I have a simple problem that has been stumping me. I'm using Perl 5.6.1 on Mac OS X 10.1.1. This is a sub for opening a file in my program. this is the sub, and the problem is when i run it, if i do not enter a number 1-3, it keeps asking me forever to enter a number. Even if

RE: testing input/loops

2001-12-18 Thread McCollum, Frank
other statements here }; } -Original Message- From: Chris Zubrzycki [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 18, 2001 4:45 PM To: [EMAIL PROTECTED] Subject: testing input/loops Hey everybody. I have a simple problem that has been stumping me. I'm using Perl 5.6.1 on Mac OS X

Re: testing input/loops

2001-12-18 Thread Curtis Poe
--- Chris Zubrzycki [EMAIL PROTECTED] wrote: Hey everybody. I have a simple problem that has been stumping me. I'm using Perl 5.6.1 on Mac OS X 10.1.1. This is a sub for opening a file in my program. this is the sub, and the problem is when i run it, if i do not enter a number 1-3, it

RE: testing input/loops

2001-12-18 Thread Peter Cornelius
This doesn't do what you think it does. unless ($response eq '1' || '2' || '3') It says, unless the response was eq to 1, or if 2 is true, or if 3 is true. 2 and 3 are true by definition so this will always be true. I think you want unless ($response eq '1' or

<    1   2   3   4   >