Re: Test for empty list

2003-03-07 Thread R. Joseph Newton
Jeroen Lodewijks wrote: > Hi all, > > Is there anybody out there who has a code snippet to test if a list is empty? > (a list is empty if all elements are either undefined or 0 or have an empty > string) > > Ofcourse I can do this: > > my $str = ''; > my $elem; > > my (@test) = (undef, ''); #put a

Re: special caracters in variables in patternmatching

2003-03-07 Thread R. Joseph Newton
Rob Dixon wrote: > Hi Scott, Francesco. > > Scott R. Godin wrote: > > Francesco Del Vecchio wrote: > > > > > suppose this: > > > == > > > $string 'I saw Roger and I said :roger? what the @*$!'; > > > > > > $var1 = "roger? what the @*$!"; > > > $var2 = "Hi roger.

Re: Someone DO explain this to me!

2003-03-07 Thread R. Joseph Newton
Jenda Krynicky wrote: > Welcome to psh 0.7.1 by [EMAIL PROTECTED] > Running under Perl 5.008 > > psh$ do {print '.';print ':';} while ($x++ < 10); > .:.:.:.:.:.:.:.:.:.:.: > psh$ do {print '.';print ':';} while ($x++ < -10); > .: > psh$ do {print '.';print ':';last} while ($x++ < 10); > .: > c:\te

RE: why objects?

2003-03-07 Thread Paul
> > > - easier for other people to maintain even years from now > > > - easier to migrate and expand > > > - objects make it easier to interface and work with other things, > > > consistantly and without much effort > > > - decrease cost( time, money, space, prcessing power ) > > > > Agreed, agre

RE: Handling race conditions

2003-03-07 Thread Bakken, Luke
> Sorry to harp on this, but a lock file will not work in every > case. Shared > memory will not work. Every implementation of this results > in code that has > to: > > 1) check for lock > 2) lock The following should be atomic, and thus can be used for a **simple** locking mechanism: use Fc

RE: Handling race conditions

2003-03-07 Thread LoBue, Mark
> -Original Message- > From: Bakken, Luke [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 06, 2003 4:47 PM > To: Michael Weber; [EMAIL PROTECTED] > Subject: RE: Handling race conditions > > > It sounds like you need two things: > > 1. A faster way of storing "seen" IPs. > 2. A lock mec

Re: Help with File::Find

2003-03-07 Thread Steve Grazzini
James Kipp <[EMAIL PROTECTED]> writes: > > Thanks Steve. > So I could use either one of these methods, like: > > # skip dirs with Profile > find { > preprocess => sub { grep !/Profile/, @_ }, > wanted => sub { print if ($File::Find::name =~ /.*\.pst$/) } > }, 'f:/users/user1';

Re: How do I keep track of user selections?

2003-03-07 Thread John W. Krahn
Meriwether Lewis wrote: > > Hi Gurus! Hello, > I currently am displaying a list of choices for > the user to select: > > 1. 1996 Corvette > 2. 2001 Hummer > 3. 1985 Blazer > 4. 1987 Firebird > > I'm asking the user to enter a comma separated > list of their choices. > > If the user enters: >

RE: Help with File::Find

2003-03-07 Thread Kipp, James
Steve's suggestions worked great for ignoring or not recursing directories, but I am unable to filter out all directories not named "My Documents" . I have tried using regex and grep to filter them out but no luck this fails, just goes to the root directory and exits, and the docs really don't sa

Re: How to check ASCII chars in perl ?

2003-03-07 Thread John W. Krahn
Madhu Reddy wrote: > > Hi, Hello, > I want to check for some ASCII chars in perl like > following "C" code.. The following code checks for "printable" characters not ASCII characters. > How to do this in Perl ? > follwing will work in perl ? > > for($i=0;$i < length;$i++) { > if (($_[$i] <

RE: How to check ASCII chars in perl ?

2003-03-07 Thread david
David --- Senior Programmer Analyst --- Wgo Wagner wrote: >> i don't thing the above will work. try: >> >> for(split(//)){ >> if(ord < 32 || ord > 126){ >> print "Char is non printable char\n"; >> }else{ >> print "$_\n"; >> } >> } >> >> david > > I got it to run but I had to add () to each ord

RE: How to check ASCII chars in perl ?

2003-03-07 Thread Wagner, David --- Senior Programmer Analyst --- WGO
David Zhuo wrote: > On Friday 07 March 2003 13:26, Madhu Reddy wrote: >> Hi, >> I want to check for some ASCII chars in perl like following "C" >> code.. >> >> How to do this in Perl ? >> follwing will work in perl ? >> >> for($i=0;$i < length;$i++) { >> if (($_[$i] < 32) || (($_[$i] > 126)) {

Re: trying to match variable names

2003-03-07 Thread John W. Krahn
Rob Dixon wrote: > > John W. Krahn wrote: > > Greg Carrara wrote: > > > > > > Hello, > > > > Hello, > > > > > I'm trying to write a script that reads a file line by line and if > > > the line contains a space it puts quotation marks around it and > > > writes it to another file. I mostly have thi

Re: How to check ASCII chars in perl ?

2003-03-07 Thread David Zhuo
On Friday 07 March 2003 13:26, Madhu Reddy wrote: > Hi, > I want to check for some ASCII chars in perl like > following "C" code.. > > How to do this in Perl ? > follwing will work in perl ? > > for($i=0;$i < length;$i++) { > if (($_[$i] < 32) || (($_[$i] > 126)) { > print "Char is non printable

How do I keep track of user selections?

2003-03-07 Thread meriwether lewis
Hi Gurus! I currently am displaying a list of choices for the user to select: 1. 1996 Corvette 2. 2001 Hummer 3. 1985 Blazer 4. 1987 Firebird I'm asking the user to enter a comma separated list of their choices. If the user enters: 1,3,4 I need to store the year and make of their selection

How to check ASCII chars in perl ?

2003-03-07 Thread Madhu Reddy
Hi, I want to check for some ASCII chars in perl like following "C" code.. How to do this in Perl ? follwing will work in perl ? for($i=0;$i < length;$i++) { if (($_[$i] < 32) || (($_[$i] > 126)) { print "Char is non printable char\n"; } } following is C code for(i=0;i<(int)strlen(Buffer);

how to do this in perl

2003-03-07 Thread Xiongfei Wang
I am very new to perl. i need to write a simple user log system if you go to http://apidb.org/regstragreement.html after you click agree, you will be direct to regiser page. http://apidb.org/regstr.html now if you click directly http://apidb.org/regstr.html you will be able to go to the same

RE: why objects?

2003-03-07 Thread david
Paul wrote: > > > Agreed, agreed, agreed, agreed, and agreed, but they don't take my word > for it. I need a way to prove it. :o/ > the very fact that Perl supports OO is the prove that Larry thinks OO is a good thing. Now tell me your coworkers don't take Larry's work. :-) david -- To unsub

RE: Help with File::Find

2003-03-07 Thread Kipp, James
> Of course. > > #!/usr/bin/perl -l > > use File::Find; > use warnings; > > # > # ignore > # > find { > preprocess => sub { grep $_ ne __FILE__, @_ }, > wanted => sub { print } > }, "."; > > # > # don't recurse > # > find sub { > if ($_ eq __FILE__) { ++

Re: OpenFile and search

2003-03-07 Thread Bryan DeLuca
You should really get one of the fine Perl books by O'reilly or spend at least a little time learning Perl. The eample below example will take a user supplied regex pattern and search for those lines that contain the regex and precede the line with a '#'. Here is an example: #!/usr/bin/perl -w #

OpenFile and search

2003-03-07 Thread [EMAIL PROTECTED]
Hi perlians, How can make to open a file and search on it some character to remove or comment. Sorry but I'am a newbie++newbiw about the fantastic language Perl and now for me it's very difficult approach an algorithm. Does someone here can you help me with small example. Many thanks at all. Mar

Re: Help with File::Find

2003-03-07 Thread Steve Grazzini
James Kipp <[EMAIL PROTECTED]> writes: > Is there a way to get File::Find to TOTALLY ignore a directory?? Of course. #!/usr/bin/perl -l use File::Find; use warnings; # # ignore # find { preprocess => sub { grep $_ ne __FILE__, @_ }, wanted => sub { print } }, ".";

Help with File::Find

2003-03-07 Thread Kipp, James
Hi Is there a way to get File::Find to TOTALLY ignore a directory?? See comments in code for what I mean: find ( \&wanted, 'f:/users/user1'); sub wanted { ## HERE: even though it returns when it sees a dir called # with Profile, it comes right back to where it left of, in other

RE: why objects?

2003-03-07 Thread wiggins
On Fri, 7 Mar 2003 07:56:29 -0800 (PST), Paul <[EMAIL PROTECTED]> wrote: > > --- Dan Muey <[EMAIL PROTECTED]> wrote: > > A noble task indeed! > > I don't know of any links right off but here's a couple shorties : > > - easier for other people to m

RE: print output from HTML::Parser

2003-03-07 Thread wiggins
On Fri, 7 Mar 2003 16:42:39 +, [EMAIL PROTECTED] wrote: > Hi all > > perl script below works, and does what I hoped it would, but I don't seem > to understand how to get it to print out the result to a new file as > opposed to stdout. > > Tha

RE: Commands inside a reg-ex substitution problems

2003-03-07 Thread wiggins
On Fri, 7 Mar 2003 09:29:25 -0600 , Jensen Kenneth B SrA AFPC/DPDMPQ <[EMAIL PROTECTED]> wrote: > Perldoc's aren't available on our systems. Guessing they were not part of > perl4, or were not installed when perl4 was installed. Are the perldocs >

RE: print output from HTML::Parser

2003-03-07 Thread Dan Muey
> Hi all > > perl script below works, and does what I hoped it would, but > I don't seem to understand how to get it to print out the > result to a new file as opposed to stdout. > > Thanks for any help > > #!/usr/bin/perl -w > use strict; > use HTML::Parser; > > open(OUT, ">/share/file1")

RE: print output from HTML::Parser

2003-03-07 Thread Hanson, Rob
You need to specify the filehandle when you print, the default is STDOUT. text_h => [sub{ print OUT shift;}, 'dtext'], start_h => [sub{ print OUT shift;}, 'text'], end_h=> [sub{ print OUT shift;}, 'text']); ...At least I think that should work. Rob -Original Message- From: [EMAIL

RE: CG I Script [guestbook.cgi]

2003-03-07 Thread Hanson, Rob
What is the exact error? It should give a pretty good hintn as what is going on. If you don't have access to the web logs, try using "use CGI::Carp qw(fatalsToBrowser);" at the top of the script. Rob -Original Message- From: Mr. Horace Franklin Jr. [mailto:[EMAIL PROTECTED] Sent: Frida

print output from HTML::Parser

2003-03-07 Thread Steven_Massey
Hi all perl script below works, and does what I hoped it would, but I don't seem to understand how to get it to print out the result to a new file as opposed to stdout. Thanks for any help #!/usr/bin/perl -w use strict; use HTML::Parser; open(OUT, ">/share/file1") || die "Cannot open /share/fil

RE: CG I Script [guestbook.cgi]

2003-03-07 Thread Dan Muey
> > Clear DayI tired to run the script below on my host server > and it would not run. The server cannot find Taintcheck or > Timefuncs. I uploaded these pm file to the server. What did You don't simply upload the pm files they have to be instsalled On the server. Perl -MCPAN -e shell CPAN

CG I Script [guestbook.cgi]

2003-03-07 Thread Mr. Horace Franklin Jr.
Clear DayI tired to run the script below on my host server and it would not run. The server cannot find Taintcheck or Timefuncs. I uploaded these pm file to the server. What did I do wrong? Is Apache the problem? SERVER INFORMATION: Path to Perl: /usr/local/bin/perl Path to Sendmail: /usr/sbi

RE: why objects?

2003-03-07 Thread Dan Muey
> --- Dan Muey <[EMAIL PROTECTED]> wrote: > > A noble task indeed! > > I don't know of any links right off but here's a couple shorties : > > - easier for other people to maintain even years from now > > - easier to migrate and expand > > - objects make it easier to interface and work with other t

RE: trying to match variable names

2003-03-07 Thread Carrara, Greg
You're right! I posted before I realized. But thanks to all who responded. I can do exactly what I need! -Original Message- From: Mark Anderson [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 5:47 PM To: Carrara, Greg; [EMAIL PROTECTED] Subject: RE: trying to match variable name

RE: why objects?

2003-03-07 Thread Paul
> > - easier for other people to maintain even years from now > > - easier to migrate and expand > > - objects make it easier to interface and work with other things, > > consistantly and without much effort > > I agree with what Dan said, but I think it is important to emphasize > the very impo

Re: Help! What am I doing wrong?

2003-03-07 Thread Rob Dixon
Meriwether Lewis wrote: > Hi Experts! > > Hoping someone can help me out. Here goes... > bear with me, please. > I have a file that contains a few email > addresses. I read this file and push each line > into an array: > > push(@AddrArray, $_); > > Then I do a foreach on the contents of the > arra

RE: Commands inside a reg-ex substitution problems

2003-03-07 Thread Jensen Kenneth B SrA AFPC/DPDMPQ
Perldoc's aren't available on our systems. Guessing they were not part of perl4, or were not installed when perl4 was installed. Are the perldocs available on the web? -Original Message- From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 7:11 PM To: Jensen Ke

Re: Test for empty list

2003-03-07 Thread Rob Dixon
Hello Jeroen. Jeroen Lodewijks wrote: > Hi all, > > Is there anybody out there who has a code snippet to test if a list > is empty? (a list is empty if all elements are either undefined or 0 > or have an empty string) > > Ofcourse I can do this: > > my $str = ''; > my $elem; > > my (@test) = (unde

RE: why objects?

2003-03-07 Thread Paul
--- Dan Muey <[EMAIL PROTECTED]> wrote: > A noble task indeed! > I don't know of any links right off but here's a couple shorties : > - easier for other people to maintain even years from now > - easier to migrate and expand > - objects make it easier to interface and work with other things, > con

RE: why objects?

2003-03-07 Thread wiggins
On Fri, 7 Mar 2003 09:20:42 -0600, "Dan Muey" <[EMAIL PROTECTED]> wrote: > A noble task indeed! > > - easier for other people to maintain even years from now > - easier to migrate and expand > - objects make it easier to interface and work with o

RE: cpan problems

2003-03-07 Thread Dan Muey
> > CPAN> install Bundel::CPAN > ^^ > > Hmm, that should be Bundle, shouldn't it ?! Good point. I typed that part in then decided to show the output so I pasted that in. Anither victum of hunt and peck!! ;p > > > Cheerio, > Janek > > -- To unsubscribe, e-mail: [EMAIL PR

Re: special caracters in variables in patternmatching

2003-03-07 Thread Rob Dixon
Hi Scott, Francesco. Scott R. Godin wrote: > Francesco Del Vecchio wrote: > > > suppose this: > > == > > $string 'I saw Roger and I said :roger? what the @*$!'; > > > > $var1 = "roger? what the @*$!"; > > $var2 = "Hi roger...nice to meet you"; > > > > $string=~

RE: why objects?

2003-03-07 Thread Dan Muey
A noble task indeed! I don't know of any links right off but here's a couple shorties : - easier for other people to maintain even years from now - easier to migrate and expand - objects make it easier to interface and work with other things, consistantly and without much effort - decrease cost(

Re: Simple Regex Problem.

2003-03-07 Thread Rob Dixon
Hi Scott. Scott R. Godin wrote: > Rob Dixon wrote: > > > Paul Johnson wrote: > > > Rob Dixon said: > > > > > > > $data =~ m/ <([^>]*)> /x; > > > > my $newdata = $1; > > > > > > And if the match fails? > > > > Well I think it's likely that you'd want to do: > > > > $data =~ m/ <([^>]*)>

Re: Test for empty list

2003-03-07 Thread pete peterson
On Fri, 07 Mar 2003 05:53:54 -0500, Jeroen Lodewijks wrote: > Hi all, > > Is there anybody out there who has a code snippet to test if a list is empty? > (a list is empty if all elements are either undefined or 0 or have an empty > string) > > Ofcourse I can do this: > > my $str = ''; > my $el

Re: Someone DO explain this to me!

2003-03-07 Thread Jenda Krynicky
From: Jeff Westman <[EMAIL PROTECTED]> > Jenda, > > You CANNOT do what you are suggesting. I tried it. I DID! I don't understand what's going on. It worked fine without any warnings/errors yesterday. And now it does not work at all neither in Perl 5.6.1 nor 5.8. But if I look at the CommandP

Re: not able to set repository

2003-03-07 Thread Ben Marsh
* Pradeep Goel ([EMAIL PROTECTED]) wrote: > its 3.0.1 > & perl is 5.8 In which case the command format is changed to repository add RothConsulting http://www.roth.net/perl/packages Ben Marsh > > & my time is quite bad these days :) > > Thanks & regards > Pradeep > > - Original Messa

Testing.....

2003-03-07 Thread Li Ngok Lam

tnx to Scott Godin

2003-03-07 Thread Francesco del Vecchio
First, I'm really sorry...I didn't want to send you a personal email...I pushed Reply instead of Reply All Second, Scott...you are great!...I solved my problem with your suggestion. Thank a lot...this is a great mailing list!!! --- "Scott R. Godin" <[EMAIL PROTECTED]> wrote: > Two things: > >

Re: Someone DO explain this to me!

2003-03-07 Thread Randal L. Schwartz
> "Jeff" == Jeff Westman <[EMAIL PROTECTED]> writes: Jeff> According to the perl documentation because 'do' is a STATEMENT, you Jeff> cannot use LOOP CONSTRUCTS (next, last). Well, a do-block is not a statement, but an expression. do-block followed by a semicolon would be a statement. --

Re: Someone DO explain this to me!

2003-03-07 Thread Randal L. Schwartz
> "Dave" == Dave K <[EMAIL PROTECTED]> writes: Dave> My guess is that at one time it was allowable. If someone knows what version Dave> of Perl allowed loop control modifiers in do{ } blocks (or if they were Dave> never allowed) I would like to know. I am using v5.8.0 and I was surprised Dave>

Re: special caracters in variables in patternmatching

2003-03-07 Thread Scott R. Godin
Francesco Del Vecchio wrote: > suppose this: > == > $string 'I saw Roger and I said :roger? what the @*$!'; > > $var1 = "roger? what the @*$!"; > $var2 = "Hi roger...nice to meet you"; > > $string=~ s/$var1/$var2/; > === >

Test for empty list

2003-03-07 Thread Jeroen Lodewijks
Hi all, Is there anybody out there who has a code snippet to test if a list is empty? (a list is empty if all elements are either undefined or 0 or have an empty string) Ofcourse I can do this: my $str = ''; my $elem; my (@test) = (undef, ''); #put any test data here foreach $elem (@test) {

special caracters in variables in patternmatching

2003-03-07 Thread Francesco del Vecchio
suppose this: == $string 'I saw Roger and I said :roger? what the @*$!'; $var1 = "roger? what the @*$!"; $var2 = "Hi roger...nice to meet you"; $string=~ s/$var1/$var2/; === I'm having problemsdue (i suppose) to the spec

Re: trying to match variable names

2003-03-07 Thread Rob Dixon
John W. Krahn wrote: > Greg Carrara wrote: > > > > Hello, > > Hello, > > > I'm trying to write a script that reads a file line by line and if > > the line contains a space it puts quotation marks around it and > > writes it to another file. I mostly have this working except that > > in the case of

useing perl to redirect and change port #

2003-03-07 Thread Jerry M. Howell II
Hello there, I have a script that I hacked from cpanel to help me access a webmail MUA that I installed. It works with opera and netscape but seems to hang in IE. I don't know much about perl but am learning. Can someone point out whats wrong with this script that would cuse it to hang in IE? #!

RE: cpan problems

2003-03-07 Thread Scott R. Godin
Dan Muey wrote: >> ([EMAIL PROTECTED](/home/dmuey):101)# perl -MCPAN -e shell; >> >> cpan shell -- CPAN exploration and modules installation >> (v1.48) ReadLine support available (try ``install Bundle::CPAN'') >> >> cpan> relaod index >> Unknown command 'relaod'. Type ? for help. >> >> cpan> r

RE: cpan problems

2003-03-07 Thread Scott R. Godin
Dan Muey wrote: > I've also had trouble using CPAN and so I did the reload index > mentioned in this thread and that seemed to go thought but I s > til can't get it to go. > > It's the same error everytime ( diff module names of course ) :: could not > open y... There is a direct > perl -MCAPN =e

Re: Module listing

2003-03-07 Thread Scott R. Godin
Rob wrote: > Is there a perl command to list installed modules? #!/usr/bin/perl use warnings; use strict; foreach my $mod ( sort CPAN::Shell->expand("Module","/./") ) { next unless $mod->inst_file; print $mod->id; print ": ", $mod->inst_version if $mod->inst_version; pri

Re: Simple Regex Problem.

2003-03-07 Thread Scott R. Godin
Rob Dixon wrote: > Paul Johnson wrote: >> Rob Dixon said: >> >> > $data =~ m/ <([^>]*)> /x; >> > my $newdata = $1; >> >> And if the match fails? > > Well I think it's likely that you'd want to do: > > $data =~ m/ <([^>]*)> /x or die "Malformed data"; > > or at least: > > $data

Re: Simple Regex Problem.

2003-03-07 Thread Scott R. Godin
David wrote: > Gregg R . Allen wrote: > >> It was close but what I got is : "JohnDoe.com" Instead of >> "[EMAIL PROTECTED]". >> >> I think it has something to do with escaping the "@" sign. I've been >> experimenting, but without much luck. >> > > that's because Perl thinks @Someplace is an

Re: Someone DO explain this to me!

2003-03-07 Thread Dave K
Jeff, > Jenda, > > You CANNOT do what you are suggesting. My guess is that at one time it was allowable. If someone knows what version of Perl allowed loop control modifiers in do{ } blocks (or if they were never allowed) I would like to know. I am using v5.8.0 and I was surprised to try: $ perl -

RE: script to mimic the cusor movement on a terminer or shell

2003-03-07 Thread Jim Yu
Thanks! It did not work. I guess I have to figure out how the program was programed in order to automate it using perl. Dan Muey <[EMAIL PROTECTED]> wrote:Well it depends. Is this script on windows or unix? I'm thinking unix due to the program name. Can you do the same thing via the command li

why objects?

2003-03-07 Thread Paul
I'm sold -- I write most code as object modules now. Yes, it adds some work to make sure it's inheritable, and I have to think whether a method can or must be called as a class method, or can or must have an actual object. I've even written a couple that allow non-class function-style use. My cow

Re: Handling race conditions

2003-03-07 Thread simran
On Fri, 2003-03-07 at 13:51, R. Joseph Newton wrote: > Wiggins d'Anconia wrote: > > > > > In general this would be handled with a lock file. When the first > > instance of your script starts it would check for the lock file if it > > exists then just exit, if it doesn't then it opens a file (.lock