regular expression
hi all, i am working to split the data in my array as follows but ended up clueless, hoope some of u can help. @text # contains values of a phone directory $text[0] contains john=012345678 $phone1 = ? let say i wanted to grab just the values'012345678'. how should i go on truncating the values? kindly advice pls. thanks! _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
truncating carrier return character(s)
It seems that when i am working with network programming, the input from the client will contain carrier return characters which the server interpreted as 2 carrier-return, how do i truncate the end carrier return characters? kindly advice... ... thanks! _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: regular expression
Hey Chaoz, code #!/usr/bin/perl use strict; open(FILE,'file.txt') or die Can't open file.txt: $!\n; my @text=(FILE); close(FILE); for(@text) { /(d+)$/; # Match only the numbers at the end of the string # and store them in '$1' to be printed out on the # next line followed by a new line character print $1,\n; } exit; /code shawn - Original Message - From: ChaoZ InferNo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, May 17, 2002 4:01 AM Subject: regular expression hi all, i am working to split the data in my array as follows but ended up clueless, hoope some of u can help. @text # contains values of a phone directory $text[0] contains john=012345678 $phone1 = ? let say i wanted to grab just the values'012345678'. how should i go on truncating the values? kindly advice pls. thanks! _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: regular expression
code for(@text) { /(d+)$/; # Match only the numbers at the end of the string ^^ this should actually be (\d+) I would actually conditionally print also, like so: print $1 if /(\d+)$/; And depending on the size of the file, instead of reading the whole thing into memory with my @text = (FILE); I would do: while(FILE) { print $1 if /(\d+)$/; } # and store them in '$1' to be printed out on the # next line followed by a new line character @text # contains values of a phone directory $text[0] contains john=012345678 $phone1 = ? let say i wanted to grab just the values'012345678'. how should i go on truncating the values? Cheers, -dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: regular expression
ChaoZ InferNo wrote: @text # contains values of a phone directory $text[0] contains john=012345678 $phone1 = ? let say i wanted to grab just the values'012345678'. if the format of $text[0] is always name=number you can use split instead of a regex. perldoc -f split -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: regular expression
Regular expressions are overkill for what you're trying to do. It seems like using 'split' should do exactly what you need. #!/usr/bin/perl -W use strict; open(IN,/path/to/file) or die Could not open file; my @list = IN; close(IN); for(@list) { chomp; my($field,$value) = split(/=/,$_); # split each line on '=' print Your $field is $value. \n; } Scot Robnett inSite Internet Solutions [EMAIL PROTECTED] [EMAIL PROTECTED] -Original Message- From: ChaoZ Inferno [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 11:38 AM To: [EMAIL PROTECTED] Subject: Re: regular expression Actually, the content of the file looks something like:- name=john id=12345 password=12345 colour=blue I am trying to grab the value field of each line and assigned it to be a variable. I tried the regular expressions, but seems like the syntax is wrong or something, @file = filehandle; #small file anyway $file[0] is equal to 'name=john' but i just wanna extract john to be my scalar variable. like print $name but returns john only and the same extraction method for the rest of the other 3 fields as well. kindly advice!... million thanks! - Original Message - From: David Gray [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: 'ChaoZ InferNo' [EMAIL PROTECTED]; 'Shawn' [EMAIL PROTECTED] Sent: Friday, May 17, 2002 10:16 PM Subject: RE: regular expression code ... for(@text) { /(d+)$/; # Match only the numbers at the end of the string ^^ this should actually be (\d+) I would actually conditionally print also, like so: print $1 if /(\d+)$/; And depending on the size of the file, instead of reading the whole thing into memory with my @text = (FILE); I would do: while(FILE) { print $1 if /(\d+)$/; } # and store them in '$1' to be printed out on the # next line followed by a new line character ... @text # contains values of a phone directory $text[0] contains john=012345678 $phone1 = ? let say i wanted to grab just the values'012345678'. how should i go on truncating the values? Cheers, -dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: regular expression
Ok, first, thanks for the correction and input David... I agree 100% with what you say. Secondly, am I just crazy, or doesn't split USE regex? Since this is the second mention the regex is overkill, and that split will work, I am a bit confused... When you can say $var=split(/=|:/); it tells me this IS a regex... hence the '//'s. So how exactly is this any less overkill (powerful) than a regex? shawn - Original Message - From: Scot Robnett [EMAIL PROTECTED] To: ChaoZ Inferno [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, May 17, 2002 9:52 AM Subject: RE: regular expression Regular expressions are overkill for what you're trying to do. It seems like using 'split' should do exactly what you need. #!/usr/bin/perl -W use strict; open(IN,/path/to/file) or die Could not open file; my @list = IN; close(IN); for(@list) { chomp; my($field,$value) = split(/=/,$_); # split each line on '=' print Your $field is $value. \n; } Scot Robnett inSite Internet Solutions [EMAIL PROTECTED] [EMAIL PROTECTED] -Original Message- From: ChaoZ Inferno [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 11:38 AM To: [EMAIL PROTECTED] Subject: Re: regular expression Actually, the content of the file looks something like:- name=john id=12345 password=12345 colour=blue I am trying to grab the value field of each line and assigned it to be a variable. I tried the regular expressions, but seems like the syntax is wrong or something, @file = filehandle; #small file anyway $file[0] is equal to 'name=john' but i just wanna extract john to be my scalar variable. like print $name but returns john only and the same extraction method for the rest of the other 3 fields as well. kindly advice!... million thanks! - Original Message - From: David Gray [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: 'ChaoZ InferNo' [EMAIL PROTECTED]; 'Shawn' [EMAIL PROTECTED] Sent: Friday, May 17, 2002 10:16 PM Subject: RE: regular expression code ... for(@text) { /(d+)$/; # Match only the numbers at the end of the string ^^ this should actually be (\d+) I would actually conditionally print also, like so: print $1 if /(\d+)$/; And depending on the size of the file, instead of reading the whole thing into memory with my @text = (FILE); I would do: while(FILE) { print $1 if /(\d+)$/; } # and store them in '$1' to be printed out on the # next line followed by a new line character ... @text # contains values of a phone directory $text[0] contains john=012345678 $phone1 = ? let say i wanted to grab just the values'012345678'. how should i go on truncating the values? Cheers, -dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: regular expression vs split
Curious, but I've always thought that regex was much quicker then split for situations such as this... I'd always figured that split was basically a (and the regex for this is probably wrong, but you can get the jist of it) /[^($delimiter | end of string)/ with a dumping of the match minus the delimiter... I'm guessing what was meant is that regex is more work then using a split, but it doesn't particularly seem like a huge amount of extra work using regex... any comments/thoughts? ~Brian Regular expressions are overkill for what you're trying to do. It seems like using 'split' should do exactly what you need. #!/usr/bin/perl -W use strict; open(IN,/path/to/file) or die Could not open file; my @list = IN; close(IN); for(@list) { chomp; my($field,$value) = split(/=/,$_); # split each line on '=' print Your $field is $value. \n; } Scot Robnett inSite Internet Solutions [EMAIL PROTECTED] [EMAIL PROTECTED] -Original Message- From: ChaoZ Inferno [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 11:38 AM To: [EMAIL PROTECTED] Subject: Re: regular expression Actually, the content of the file looks something like:- name=john id=12345 password=12345 colour=blue I am trying to grab the value field of each line and assigned it to be a variable. I tried the regular expressions, but seems like the syntax is wrong or something, @file = filehandle; #small file anyway $file[0] is equal to 'name=john' but i just wanna extract john to be my scalar variable. like print $name but returns john only and the same extraction method for the rest of the other 3 fields as well. kindly advice!... million thanks! - Original Message - From: David Gray [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: 'ChaoZ InferNo' [EMAIL PROTECTED]; 'Shawn' [EMAIL PROTECTED] Sent: Friday, May 17, 2002 10:16 PM Subject: RE: regular expression code ... for(@text) { /(d+)$/; # Match only the numbers at the end of the string ^^ this should actually be (\d+) I would actually conditionally print also, like so: print $1 if /(\d+)$/; And depending on the size of the file, instead of reading the whole thing into memory with my @text = (FILE); I would do: while(FILE) { print $1 if /(\d+)$/; } # and store them in '$1' to be printed out on the # next line followed by a new line character ... @text # contains values of a phone directory $text[0] contains john=012345678 $phone1 = ? let say i wanted to grab just the values'012345678'. how should i go on truncating the values? Cheers, -dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: regular expression
Actually, the content of the file looks something like:- name=john id=12345 password=12345 colour=blue Ok, how about this then... This is based on the fact that name, id, password, colour appear for every record whether they have a value or not, and that none of the values after the '=' will have an '=' in them. code #!/usr/bin/perl use strict; my(@name,@id,@password,@colour); open(FILE,'file.txt') or die Can't open file.txt: $!\n; my @text=(FILE); close(FILE); for(@text) { s/.*=//; } for(my $x=0; $x $#text; $x+4;) { push @name, $text[$x]; push @id, $text[$x+1]; push @passowrd, $text[$x+2]; push @colour, $text[$x+3]; } for(@name) { print if($_); } exit; /code It is still way too early, so if you catch any errors, let me know David (or anyone else for that matter) :-) shawn -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: regular expression
...it certainly looks like a regex to me -Original Message- From: Shawn [mailto:[EMAIL PROTECTED]] Sent: 17 May 2002 16:03 To: Scot Robnett; ChaoZ Inferno; [EMAIL PROTECTED] Subject: Re: regular expression Ok, first, thanks for the correction and input David... I agree 100% with what you say. Secondly, am I just crazy, or doesn't split USE regex? Since this is the second mention the regex is overkill, and that split will work, I am a bit confused... When you can say $var=split(/=|:/); it tells me this IS a regex... hence the '//'s. So how exactly is this any less overkill (powerful) than a regex? shawn - Original Message - From: Scot Robnett [EMAIL PROTECTED] To: ChaoZ Inferno [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, May 17, 2002 9:52 AM Subject: RE: regular expression Regular expressions are overkill for what you're trying to do. It seems like using 'split' should do exactly what you need. #!/usr/bin/perl -W use strict; open(IN,/path/to/file) or die Could not open file; my @list = IN; close(IN); for(@list) { chomp; my($field,$value) = split(/=/,$_); # split each line on '=' print Your $field is $value. \n; } Scot Robnett inSite Internet Solutions [EMAIL PROTECTED] [EMAIL PROTECTED] -Original Message- From: ChaoZ Inferno [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 11:38 AM To: [EMAIL PROTECTED] Subject: Re: regular expression Actually, the content of the file looks something like:- name=john id=12345 password=12345 colour=blue I am trying to grab the value field of each line and assigned it to be a variable. I tried the regular expressions, but seems like the syntax is wrong or something, @file = filehandle; #small file anyway $file[0] is equal to 'name=john' but i just wanna extract john to be my scalar variable. like print $name but returns john only and the same extraction method for the rest of the other 3 fields as well. kindly advice!... million thanks! - Original Message - From: David Gray [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: 'ChaoZ InferNo' [EMAIL PROTECTED]; 'Shawn' [EMAIL PROTECTED] Sent: Friday, May 17, 2002 10:16 PM Subject: RE: regular expression code ... for(@text) { /(d+)$/; # Match only the numbers at the end of the string ^^ this should actually be (\d+) I would actually conditionally print also, like so: print $1 if /(\d+)$/; And depending on the size of the file, instead of reading the whole thing into memory with my @text = (FILE); I would do: while(FILE) { print $1 if /(\d+)$/; } # and store them in '$1' to be printed out on the # next line followed by a new line character ... @text # contains values of a phone directory $text[0] contains john=012345678 $phone1 = ? let say i wanted to grab just the values'012345678'. how should i go on truncating the values? Cheers, -dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: regular expression vs split
I don't believe that a regex would be faster in an instance like this, but someone please correct me if I'm wrong. It seems that it would add (albeit a very minimal amount) processing overhead to apply a regular expression to each line rather than using the built-in split function on it, depending on the complexity of the regex. In this case it doesn't seem that complicated, so maybe we're just talking semantics. TMTOWTDI. Regarding split being a regex, well...split is a function, but it basically uses a regex to do its whizbangery, if that's what you mean. Scot Robnett inSite Internet Solutions [EMAIL PROTECTED] [EMAIL PROTECTED] -Original Message- From: Brian [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 10:17 AM To: [EMAIL PROTECTED] Subject: RE: regular expression vs split Curious, but I've always thought that regex was much quicker then split for situations such as this... I'd always figured that split was basically a (and the regex for this is probably wrong, but you can get the jist of it) /[^($delimiter | end of string)/ with a dumping of the match minus the delimiter... I'm guessing what was meant is that regex is more work then using a split, but it doesn't particularly seem like a huge amount of extra work using regex... any comments/thoughts? ~Brian Regular expressions are overkill for what you're trying to do. It seems like using 'split' should do exactly what you need. #!/usr/bin/perl -W use strict; open(IN,/path/to/file) or die Could not open file; my @list = IN; close(IN); for(@list) { chomp; my($field,$value) = split(/=/,$_); # split each line on '=' print Your $field is $value. \n; } Scot Robnett inSite Internet Solutions [EMAIL PROTECTED] [EMAIL PROTECTED] -Original Message- From: ChaoZ Inferno [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 11:38 AM To: [EMAIL PROTECTED] Subject: Re: regular expression Actually, the content of the file looks something like:- name=john id=12345 password=12345 colour=blue I am trying to grab the value field of each line and assigned it to be a variable. I tried the regular expressions, but seems like the syntax is wrong or something, @file = filehandle; #small file anyway $file[0] is equal to 'name=john' but i just wanna extract john to be my scalar variable. like print $name but returns john only and the same extraction method for the rest of the other 3 fields as well. kindly advice!... million thanks! - Original Message - From: David Gray [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: 'ChaoZ InferNo' [EMAIL PROTECTED]; 'Shawn' [EMAIL PROTECTED] Sent: Friday, May 17, 2002 10:16 PM Subject: RE: regular expression code ... for(@text) { /(d+)$/; # Match only the numbers at the end of the string ^^ this should actually be (\d+) I would actually conditionally print also, like so: print $1 if /(\d+)$/; And depending on the size of the file, instead of reading the whole thing into memory with my @text = (FILE); I would do: while(FILE) { print $1 if /(\d+)$/; } # and store them in '$1' to be printed out on the # next line followed by a new line character ... @text # contains values of a phone directory $text[0] contains john=012345678 $phone1 = ? let say i wanted to grab just the values'012345678'. how should i go on truncating the values? Cheers, -dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: regular expression
I just happened to write exactly this the other day, as a generic configuration file reader. Here's the basics: sub readINI {# argument: filename my %params; open( INIFILE, $_[0] ) || die Could not open $_[0]\n; while(INIFILE) { if(! /^#/ ) { # Allow comments chomp; $params{$`} = $' if( /=/ ); } } return %params; } What you get back is a hash of key/value pairs. In your case, $myhash{name} = 'john', $myhash{id} = '12345', etc. You can even comment a line out by putting a # in the first position (or by not having an = anywhere in the line). The only slightly obscure thing here is the use of $` and $' to mean everything before the match and everything after the match, to save you having to explicitely capture those sections with parens. FYI, more detail on your initial question would have allowed us to cut to the chase faster. - John --- ChaoZ Inferno [EMAIL PROTECTED] wrote: Actually, the content of the file looks something like:- name=john id=12345 password=12345 colour=blue I am trying to grab the value field of each line and assigned it to be a variable. ... = When you're following an angel, does it mean you have to throw your body off a building? - They Might Be Giants, http://www.tmbg.com Word of the week: Serendipity, see http://www.bartleby.com/61/93/S0279300.html __ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
What's up with CPAN?
Anybody else having trouble reaching search.cpan.org or wait.cpan.org today? I can get to the main site, but I can't get to module documentation. Scot R. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Send mail question
On Fri, 10 May 2002, fliptop wrote: Lance Prais wrote: If I am going to sendmail from an Internet using CGI does anyone know all the modules I will need to install? This may answer all my questions. i use mime::lite and it works great and is simple to use. Ditto. -- Eric P. Los Gatos, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Books
On Wed, 15 May 2002, Elaine -HFB- Ashton wrote: Date: Wed, 15 May 2002 13:50:52 -0500 From: Elaine -HFB- Ashton [EMAIL PROTECTED] To: Jim C. [EMAIL PROTECTED] Cc: bob burdic [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: Books Jim C. [[EMAIL PROTECTED]] quoth: *There was a lot of stuff removed from Learning Perl 3rd Ed that was in *2nd. It has been kind of cool to see what was removed. I guess they *thought that some of the items were a: not important or relevant b: more *advanced or c: deprecated (tm). I haven't seen anything added to 3rd *that wasn't in 2nd though, I admit I don't reference that book that much *anymore. Much of the stuff that was removed was due to the change in authors and a bit of spiffing up though you may all send roses and chocolates to the Editor who didn't include the goofy dialogues between TomP and Randal throughout the book :) Are *you* that editor? :) You're not bucking for some chocolate are you? hehe. I don't have the Llama's handy but as I recall the 3rd had a lot of new material and I remember there being far fewer references to the Flintstones :) Overall the 3rd Ed. is a major improvement especially for anyone who may have been previously intimidated by the 2nd ed. Well, like I said, I don't know very many, if any at all, specifics in changes to 3rd ed but you know, there was a lot of good info in 2nd that I am not too understanding as to why those topics were taken out. However, I understand that I remain powerless over those decisions and while I sit in wonderment, now and then, pondering the mere facts of the matter, I take note that it is a total waste of time. Did somebody say something about pizza? And the 3rd. Edition Camel is similarly an improvement over the 2nd ed. as there is a new and improved index, a reference section and a lot more useful information in general. http://www.bookpool.com/ has them for 30% off most of the time so stay off the pizza for a few days and get the 3rd editions. I think I have it on CD rom actually. Pizza tastes much better anyway. e. - Jim -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBI/DBD
on Fri, 17 May 2002 01:32:54 GMT, Fjohnson wrote: The error I am getting with this version of the code is the following: DBD::Sybase::st execute failed: Server message number=170 severity=150 state=1 line=1 server='hostname' text=Line1: Incorrect syntax near ')' . at dbi.pl line 27, STDIN line 4. [ Code snipped and reformatted ] $sth = $dbh-prepare( insert into Books (Book_title, Author, Publisher, ISBN) values ('$Book_title', '$Author', '$Publisher','$ISBN') )) || die Couldn't prepare statement: $DBI::errstr; # execute query $sth-execute() || die Can't execute the SQL statement: $DBI::errstr; 1) You must use 'or' instead of '||' to avoid precedence problems. ('||' has higher precedence than '=', but 'or' hasn't). 2) You have one too many ')' in your SQL statement, the last one within the quotes. (This gives you the error message above). 3) Personally, I prefer placeholders: $sth = $dbh-prepare( insert into Books (Book_title, Author, Publisher, ISBN) values (?,?,?,?)); and then call execute like so: $sth-execute($Book_title, $Author, $Publisher,$ISBN); -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: proper way to start daemon
On Thursday 16 May 2002 11:47 pm, drieux wrote: [snip] the problem is that it closes both stdin and stderr, which are used by other things we play with and need to be appropriately reopened to some place other than the terminal we are no longer talking to... I'm all in favor of cluttering up syslog with JUNK - but most of the decent sysAdds will allow that over my dead body {they never say, 'over my dead body' - they always say it expressly as 'Right, yeah sure, over your dead body that's gonna happen'} Just out of interrest, what do they have against using the syslog facility? It gives a very good pre-defined way of controlling log entries. Using the syslog.conf you could filter out your messages to a seperate file, or even to a seperate machine. Also, whay would stop you from just re-opening the STD[IN|OUT|ERR] handles to files in the root FS anyway? (I've not looked at the link provided and I've never done any daemon work, I'm just interrested) [snip] -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Perldoc
-Original Message- From: Chris Ball [mailto:[EMAIL PROTECTED]] I've submitted a documentation patch on this and it's been applied to the 5.8 tree. There'll be mention of perltoc as a good place to start on the `perldoc perldoc` page in that release. I was very tempted to buy Programming Perl but this was before I found perldoc. I suppose I will eventually buy it as I find books easier than PC's to referance from but it will hopefully delay my need for purchase. Cheers, H * COLT Telecommunications Registered in England No. 2452736 Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ Tel. +44 20 7390 3900 This message is subject to and does not create or vary any contractual relationship between COLT Telecommunications, its subsidiaries or affiliates (COLT) and you. Internet communications are not secure and therefore COLT does not accept legal responsibility for the contents of this message. Any view or opinions expressed are those of the author. The message is intended for the addressee only and its contents and any attached files are strictly confidential. If you have received it in error, please telephone the number above. Thank you. * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
passing array-ref from sub to sub
Hi there, I would like to transfer an array-reference from sub get_link_attr_entry_list to sub get_link_priority, but it doesn't work. Here is the code: use strict; my $link_id = ''; my $link_attr_entry_list_ref = ''; get_link_attr_entry_list($link_id); get_link_priority($link_attr_entry_list_ref); ## sub get_link_attr_entry_list { my $link_id = $_[0]; @link_attr_entry_list = $linkattrdb-find_using_linkid($link_id); my $link_attr_entry_list_ref = \@link_attr_entry_list; return $link_attr_entry_list_ref; } sub get_link_priority { my $link_attr_entry_list_ref = $_[0]; my @link_attr_entry_list = @$link_attr_entry_list_ref; foreach my $link_attr_entry (@link_attr_entry_list) { ... } thanks in advance for your help! greetings Stefan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: passing array-ref from sub to sub
[EMAIL PROTECTED] wrote: Hi there, I would like to transfer an array-reference from sub get_link_attr_entry_list to sub get_link_priority, but it doesn't work. Here is the code: use strict; my $link_id = ''; my $link_attr_entry_list_ref = ''; get_link_attr_entry_list($link_id); You will have to take the return value from get_link_attr_entry_list in $link_attr_entry_list_ref or change the following line to get_link_priority (get_link_attr_entry_list ($link_id)); get_link_priority($link_attr_entry_list_ref); ## sub get_link_attr_entry_list { my $link_id = $_[0]; @link_attr_entry_list = $linkattrdb-find_using_linkid($link_id); my $link_attr_entry_list_ref = \@link_attr_entry_list; The variable declared here is lexically scoped inside this subroutine. The return value is also not being used. The reference that you have created will be lost after the execution of this subroutine. return $link_attr_entry_list_ref; } sub get_link_priority { my $link_attr_entry_list_ref = $_[0]; my @link_attr_entry_list = @$link_attr_entry_list_ref; foreach my $link_attr_entry (@link_attr_entry_list) { ... } thanks in advance for your help! greetings Stefan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Getting Can't locate Win32/Service.pm
Whilst using; use Win32::Service; Any ideas on how to diagnose? Chris Khoury Operational Support Shell International Petroleum Company Limited Shell Centre, London SE1 7NA, United Kingdom Tel: +44 (0)20 7934 4190 Fax: 7351 Email: Internet: http://www.shell.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: passing array-ref from sub to sub
-Original Message- From: [EMAIL PROTECTED] use strict; my $link_id = ''; my $link_attr_entry_list_ref = ''; The var above is in the package::main name space. get_link_attr_entry_list($link_id); get_link_priority($link_attr_entry_list_ref); ## sub get_link_attr_entry_list { my $link_id = $_[0]; @link_attr_entry_list = $linkattrdb-find_using_linkid($link_id); my $link_attr_entry_list_ref = \@link_attr_entry_list; return $link_attr_entry_list_ref; This variable is different than the one declared in package::main. This variable is local to the enclosing block and cannot be seen outside of the get_link_attr_entry_list {} routine. When you return this reference to the package::main block you are not using it either. } sub get_link_priority { my $link_attr_entry_list_ref = $_[0]; my @link_attr_entry_list = @$link_attr_entry_list_ref; foreach my $link_attr_entry (@link_attr_entry_list) { ... } Try something like the following ### #!perl use warnings; use strict; my $link_id = ''; my $link_attr_entry_list_ref = ''; my $returned_reference = get_link_attr_entry_list($link_id); get_link_priority($returned_reference); ## sub get_link_attr_entry_list { my $link_id = $_[0]; @link_attr_entry_list = $linkattrdb-find_using_linkid($link_id); my $link_attr_entry_list_ref = \@link_attr_entry_list; return $link_attr_entry_list_ref; } sub get_link_priority { my $link_attr_entry_list_ref = $_[0]; my @link_attr_entry_list = @$link_attr_entry_list_ref; foreach my $link_attr_entry (@link_attr_entry_list) { ... } # This is a common pitfall. Have a look on google for Coping with Scoping by MJD. To achieve what you wanted another method could have been the following but I am not sure if this is wise. ### #!perl use warnings; use strict; my $link_id = ''; my $link_attr_entry_list_ref = ''; get_link_priority(get_link_attr_entry_list($link_id); ## sub get_link_attr_entry_list { my $link_id = $_[0]; @link_attr_entry_list = $linkattrdb-find_using_linkid($link_id); my $link_attr_entry_list_ref = \@link_attr_entry_list; return $link_attr_entry_list_ref; } sub get_link_priority { my $link_attr_entry_list_ref = $_[0]; my @link_attr_entry_list = @$link_attr_entry_list_ref; foreach my $link_attr_entry (@link_attr_entry_list) { ... } # I doubt if the above message is wise. If anyone can elaborate I would like to know when you use this get_link_attr_entry_list($link_id); is there a global variable that is used in the return value that could be used as the next parameter in another sub routine? Harry * COLT Telecommunications Registered in England No. 2452736 Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ Tel. +44 20 7390 3900 This message is subject to and does not create or vary any contractual relationship between COLT Telecommunications, its subsidiaries or affiliates (COLT) and you. Internet communications are not secure and therefore COLT does not accept legal responsibility for the contents of this message. Any view or opinions expressed are those of the author. The message is intended for the addressee only and its contents and any attached files are strictly confidential. If you have received it in error, please telephone the number above. Thank you. * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: stop the Madness
Sorry - sent this to the wrong addy by mistake.. :O) A. On Thursday, May 16, 2002, at 05:44 PM, Timothy Johnson wrote: ... Yesterday I even caught myself writing code on a piece of napkin on my lunch I have been doing that for years - just not with perl. I always find the best work is done on the back of a napkin or envelope. A. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: BEGIN and END
-Original Message- From: drieux [mailto:[EMAIL PROTECTED]] On Thursday, May 16, 2002, at 02:05 , Harry Jackson wrote: Does anyone have any other things that would be good practice in most scripts. BEGIN { } cf p465 3rd Edition cf p481ff for a discussion on this and END {} the court is out on stuffing things in the END block, there are caveats that are best to avoid some things. I own 2nd edition Learning Perl and a 1st Edition 2nd revision Cookbook so I am stuck. I have had a look at the perlstyle docs to see if there was any hints as to a good form of a template to take. I suppose I should create a template for Vim that I can load as required. Harry * COLT Telecommunications Registered in England No. 2452736 Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ Tel. +44 20 7390 3900 This message is subject to and does not create or vary any contractual relationship between COLT Telecommunications, its subsidiaries or affiliates (COLT) and you. Internet communications are not secure and therefore COLT does not accept legal responsibility for the contents of this message. Any view or opinions expressed are those of the author. The message is intended for the addressee only and its contents and any attached files are strictly confidential. If you have received it in error, please telephone the number above. Thank you. * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: proper way to start daemon
warning note: daemonology comes in two basic catagories a) standard system type daemons b) distributed networking solutions AKA: OLTP systems, enterprise solutions, YourBuzzHere for the first class syslog is ok enough - especially as gary notes that one can modify the syslog.conf for an alternative file to wonka to as generically is done by sendmail... and other chatty kathy standard systems daemons. The second space has other issues - since the second space includes the daemonology used to monitor - well, the system which is the space I am expecting most of the perlers will be writing in. On Friday, May 17, 2002, at 01:16 , Gary Stainburn wrote: [..] It gives a very good pre-defined way of controlling log entries. Using the syslog.conf you could filter out your messages to a seperate file, or even to a seperate machine. the simple answer is: Going to Syslog is like: 'well we can just send email' - a good enough place to start the game - but, well, SO EIGHTIES { when constructing a syslog language once, I got to the bad hair day where I proposed the interface that said core=yourCoreDumpHere because the silly code monkies needed to have the coffee break moment that this was not the best of all solutions - although it would have simplified getting their core files off - since well of course one can have a network syslog host. } Also, whay would stop you from just re-opening the STD[IN|OUT|ERR] handles to files in the root FS anyway? (I've not looked at the link provided and I've never done any daemon work, I'm just interrested) The chdir to / in itself is not the problem - since that makes sure that you start from a safe and general place - the question now becomes - is this where you want to 'blow core' - when some impolite and unforseen event occurs. { many *nix variants clean /tmp on reboot so stuff that you write out there is not intended to survive crashes. if you are in the POSIX world then go with /opt/ourPackageSpace /etc/opt/ourPackageSpace /var/opt/ourPackageSpace linux freaks disagree - but you can work around this but you didn't ask about package installation solutions - which of course is the better way to deliver your daemonology - which will of course test for the requirements of the underlying perl modules - and install them as needed...} As for writing to / - WAY UNKOSHER - since for gooder practices only root should be writing to / itself - and you really do not want to open up all hell by running your daemon as root... For the simpler cases - dumping things like $pidFile in temp has the simple side effect that they go away on reboot - if that has to happen... Since your general 'loging' will be by some other means, then what winds up in /tmp as mydaemon.stdout and mydaemon.stderr is really for catching those strange cases... Mondo Butch Daemons will of course check to see if there are any issues in those files prior to starting and will then truncate them as well... if you look at the code, you will notice that I do reopen STD[OUT|ERR] but there really is no point in reopening STDIN - as there is no controlling terminal... see above for the 'control port' issue. { and folks wonder about the 'so why does drieux chatter on about understanding how to implement an FD_SET in perl for socket management?' well, because one of the sockets you want is your incoming message queue from up stream daemons, one is your control port, one is for your downstream daemon dialogs... } Given that I expect that players will write daemons that use other perl modules - since that is simpler than re-inventing the world. We want to have STD[ERR|OUT] open so that any messages woofed out of the modules that we use have some place to go - since those module writers were generally expecting to use things like die,croak,carp,confess - print STDERR print STDOUT and we will be able to read their 'OH FREMONGE' messages. As is Proc::Daemon - and I DO ADVOCATE THIS { did I mention, that IF you are going to play in daemonology, YES, download it from the CPAN - call out your dependence on it.} will leave STD[IN|OUT|ERR] open on /dev/null - hence you will lose any die,croak,carp,confess messages - and your daemon will die silently... your customers will ask: Why did it die silently? and your coders will ask Why did it die silently? where is the croak,carp, cluck, confess. and your management will beat on you with a stick, and your professional peers will say Neener,Neener,Neener and you will spend many years in therapy because of that. ciao drieux --- But drieux, what is wrong with sending a message to the syslog host that we can not contact the syslog host? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:
vx - vmx - tip hardwire via perl
Hi! Can perl deal with vx or vmx? I can access tip hardwire, but lose control because I do not know to do an enter that is required. I need to be able and reset the controller clock. I have tried to telnet into the controller via vx, bit I have idea on what commands to use. Thanks, Jerry -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Test how we were executed
On Thursday, May 16, 2002, at 11:27 , Postman Pat wrote: Greetings, I want to write a script that will check to see if it was called from another script, if not it will display a message saying for instance this script is meant to be called from other script not run interactively for instance otherwise if called from a script will do it's intended purpose. .. Is there a way that I can actually get this working properly? the problem here is resolving whom your PPID is, and whether or not it is a shell/init - eg: a daemon, properly formed, that detached from the controlling terminal will become a child of init [jeeves:~] drieux% ps -ax -o user,pid,ppid,command | grep perl drieux 16512 1 perl myFunkyDaemon drieux 16524 16514 grep perl [jeeves:~] drieux% whereas commands that are called from a shell would be children of the terminal in which they were run, and hence its shell, [jeeves:~] drieux% ps -ax -o user,pid,ppid,command | grep 16514 drieux 16514 16513 -csh (csh) root 16526 16514 ps -ax -o user pid ppid command drieux 16527 16514 grep 16514 [jeeves:~] drieux% in this case the csh is a child of the Terminal which is a child of the window server which is a child of init. { similar paths occur for rlogin/rsh/telnet } So IF you know which script you expect to be called by then your path is really simple - since you need only check for your PPID - ASSUMING of course that you are expecting it to block until you finish http://www.wetware.com/drieux/pbl/Sys/myParent.txt provides an UGLY way to do it - and the url references to ways that would be, for me, more natural... the problem of course is making sure that this safety check makes reasonable sense in the long run to begin with. A great place for testing out ideas about Process Management but will this really solve the issue you want??? ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: vx - vmx - tip hardwire via perl
On Friday, May 17, 2002, at 07:04 , Jerry Preston wrote: Hi! we can trade here... Can perl deal with vx or vmx? I can access tip hardwire, but lose control because I do not know to do an enter that is required. I need to be able and reset the controller clock. I have tried to telnet into the controller via vx, bit I have idea on what commands to use. 'return' in perl is \n - a blank 'newline'. Net::Telnet will expect that you know what the command line prompt will look like - but once that it done, you really should not have a lot of problem... also have a peek at use Text::ParseWords; it should help sort out what was sent to you and the like. now for me 'vx' is a ChemWarfare agent, so I rather do hope that when you say 'tip hardwire' - that you are doing this in a Class A lab - that stuff is nasty. ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: vx - vmx - tip hardwire via perl
The usual way add an enter (i.e newline) in perl is to use \n . eg $hello=hello\n; print $hello; prints hello followed by a new line. I assume this is what you mean by enter A. On Friday, May 17, 2002, at 02:04 PM, Jerry Preston wrote: Hi! Can perl deal with vx or vmx? I can access tip hardwire, but lose control because I do not know to do an enter that is required. I need to be able and reset the controller clock. I have tried to telnet into the controller via vx, bit I have idea on what commands to use. Thanks, Jerry -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Test how we were executed
-Original Message- From: Postman Pat [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 2:27 AM To: [EMAIL PROTECTED] Subject: Test how we were executed Greetings, I want to write a script that will check to see if it was called from another script, if not it will display a message saying for instance this script is meant to be called from other script not run interactively for instance otherwise if called from a script will do it's intended purpose... Is there a way that I can actually get this working properly? Not sure exactly what you're trying to prevent here. Are you saying that your script X should only be invoked from another specific script Y? And when you say called by, do you mean fork/exec, or some Perl mechanism (do/require/use). Or do you mean script X should not be invoked from an interactive shell? If your script is expecting to read some input from STDIN and you don't want it to just sit there waiting for terminal input, you can use the -t operator to see if STDIN is a terminal: die Don't run me interactively\n if -t STDIN; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Copyright Law and Fair Use Doctrine - was Re: BEGIN and END
On Friday, May 17, 2002, at 04:23 , Jackson, Harry wrote: -Original Message- From: drieux [mailto:[EMAIL PROTECTED]] On Thursday, May 16, 2002, at 02:05 , Harry Jackson wrote: Does anyone have any other things that would be good practice in most scripts. BEGIN { }cf p465 3rd Edition cf p481ff for a discussion on this and END {} the court is out on stuffing things in the END block, there are caveats that are best to avoid some things. I own 2nd edition Learning Perl and a 1st Edition 2nd revision Cookbook so I am stuck. I have had a look at the perlstyle docs to see if there was any hints as to a good form of a template to take. I suppose I should create a template for Vim that I can load as required. Just so that we are all clear on one minor and crucial legal point here - it is acceptable for me to make citations, and limited quotations from Copyrighted Written Material - this is what is known as the 'fair use doctrine' - and one can make all types of patheticArguments about this being an 'academic like' environment - but I want to SQUELCH right here and right now any efforts to leak into the public domain that which is copyrighted That being the case - it is clearly time to think about figuring out a legitimate way to wheel, deal or steal a copy of the 3rd Edition - since you are wandering into the level of 'professional grade' questions - that need to be addressed in a professional manner - and hence in compliance with professional ethics. All JackJawing about 'treeMurderers' aside - there just comes a point in time when you have to accept that you just have to own the professional grade reference material. The Alternative to this is to do all of the basic testing and analysis that you wish - and learn the hard way. Never let it be said that I didn't support the ey what Jimmy? scottish school of head butting the information into the neural synaptic paths. ciao drieux --- and for all the land lubbers over in MerseySide - try to remember we ARE Senior Service, and we'll have none of the usual whining from the ranks and lessers... You Do NOT EVEN want to get me started on the EdinbuggerAll college Boy Prima Donna Crew Club -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Getting Can't locate Win32/Service.pm
Do you have a file called service .pm in \perl\site\lib\win32? -Original Message- From: Khoury, Chris C SEOP-OEIRN To: '[EMAIL PROTECTED]' Sent: 5/17/02 2:25 AM Subject: Getting Can't locate Win32/Service.pm Whilst using; use Win32::Service; Any ideas on how to diagnose? Chris Khoury Operational Support Shell International Petroleum Company Limited Shell Centre, London SE1 7NA, United Kingdom Tel: +44 (0)20 7934 4190 Fax: 7351 Email: Internet: http://www.shell.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DynaLoader and @INC HELP !
Hi All, Still have a problem with this. In my perl code I can add to @INC one of 2 ways. use lib /path/to/modules/SunOS/5.6 OR BEGIN { use POSIX qw(uname); my ($uname_s, $uname_r) = (POSIX::uname())[0,2]; unshift(@INC, /path/to/modules/$uname_s/$uname_r ); } If I use the BEGIN code, Perl does not search /path/to/modules/SunOS/5.6/sun4-solaris/auto/ but it does find my module in /path/to/modules/SunOS/5.6 If I use use lib /path/to/modules/SunOS/5.6 perl can find sun4-solaris/auto/ and loads my .so So I figured I could fix this by adding code to the DynaLoader section of each Kstat.pm in SunOS/$rev. Question: How can I add the libdir to the DynaLoader call in Kstat.pm the docs on DynaLoader are a little beyond my perl skills. Kstat.pm package Solaris::Kstat; use strict; use DynaLoader; use vars qw($VERSION @ISA); $VERSION = '0.02'; @ISA = qw(DynaLoader); bootstrap Solaris::Kstat $VERSION; 1; __END__ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Test how we were executed
-Original Message- From: Postman Pat [mailto:[EMAIL PROTECTED]] Greetings, I want to write a script that will check to see if it was called from another script, if not it will display a message saying for instance this script is meant to be called from other script not run interactively for instance otherwise if called from a script will do it's intended purpose... Is there a way that I can actually get this working properly? I am sure there is some fancy way to do this but If I understand the problem correctly. If a certain script is the only one allowed to call the program pass it a unique parameter like system (program big_bollocks); In the program that gets called check the parameter if ($ARGV[n] -eq big_bollocks) { print You are calling this program incorrectly; exit 0; } The code above is probably wrong but it demonstrates a simple method to achieve what you want providing you are able to modify the calling script. Harry * COLT Telecommunications Registered in England No. 2452736 Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ Tel. +44 20 7390 3900 This message is subject to and does not create or vary any contractual relationship between COLT Telecommunications, its subsidiaries or affiliates (COLT) and you. Internet communications are not secure and therefore COLT does not accept legal responsibility for the contents of this message. Any view or opinions expressed are those of the author. The message is intended for the addressee only and its contents and any attached files are strictly confidential. If you have received it in error, please telephone the number above. Thank you. * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: passing array-ref from sub to sub
On Friday, May 17, 2002, at 02:35 , Jackson, Harry wrote: get_link_priority(get_link_attr_entry_list($link_id); --^ one ) short of a full lisp {-8 the devil made me do that... 8-} ciao drieux --- ooh, oooh... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DynaLoader and @INC HELP !
On Friday, May 17, 2002, at 07:31 , Scot Needy wrote: Still have a problem with this. In my perl code I can add to @INC one of 2 ways. use lib /path/to/modules/SunOS/5.6 OR BEGIN { use POSIX qw(uname); my ($uname_s, $uname_r) = (POSIX::uname())[0,2]; unshift(@INC, /path/to/modules/$uname_s/$uname_r ); } If I use the BEGIN code, Perl does not search /path/to/modules/SunOS/5.6/sun4-solaris/auto/ but it does find my module in /path/to/modules/SunOS/5.6 because you never told it to look there in either case. why not simply fix your Begin to include all the required sub directories??? cf: http://archive.develooper.com/beginners%40perl.org/msg26168.html Think about how many entries exist in the @INC - with something like my $count = 1; foreach my $line (@INC) { print ($count) $line\n; $count++; } and you will notice tht it does not just have /path/to/lib5 but a standard suite of them ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: passing array-ref from sub to sub
-Original Message- From: drieux [mailto:[EMAIL PROTECTED]] On Friday, May 17, 2002, at 02:35 , Jackson, Harry wrote: get_link_priority(get_link_attr_entry_list($link_id); --^ one ) short of a full lisp {-8 the devil made me do that... 8-} Entirely intentional, just keeping everyone on their toes. Well spotted that man. Please do not tell me you are benchmarking this as well. I do not want to spend another three days optimising code that I would never put in production anyway. I had a look at the great language contest the other day and had to drag myself away from trying to optimise some of their code. I noticed that perl was not very quick during some of their tests and it was bugging me. I then noticed that some of the code was taken from Kernighan's books and thought that I may be trying to bite off more than I can chew. I think I should try to crawl before I walk before I run. Harry * COLT Telecommunications Registered in England No. 2452736 Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ Tel. +44 20 7390 3900 This message is subject to and does not create or vary any contractual relationship between COLT Telecommunications, its subsidiaries or affiliates (COLT) and you. Internet communications are not secure and therefore COLT does not accept legal responsibility for the contents of this message. Any view or opinions expressed are those of the author. The message is intended for the addressee only and its contents and any attached files are strictly confidential. If you have received it in error, please telephone the number above. Thank you. * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Test how we were executed
What I meant is test to see if we were run from an interactive shell, if so, print an error message. LK -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Test how we were executed
See Perl Cookbook Section 15.2. Should be of help. -Original Message- From: Postman Pat [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 11:02 AM To: Bob Showalter Cc: [EMAIL PROTECTED] Subject: RE: Test how we were executed What I meant is test to see if we were run from an interactive shell, if so, print an error message. LK -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DynaLoader and @INC HELP !
On Friday, May 17, 2002, at 07:50 , drieux wrote: my $count = 1; foreach my $line (@INC) { print ($count) $line\n; $count++; } perchance an illustration may help here: [jeeves:~/bin] drieux% rshAround uname -a ; atInc going to vladimir with command uname -a ; atInc SunOS vladimir 5.7 Generic_106541-08 sun4u sparc SUNW,Ultra-1 (1) /usr/local/lib/perl5/5.6.1/sun4-solaris (2) /usr/local/lib/perl5/5.6.1 (3) /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris (4) /usr/local/lib/perl5/site_perl/5.6.1 (5) /usr/local/lib/perl5/site_perl (6) . #-- going to wetware with command uname -a ; atInc SunOS wetware 5.6 Generic_105181-20 sun4u sparc SUNW,Ultra-1 (1) /usr/local/lib/perl5/5.6.1/sun4-solaris (2) /usr/local/lib/perl5/5.6.1 (3) /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris (4) /usr/local/lib/perl5/site_perl/5.6.1 (5) /usr/local/lib/perl5/site_perl (6) . #-- going to gax with command uname -a ; atInc Linux gax 2.4.9-31 #1 Tue Feb 26 06:23:51 EST 2002 i686 unknown (1) /usr/lib/perl5/5.6.1/i686-linux (2) /usr/lib/perl5/5.6.1 (3) /usr/lib/perl5/site_perl/5.6.1/i686-linux (4) /usr/lib/perl5/site_perl/5.6.1 (5) /usr/lib/perl5/site_perl/5.6.0 (6) /usr/lib/perl5/site_perl (7) . #-- going to mex with command uname -a ; atInc SunOS mex 5.7 Generic_106542-08 i86pc i386 i86pc (1) /usr/local/lib/perl5/5.6.1/i86pc-solaris (2) /usr/local/lib/perl5/5.6.1 (3) /usr/local/lib/perl5/site_perl/5.6.1/i86pc-solaris (4) /usr/local/lib/perl5/site_perl/5.6.1 (5) /usr/local/lib/perl5/site_perl/5.005/i86pc-solaris (6) /usr/local/lib/perl5/site_perl/5.005 (7) /usr/local/lib/perl5/site_perl (8) . #-- going to xanana with command uname -a ; atInc Linux xanana 2.4.9-13 #1 Tue Oct 30 20:11:04 EST 2001 i686 unknown (1) /usr/lib/perl5/5.6.0/i386-linux (2) /usr/lib/perl5/5.6.0 (3) /usr/lib/perl5/site_perl/5.6.0/i386-linux (4) /usr/lib/perl5/site_perl/5.6.0 (5) /usr/lib/perl5/site_perl (6) . #-- [jeeves:~/bin] drieux% sed 's/^/### /' atInc ### #!/bin/sh ### ### perl -e 'my $count = 1; foreach my $line (@INC) { print ($count) $line\n; $count++; }' ### [jeeves:~/bin] drieux% ./atInc ; uname -a (1) /System/Library/Perl/darwin (2) /System/Library/Perl (3) /Library/Perl/darwin (4) /Library/Perl (5) /Library/Perl (6) /Network/Library/Perl/darwin (7) /Network/Library/Perl (8) /Network/Library/Perl (9) . Darwin jeeves.wetware.com 5.4 Darwin Kernel Version 5.4: Wed Apr 10 09:27: 47 PDT 2002; root:xnu/xnu-201.19.3.obj~1/RELEASE_PPC Power Macintosh powerpc [jeeves:~/bin] drieux% Of the lot - the only one who does not call out their 'arch' specific instance is the Macintosh OS X darwin version - which I personally consider to be APOSTATE! ciao drieux --- and since you asked: [jeeves:~/bin] drieux% sed 's/^/### /' rshAround ### #!/bin/sh ### ### HOSTS=vladimir wetware gax mex xanana ### ### CMD=$1 ### ### if [ ${CMD} == ] ### then ### echo Way Dumb - no command ### exit 7 ### fi ### ### for host in $HOSTS ### do ### echo going to $host with command $CMD ### ### rsh $host $CMD ### echo #-- ### done ### [jeeves:~/bin] drieux% -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SUMMARY:Re: DynaLoader and @INC HELP !
I turned on debug in perl5/5.00503/sun4-solaris/DynaLoader.pm $dl_debug = 1; Turns out it WAS scanning /path/to/modules/SunOS/5.6 Just not /path/to/modules/SunOS/5.6/$arch/auto I moved /path/to/modules/SunOS/5.6/$arch/auto to /path/to/modules/SunOS/5.6/auto and everything now works! Key Debug Output. (auto/Solaris/Kstat/Kstat.so) == ../script.pl | more DynaLoader.pm loaded (/local/lib/perl5/5.00503/sun4-solaris /local/lib/perl5/5.00503 /local/lib/perl5/site_perl/5.005/sun4-solaris /local/lib/perl5/site_perl/5.005 ., /usr/local/lib /lib /usr/lib /usr/ccs/lib /local/Tivoli/lib/solaris2 /usr/dt/lib /usr/openwin/lib /usr/lib /usr/ucblib /lib /usr/lib /usr/openwin/lib /usr/local/lib) DynaLoader::bootstrap for POSIX (auto/POSIX/POSIX.so) DynaLoader::bootstrap for Solaris::Kstat (auto/Solaris/Kstat/Kstat.so) Check what is in @INC by printing it in your perl code. print \@INC is @INC\n; @INC is /var/opt/modules/SunOS/5.6 ...etc On Fri, 2002-05-17 at 10:50, drieux wrote: On Friday, May 17, 2002, at 07:31 , Scot Needy wrote: Still have a problem with this. In my perl code I can add to @INC one of 2 ways. use lib /path/to/modules/SunOS/5.6 OR BEGIN { use POSIX qw(uname); my ($uname_s, $uname_r) = (POSIX::uname())[0,2]; unshift(@INC, /path/to/modules/$uname_s/$uname_r ); } If I use the BEGIN code, Perl does not search /path/to/modules/SunOS/5.6/sun4-solaris/auto/ but it does find my module in /path/to/modules/SunOS/5.6 because you never told it to look there in either case. why not simply fix your Begin to include all the required sub directories??? cf: http://archive.develooper.com/beginners%40perl.org/msg26168.html Think about how many entries exist in the @INC - with something like my $count = 1; foreach my $line (@INC) { print ($count) $line\n; $count++; } and you will notice tht it does not just have /path/to/lib5 but a standard suite of them ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
printing FILE HANDLE to mail
Hello fellow perl enthusiasts I want to be able to open a Mail File Handle and have seperate file go this Mail File Handle I have some code like this: --- #!/util/perl5.static -w $unixadm = hourihj; $report = /etc/passwd; $hostname = qx(/usr/ucb/hostname); $subject = FSADM Report on $hostname; #$mail = /usr/ucb/mail; mail_results2; open(REPORT, $report) || die Cannot open $report:$!; ### mail_results subroutine sub mail_results2 { open(SENDMAIL, |/usr/lib/sendmail -oi -t -odq) or die Can't fork for sendmail:$!\n; $text = ; while (read (REPORT, $newtext, 1)){ $text .= $newtext; } print SENDMAIL EOF; From: Root root To: Unix Admin $unixadm Subject: $subject Hello $text EOF close(SENDMAIL) or warn sendmail didn't close nicely; } --- Thanks in Advance Jaime -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Test how we were executed
On Friday, May 17, 2002, at 08:02 , Postman Pat wrote: What I meant is test to see if we were run from an interactive shell, if so, print an error message. assume code_A calls Code_B if code_A has not 'daemonized' and detached from the controlling terminal - then the (-t STDIN) will show up as being valid when tested in Code_B... a quick rehack of yesterdays daemon http://www.wetware.com/drieux/pbl/Sys/daemon1.txt gets us [jeeves:/tmp] drieux% sed 's/^//' *2.stdout We are 16623 - fired up at Fri May 17 08:27:47 2002 We Slurped Up :We Have NO Controlling Terminal : shutting down at Fri May 17 08:27:47 2002 [jeeves:/tmp] drieux% { it calls Code_B } whereas: [jeeves:/tmp] drieux% Code_A We Have A Controlling Terminal [jeeves:/tmp] drieux% does that help a bit??? ciao drieux --- the diff of the daemons is: [jeeves:drieux/pbl/Sys] drieux% diff dae* ~/perl/daemons/daemon2 36a37,39 print We Have A Controlling Terminal\n if (-t); 43,44c46,50 dumbDoWork(100,6); --- #dumbDoWork(100,6); open(CODEB, /Users/drieux/bin/Code_B |) or die No Good Code_B:$!\n; my @slurp = CODEB; close CODEB; print We Slurped Up :@slurp :\n; [jeeves:drieux/pbl/Sys] drieux% jeeves% for file in Cod* for do for echo $file for sed 's/^/### /' $file for echo #-- for done Code_A ### #!/usr/bin/perl ### ### system(CODE_B); #-- Code_B ### #!/usr/bin/perl ### ### if (-t) { ### print We Have A Controlling Terminal\n; ### }else { ### print We Have NO Controlling Terminal\n; ### } #-- jeeves% -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
using vec
I am using vec($foo1, $foo2, $foo3). It seems that the value of $foo3 is limited to 2048 (with perl 5.004 or perl 5.6.1). Is it possible to use wider values: up to 60,000 ??? Thanks, Vincent -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: printing FILE HANDLE to mail
print SENDMAIL EOF; From: Root root To: Unix Admin $unixadm Subject: $subject Hello $text EOF You have to have an extra new line after the Subject such as follows. -- print SENDMAIL EOF; From: Root root To: Unix Admin $unixadm Subject: $subject Hello $text EOF -- === Shaun Fryer === London Webmasters http://LWEB.NET PH: 519-858-9660 FX: 519-858-9024 === -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Autoloader and DynaLoader on NFS - was Re: SUMMARY:Re: DynaLoader and @INC HELP !
On Friday, May 17, 2002, at 07:59 , Scot Needy wrote: I turned on debug in perl5/5.00503/sun4-solaris/DynaLoader.pm $dl_debug = 1; Turns out it WAS scanning /path/to/modules/SunOS/5.6 Just not /path/to/modules/SunOS/5.6/$arch/auto I moved /path/to/modules/SunOS/5.6/$arch/auto to /path/to/modules/SunOS/5.6/auto and everything now works! my complements!!! [1] now the concern that worries me is the issues that can arise from running modules that are built with autoloading variations over the NFS mounting { we're talking about the *.al files here - check out the whole POSIX::*} my premise here is that you are planning to run the Solaris::Kstat for some form of system monitoring suite of tools { they tend to come out as suites, even though we all start with the hope of a 'one size will fit all'. } I've never tried to test this concern - since I always simply demanded that the perl and the modules be local to the machine - a feature that shows up in solaris 8 where they take Perl Seriously - as a legitimate tool. Hence I am not at all sure what impact will occur - when the NFS mount goes 'flakey' - and you are trying to deal with that issue - but this is the first time that you grabbed for the foo.al - hence, my expectation that your perl code will bollock up unable to get the file that it needs to run the test to find the bollock that has occurred If anyone with more experience in this area can be of assistance - i would be greatly pleased to hear. Am I 'misreading' the documentation about autoloaded portions of the code??? { is this the part where we note that DynaLoader itself is 'exposed' and that Text::ParseWords as well as GetOpt::Long, hence one is limiting the 'host local' coding options that you might wish to have for dealing with checking this host for a given problem if the NFS mount is a part of the problem? } ciao drieux --- [1] { drieux, why didn't you think about turning on the DEBUG... thwack, thwack, thwack oh god, more years in therapy... } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Regex a name field
Can anyone give me a hand please? I have a file James T Nobel James T. Nobel, Jr. James and Kathy Nobel James T Nobel James T Nobel I am trying to replace the spaces with a single space My code so snippet is: $cuname = $data[53]; $newcuname = / +/ /$cuname; But it isnt working TIA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Regex a name field
-Original Message- From: Ned Cunningham [mailto:[EMAIL PROTECTED]] T Nobel I am trying to replace the spaces with a single space My code so snippet is: $cuname = $data[53]; $newcuname = / +/ /$cuname; This is probably a little but not much closer to what you want. $cuname =~ s/\s+/\s/g; H * COLT Telecommunications Registered in England No. 2452736 Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ Tel. +44 20 7390 3900 This message is subject to and does not create or vary any contractual relationship between COLT Telecommunications, its subsidiaries or affiliates (COLT) and you. Internet communications are not secure and therefore COLT does not accept legal responsibility for the contents of this message. Any view or opinions expressed are those of the author. The message is intended for the addressee only and its contents and any attached files are strictly confidential. If you have received it in error, please telephone the number above. Thank you. * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Regex a name field
Perl includes a special escape that stands for any whitespace character, which is \s. Thus, you can simplify your regex by using: $cuname =~ s/\s+/ /; #replace one or more whitespace chars with a space What I have done is used the s/// (substitution) operator to substitute one space for one or more whitespace characters. Also, let's take a quick look at your regular expression, because there are a few errors. $newcuname = / +/ /$cuname; First off, the '=' there should be '=~'. This is the operator you use for matches, transliteration, and substitution. Second, you have double-quotes in the regex that you don't need. You shouldn't use double-quotes in a regex as string barriers. Again, check out 'perldoc perlre' for more info. -Original Message- From: Ned Cunningham To: '[EMAIL PROTECTED]' Sent: 5/17/02 9:15 AM Subject: Regex a name field Can anyone give me a hand please? I have a file James T Nobel James T. Nobel, Jr. James and Kathy Nobel James T Nobel James T Nobel I am trying to replace the spaces with a single space My code so snippet is: $cuname = $data[53]; $newcuname = / +/ /$cuname; But it isnt working TIA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Who debug me?
That's the problem: #!/usr/bin/perl my $file = '/home/users/francesco/LISTAORDINATA.txt'; my $outfile = '/home/users/francesco/Perl/file/usrpasswdemail.txt'; my $file2 = '/home/users/francesco/Perl/file/peralberto.txt'; open (OUT, $outfile); open (INPUTEMAIL, $file2); # open (INPUTPASS, $file); while (INPUTEMAIL) { chomp; ($usr1,$email) = split (/\s/); open (INPUTPASS, $file); while (INPUTPASS) { chomp; ($usr,$pass) = split (/\s/); if ($usr == $usr1) {print $usr $pass $email\n;} } } Where is my error? I suppose in the if. I want to print $usr $pass $email -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help with Math::CDF module
On Thursday, May 16, 2002, at 11:49 , Prachi Shroff wrote: [..] without knowing which compiler - these would be hard to run to ground. but we will try to help a bit here.. I think nmake environment is having an issue with # --- MakeMaker constants section: AR_STATIC_ARGS = cr hence is reading that as a file - vice a command line argument to the 'ar' - cf man ar AR(1) System General Commands Manual AR(1) NAME ar - create and maintain library archives . -c Whenever an archive is created, an informational message to that effect is written to standard error. If the -c option is speci- fied, ar creates the archive silently. . -r Replace or add the specified files to the archive. If the archive does not exist a new archive file is created. Files that replace existing files do not change the order of the files within the archive. New files are appended to the archive unless one of the options -a, -b or -i is specified. . hence is not dealing with how to make a static library appropriately, the rest appears to be merely the water fall from that... which would suggest that you are not having a problem with the 'code' perse - but with how to 'tweek' the Makefile... to do in your OS specific space that which 'cr' would do in others. hope that helps. LIB : fatal error LNK1181: cannot open input file cr NMAKE : fatal error U1077: 'lib' : return code '0x49d' Stop. NMAKE : fatal error U1077: 'cd' : return code '0x2' Stop. I do not understand what that could mean. Also, in the ReadME file of the module it says that I should change a cdflib/ipmpar.c file where the integer machine constans are specified for different machines. I am using a Dell machine with Windows 2000 and Intel Xeon processor. I dont know what class of machines does mine fall in or if that is actually the problem. oh my GOD in heaven {this was rigged to run on a PDP-11 as well as the KA and KI variants of the PDP-10} you would want to uncomment, I think, the section /* MACHINE CONSTANTS FOR IEEE ARITHMETIC MACHINES, SUCH AS THE ATT 3B SERIES, MOTOROLA 68000 BASED MACHINES (E.G. SUN 3 AND ATT PC 7300), AND 8087 BASED MICROS (E.G. IBM PC AND ATT 6300). */ which appears to be the default I think the Xeon can do the x87 arch - help home boys, you with the wisdom of Intel Based Chip Sets you may wish to check with Ed Callahan - but today http://www.envstat.com is temporarily off line. ciao drieux --- the make under darwin looks like: [jeeves:~/Desktop/Math-CDF-0.1] drieux% make mkdir blib mkdir blib/lib mkdir blib/lib/Math mkdir blib/arch mkdir blib/arch/auto mkdir blib/arch/auto/Math mkdir blib/arch/auto/Math/CDF mkdir blib/lib/auto mkdir blib/lib/auto/Math mkdir blib/lib/auto/Math/CDF mkdir blib/man3 cp CDF.pm blib/lib/Math/CDF.pm AutoSplitting blib/lib/Math/CDF.pm (blib/lib/auto/Math/CDF) cd cdflib make LIB= LIBPERL_A=libperl.a LINKTYPE=dynamic PREFIX=/usr OPTIMIZE=-O3 cc -c -g -pipe -pipe -fno-common -no-cpp-precomp -flat_namespace -DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing -O3 -DVERSION=\0.10\ -DXS_VERSION=\0.10\ -I/System/Library/Perl/darwin/CORE dcdflib.c cc: -flat_namespace: linker input file unused since linking not done cc -c -g -pipe -pipe -fno-common -no-cpp-precomp -flat_namespace -DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing -O3 -DVERSION=\0.10\ -DXS_VERSION=\0.10\ -I/System/Library/Perl/darwin/CORE ipmpar.c cc: -flat_namespace: linker input file unused since linking not done ar cr libcdflib.a dcdflib.o ipmpar.o /usr/bin/ranlib libcdflib.a make[1]: Nothing to be done for `all'. /usr/local/bin/perl -I/System/Library/Perl/darwin -I/System/Library/Perl /System/Library/Perl/ExtUtils/xsubpp -typemap /System/Library/Perl/ExtUtils/typemap CDF.xs CDF.xsc mv CDF.xsc CDF.c cc -c -g -pipe -pipe -fno-common -no-cpp-precomp -flat_namespace -DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing -O3 -DVERSION=\0.1\ -DXS_VERSION=\0.1\ -I/System/Library/Perl/darwin/CORE CDF.c cc: -flat_namespace: linker input file unused since linking not done Running Mkbootstrap for Math::CDF () chmod 644 CDF.bs LD_RUN_PATH=/usr/lib cc -o blib/arch/auto/Math/CDF/CDF.bundle -bundle -flat_namespace -undefined suppress CDF.o cdflib/libcdflib.a -lm chmod 755 blib/arch/auto/Math/CDF/CDF.bundle cp CDF.bs blib/arch/auto/Math/CDF/CDF.bs chmod 644 blib/arch/auto/Math/CDF/CDF.bs Manifying blib/man3/Math::CDF.3 [jeeves:~/Desktop/Math-CDF-0.1] drieux% -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Who debug me?
On Friday, May 17, 2002, at 09:17 , Francesco Guglielmo wrote: Where is my error? I suppose in the if. I want to print $usr $pass $email well I personally would have started with #!/usr/bin/perl -w use strict; I also like to be a bit more explict on splits my ($usr1,$email) = split(/\s/, $_) note, no space between split and (); at which point one would like to know what the 'error' messages were that came out when the code ran ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: passing array-ref from sub to sub
- Original Message - From: Jackson, Harry [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] use strict; my $link_id = ''; my $link_attr_entry_list_ref = ''; The var above is in the package::main name space. Are you saying that $link_id and $link_attr_entry_list_ref are in the main name space? That's not quite right, is it? Refere to the following excerpt from the Coping with Scoping (http://perl.plover.com/FAQs/Namespaces.html) document that you mentioned: -- my variables are not package variables. They're not part of a package, and they don't have package qualifiers. The current package has no effect on the way they're interpreted. Here's an example: my $x = 17; package A; $x = 12; package B; $x = 20; # $x is now 20. # $A::x and $B::x are still undefined The declaration my $x = 17 at the top creates a new lexical variable named x whose scope continues to the end of the file. This new meaning of $x overrides the default meaning, which was that $x meant the package variable $x in the current package. package A changes the current package, but because $x refers to the lexical variable, not to the package variable, $x=12 doesn't have any effect on $A::x. Similarly, after package B, $x=20 modifies the lexical variable, and not any of the package variables. At the end of the file, the lexical variable $x holds 20, and the package variables $main::x, $A::x, and $B::x are still undefined. If you had wanted them, you could still have accessed them by using their full names. -- According to this, my understanding is that all my's live in a symbol table that is not connected to any package namespace. --Adam -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Help please
Can anyone tell me why the heck my if statements aren't working in this subroutine. Everything else seems to work fine. Please excuse the debug code... sub 'pass_verify_syntax { print Sub Called\n; my($p) = @_; length($p) $pwmin print Password too short. Minimum is $pwmin characters.\n; length($p) $pwmax print Password too long. Maximum is $pwmax characters.\n; print $p\n; if ($p =~ /([^a-zA-Z])\1/) { print Password cannot contain repeating characters.($1)\n; } if (substr($p, 0,8)=~ tr/a-zA-Z//c2){ die is this working\n; } foreach (unpack('C*', $p)) { $char = pack(C, $_); #'log(verifying character '$char'); if (index($pwchars, $char) == -1) { print Password contains invalid character: '$char'\n; } } return 'ok'; } Thanks in advance. Scott -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Who debug me?
Hi - Mayb... if ($usr == $usr1) {print $usr $pass $email\n;} '==' is a NUMERIC compare, 'eq' is the corresponding alphanumeric compare. So: if ($usr eq $usr1) {print $usr $pass $email\n;} or (to ignore case): if (lc $usr eq lc $usr1) {print $usr $pass $email\n;} -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Francesco Guglielmo Sent: Friday, May 17, 2002 6:17 AM To: [EMAIL PROTECTED] Subject: Who debug me? That's the problem: #!/usr/bin/perl my $file = '/home/users/francesco/LISTAORDINATA.txt'; my $outfile = '/home/users/francesco/Perl/file/usrpasswdemail.txt'; my $file2 = '/home/users/francesco/Perl/file/peralberto.txt'; open (OUT, $outfile); open (INPUTEMAIL, $file2); # open (INPUTPASS, $file); while (INPUTEMAIL) { chomp; ($usr1,$email) = split (/\s/); open (INPUTPASS, $file); while (INPUTPASS) { chomp; ($usr,$pass) = split (/\s/); if ($usr == $usr1) {print $usr $pass $email\n;} } } Where is my error? I suppose in the if. I want to print $usr $pass $email -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: passing array-ref from sub to sub
-Original Message- From: Adam Morton [mailto:[EMAIL PROTECTED]] use strict; my $link_id = ''; my $link_attr_entry_list_ref = ''; The var above is in the package::main name space. Are you saying that $link_id and $link_attr_entry_list_ref are in the main name space? That's not quite right, is it? Refere to the following excerpt from the Coping with Scoping (http://perl.plover.com/FAQs/Namespaces.html) document that you mentioned: I stand corrected. Was my solution correct? Did reading Coping With Scoping provide you with the answer. If so my post was not a complete waste of time. Harry * COLT Telecommunications Registered in England No. 2452736 Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ Tel. +44 20 7390 3900 This message is subject to and does not create or vary any contractual relationship between COLT Telecommunications, its subsidiaries or affiliates (COLT) and you. Internet communications are not secure and therefore COLT does not accept legal responsibility for the contents of this message. Any view or opinions expressed are those of the author. The message is intended for the addressee only and its contents and any attached files are strictly confidential. If you have received it in error, please telephone the number above. Thank you. * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using vec
On Friday, May 17, 2002, at 08:40 AM, VINCENT BUFFERNE wrote: I am using vec($foo1, $foo2, $foo3). It seems that the value of $foo3 is limited to 2048 (with perl 5.004 or perl 5.6.1). Is it possible to use wider values: up to 60,000 ??? are you sure it is limited? i don't have a test case, but perldoc -fvec says of the value of the third param: BITS therefore specifies the number of bits that are reserved for each element in the bit vector. This must be a power of two from 1 to 32 (or 64, if your platform supports that) Thanks, Vincent -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: passing array-ref from sub to sub
On Friday, May 17, 2002, at 09:34 , Adam Morton wrote: [..] my $x = 17; package A; $x = 12; package B; $x = 20; # $x is now 20. # $A::x and $B::x are still undefined and as you notice there is almost no way to make that fly - since there exists no unique construct $A::x what you would want to do is some form of encapsulation game with: my $x = 17; my $y = A::getX; my $z = B::getX; print \$x is $x and \$y is $y while \$z is $z\n; #-The Package Line --- package A; sub getX { my $x = 12; $x; } package B; sub getX { my $x = 20; $x; } if you do not do the 'my $x' tricks - then you run into the side effect game that you were expecting... All of which leads me to wonder why in God's Green Earth you would wish to use a 'package' approach to begin with. given the initial construction of the form my ($a, $b) = ( '' , ''); $b = sub1($a); sub2($b); #-das boot dives here sub sub1 { my ($inarg) = @_ . $myOutArg } sub sub2 { my ($inarg) = @_ . $myOutArg } would allow us to cope with the scope and pass the return of sub1 to sub2 - yes, you are correct, it would be possible to SUCK IN and use the globally scoped $a and $b - but that also means that one can not move along to building package Dornitz::derFleet undt stuffing all of one's subs into it so that the code would be simplified to use Dornitz::derFleet qw/:lant/; my ($a, $b) = ( '' , ''); $b = sub1($a); sub2($b); exit(0); capish paisano??? ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help please
On Friday, May 17, 2002, at 09:40 AM, Batchelor, Scott wrote: /([^a-zA-Z])\1/ did you mean to be checking for repeating non-alpha characters? if you are testing with repeating alpha characters, that test won't catch it.
RE: Help please
Some Questions -Original Message- From: Batchelor, Scott [mailto:[EMAIL PROTECTED]] Sent: 17 May 2002 17:40 To: '[EMAIL PROTECTED]' Subject: Help please Can anyone tell me why the heck my if statements aren't working in this subroutine. Everything else seems to work fine. Please excuse the debug code... Have a flick through this and see if it helps. #!perl use strict; use warnings; my $pwmin = 2; my $pwmax = 100; pass_verify_syntax(hello); sub 'pass_verify_syntax { print Sub Called\n; my($p) = @_; print $p; length($p) $pwmin print Password too short. Minimum is $pwmin characters.\n; length($p) $pwmax print Password too long. Maximum is $pwmax characters.\n; print $p\n; if ($p =~ /([^a-zA-Z])\1/) { print Password cannot contain repeating characters.($1)\n; } # I was unsure what you where doing here so I changed # it #if ((substr($p, 0,6)) =~ tr/a-zA-Z//c2){ # # die is this working\n; #} # I changed it to this. What where you doing above? $p =~ tr/A-Za-z//c; foreach (unpack('C*', $p)) { my $char = pack(C, $_); my $pwchars = abcdefghijklmnopqrstuvwxyz; #'log(verifying character '$char'); if (index($pwchars, $char) == -1) { print Password contains invalid character: '$char'\n; } } return 'ok'; } * COLT Telecommunications Registered in England No. 2452736 Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ Tel. +44 20 7390 3900 This message is subject to and does not create or vary any contractual relationship between COLT Telecommunications, its subsidiaries or affiliates (COLT) and you. Internet communications are not secure and therefore COLT does not accept legal responsibility for the contents of this message. Any view or opinions expressed are those of the author. The message is intended for the addressee only and its contents and any attached files are strictly confidential. If you have received it in error, please telephone the number above. Thank you. * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help please
-Original Message- From: bob ackerman [mailto:[EMAIL PROTECTED]] On Friday, May 17, 2002, at 09:40 AM, Batchelor, Scott wrote: /([^a-zA-Z])\1/ did you mean to be checking for repeating non-alpha characters? if you are testing with repeating alpha characters, that test won't catch it. This is probably a bit more what you would be looking for if that was the case. if ( $p =~ /([:alpha])\1/) { } H * COLT Telecommunications Registered in England No. 2452736 Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ Tel. +44 20 7390 3900 This message is subject to and does not create or vary any contractual relationship between COLT Telecommunications, its subsidiaries or affiliates (COLT) and you. Internet communications are not secure and therefore COLT does not accept legal responsibility for the contents of this message. Any view or opinions expressed are those of the author. The message is intended for the addressee only and its contents and any attached files are strictly confidential. If you have received it in error, please telephone the number above. Thank you. * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help please
The first if Statement I am checking for Repeating characters such as aa %% In the second if statement I am that there are at least 2 non-alpha characters in the first 8 letters. I hope this explains it a bit better... Again, Thanks in advance. Scott Some Questions -Original Message- From: Batchelor, Scott [mailto:[EMAIL PROTECTED]] Sent: 17 May 2002 17:40 To: '[EMAIL PROTECTED]' Subject: Help please Can anyone tell me why the heck my if statements aren't working in this subroutine. Everything else seems to work fine. Please excuse the debug code... Have a flick through this and see if it helps. #!perl use strict; use warnings; my $pwmin = 2; my $pwmax = 100; pass_verify_syntax(hello); sub 'pass_verify_syntax { print Sub Called\n; my($p) = @_; print $p; length($p) $pwmin print Password too short. Minimum is $pwmin characters.\n; length($p) $pwmax print Password too long. Maximum is $pwmax characters.\n; print $p\n; if ($p =~ /([^a-zA-Z])\1/) { print Password cannot contain repeating characters.($1)\n; } # I was unsure what you where doing here so I changed # it #if ((substr($p, 0,6)) =~ tr/a-zA-Z//c2){ # # die is this working\n; #} # I changed it to this. What where you doing above? $p =~ tr/A-Za-z//c; foreach (unpack('C*', $p)) { my $char = pack(C, $_); my $pwchars = abcdefghijklmnopqrstuvwxyz; #'log(verifying character '$char'); if (index($pwchars, $char) == -1) { print Password contains invalid character: '$char'\n; } } return 'ok'; } * COLT Telecommunications Registered in England No. 2452736 Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ Tel. +44 20 7390 3900 This message is subject to and does not create or vary any contractual relationship between COLT Telecommunications, its subsidiaries or affiliates (COLT) and you. Internet communications are not secure and therefore COLT does not accept legal responsibility for the contents of this message. Any view or opinions expressed are those of the author. The message is intended for the addressee only and its contents and any attached files are strictly confidential. If you have received it in error, please telephone the number above. Thank you. * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help please
Ack sorry I meant to say the first if statement catches repeating NON Alpha characters... such as %% -Original Message- From: Batchelor, Scott [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 1:18 PM To: 'Jackson, Harry'; [EMAIL PROTECTED] Subject:RE: Help please The first if Statement I am checking for Repeating characters such as aa %% In the second if statement I am that there are at least 2 non-alpha characters in the first 8 letters. I hope this explains it a bit better... Again, Thanks in advance. Scott Some Questions -Original Message- From: Batchelor, Scott [mailto:[EMAIL PROTECTED]] Sent: 17 May 2002 17:40 To: '[EMAIL PROTECTED]' Subject: Help please Can anyone tell me why the heck my if statements aren't working in this subroutine. Everything else seems to work fine. Please excuse the debug code... Have a flick through this and see if it helps. #!perl use strict; use warnings; my $pwmin = 2; my $pwmax = 100; pass_verify_syntax(hello); sub 'pass_verify_syntax { print Sub Called\n; my($p) = @_; print $p; length($p) $pwmin print Password too short. Minimum is $pwmin characters.\n; length($p) $pwmax print Password too long. Maximum is $pwmax characters.\n; print $p\n; if ($p =~ /([^a-zA-Z])\1/) { print Password cannot contain repeating characters.($1)\n; } # I was unsure what you where doing here so I changed # it #if ((substr($p, 0,6)) =~ tr/a-zA-Z//c2){ # # die is this working\n; #} # I changed it to this. What where you doing above? $p =~ tr/A-Za-z//c; foreach (unpack('C*', $p)) { my $char = pack(C, $_); my $pwchars = abcdefghijklmnopqrstuvwxyz; #'log(verifying character '$char'); if (index($pwchars, $char) == -1) { print Password contains invalid character: '$char'\n; } } return 'ok'; } * COLT Telecommunications Registered in England No. 2452736 Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ Tel. +44 20 7390 3900 This message is subject to and does not create or vary any contractual relationship between COLT Telecommunications, its subsidiaries or affiliates (COLT) and you. Internet communications are not secure and therefore COLT does not accept legal responsibility for the contents of this message. Any view or opinions expressed are those of the author. The message is intended for the addressee only and its contents and any attached files are strictly confidential. If you have received it in error, please telephone the number above. Thank you. * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Setting limit coredumpsize
On Thursday, May 16, 2002, at 08:41 , Alan Drew wrote: You could try using shell - the module tha allows you to use shell commands as subroutines. e.g: use shell; $uptime = uptime(); print $uptime; just had time to peek at this - and use shell is essentially a wrapper around open(CMD, yourCmd @args | ) the function you are all trying to find is setrlimit() and yes, it would have been nice to call getrlimit() and no these are not in the publically listed POSIX::* this idea of perldoc -f syscall seems interesting... and syscall.h we find: #define SYS_setrlimit 128 #define SYS_getrlimit 129 ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Regex a name field
Ned Cunningham wrote: Can anyone give me a hand please? I have a file James T Nobel James T. Nobel, Jr. James and Kathy Nobel James T Nobel James T Nobel I am trying to replace the spaces with a single space My code so snippet is: $cuname = $data[53]; $newcuname = / +/ /$cuname; ( my $newcuname = $data[53] ) =~ tr/ //s; ( my $newcuname = $data[53] ) =~ s/ +/ /g; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Regex a name field
Harry Jackson wrote: -Original Message- From: Ned Cunningham [mailto:[EMAIL PROTECTED]] T Nobel I am trying to replace the spaces with a single space My code so snippet is: $cuname = $data[53]; $newcuname = / +/ /$cuname; This is probably a little but not much closer to what you want. $cuname =~ s/\s+/\s/g; Why would you want to replace multiple whitespace characters with the letter s? :-) John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: printing FILE HANDLE to mail
Thanks for the reply Shaun that worked perfect I guess being a web master you ran into this problem with CGI ;-) Jaime -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Who debug me?
Francesco Guglielmo wrote: Subject: Who debug me? Let Perl help you help yourself That's the problem: #!/usr/bin/perl use warnings; # use diagnostics; # for extra help use strict; my $file = '/home/users/francesco/LISTAORDINATA.txt'; my $outfile = '/home/users/francesco/Perl/file/usrpasswdemail.txt'; my $file2 = '/home/users/francesco/Perl/file/peralberto.txt'; open (OUT, $outfile); open OUT, '', $outfile or die Cannot open $outfile: $!; open (INPUTEMAIL, $file2); open INPUTEMAIL, '', $file2 or die Cannot open $file2: $!; # open (INPUTPASS, $file); # open INPUTPASS, '', $file or die Cannot open $file: $!; while (INPUTEMAIL) { chomp; ($usr1,$email) = split (/\s/); If the data is separated by a single space this might work but it is better to use the default split. my ( $usr1, $email ) = split; open (INPUTPASS, $file); while (INPUTPASS) { chomp; ($usr,$pass) = split (/\s/); if ($usr == $usr1) {print $usr $pass $email\n;} } } Where is my error? I suppose in the if. I want to print $usr $pass $email It would be better to use a hash to store one of the files instead of reading it for every lookup. #!/usr/bin/perl use warnings; use strict; my $file= '/home/users/francesco/LISTAORDINATA.txt'; my $file2 = '/home/users/francesco/Perl/file/peralberto.txt'; my $outfile = '/home/users/francesco/Perl/file/usrpasswdemail.txt'; my %users; open INPUTPASS, '', $file or die Cannot open $file: $!; while ( INPUTPASS ) { chomp; my ( $usr, $pass ) = split; $users{ $usr } = $pass; } close INPUTPASS; open OUT, '', $outfile or die Cannot open $outfile: $!; open INPUTEMAIL, '', $file2 or die Cannot open $file2: $!; while (INPUTEMAIL) { chomp; my ( $usr1, $email ) = split; if ( exists $users{ $usr1 } ) { print $usr1 $users{$usr1} $email\n; } } __END__ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Unknown Name
I remember reading something once that detailed using 'formats' or something like that. I don't remember what it was called, but I looked something like this: @ How is this used? Thanks. ~Jess -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Unknown Name
I think what you're looking for is 'format'. Check out 'perldoc perlform'. -Original Message- From: Balint, Jess [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 1:11 PM To: '[EMAIL PROTECTED]' Subject: Unknown Name I remember reading something once that detailed using 'formats' or something like that. I don't remember what it was called, but I looked something like this: @ How is this used? Thanks. ~Jess -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Autoloader and DynaLoader on NFS - was Re: SUMMARY:Re:DynaLoader and @INC HELP !
On Fri, 2002-05-17 at 12:01, drieux wrote: On Friday, May 17, 2002, at 07:59 , Scot Needy wrote: I turned on debug in perl5/5.00503/sun4-solaris/DynaLoader.pm $dl_debug = 1; Turns out it WAS scanning /path/to/modules/SunOS/5.6 Just not /path/to/modules/SunOS/5.6/$arch/auto I moved /path/to/modules/SunOS/5.6/$arch/auto to /path/to/modules/SunOS/5.6/auto and everything now works! my complements!!! [1] Thanks ! now the concern that worries me is the issues that can arise from running modules that are built with autoloading variations over the NFS mounting { we're talking about the *.al files here - check out the whole POSIX::*} my premise here is that you are planning to run the Solaris::Kstat for some form of system monitoring suite of tools { they tend to come out as suites, even though we all start with the hope of a 'one size will fit all'. } I've never tried to test this concern - since I always simply demanded that the perl and the modules be local to the machine - a feature that shows up in solaris 8 where they take Perl Seriously - as a legitimate tool. Hence I am not at all sure what impact will occur - when the NFS mount goes 'flakey' - and you are trying to deal with that issue - but this is the first time that you grabbed for the foo.al - hence, my expectation that your perl code will bollock up unable to get the file that it needs to run the test to find the bollock that has occurred Everything including runnig code locks up and continues when NFS is restored but it will only lock up if an IO call is made. Read,write,stat etc... Everything else is already in memory. If anyone with more experience in this area can be of assistance - i would be greatly pleased to hear. Am I 'misreading' the documentation about autoloaded portions of the code??? { is this the part where we note that DynaLoader itself is 'exposed' and that Text::ParseWords as well as GetOpt::Long, hence one is limiting the 'host local' coding options that you might wish to have for dealing with checking this host for a given problem if the NFS mount is a part of the problem? } Um not sure I understand that one. I am by every definition a beginner in this perl language thing :) Reading Learning Perl now to understand how to leverage this treed hash that Kstat has. But I confess The modules directory is local but mirrored to every system using Tivoli. My Master needs to have source for NT, Solaris, Linux and OSF. I already know that my destination host is of type Solaris but It would take a little more work to figure out rev so I just push Solaris Modules. Until now there hasn't been a need to split them up. Scot ciao drieux --- [1] { drieux, why didn't you think about turning on the DEBUG... thwack, thwack, thwack oh god, more years in therapy... } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unknown Name
Jess Balint wrote: I remember reading something once that detailed using 'formats' or something like that. I don't remember what it was called, but I looked something like this: @ How is this used? Thanks. ~Jess perldoc perlform John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
sorting a hash alphabetically
Hi! I have a hash built in the following way: $names{ $ID } = $your_name; I want to l want to list in print $query-popup_menu( -name='Emp', -values= \%who, -default= \%who, ); but in alphabetically. How do I do this? I have used the following: foreach $module ( sort { $para_wpf{$a} = $para_wpf{$b} } keys %para_wpf ) { Thanks, Jerry -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Autoloader and DynaLoader on NFS - was Re: SUMMARY:Re: DynaLoader and @INC HELP !
On Friday, May 17, 2002, at 01:06 , Scot Needy wrote: We both agree that IF the code got into main memory - then the 'compile' is finished - and it will just cruise along. { some folks have seen the 'problem' that they wrote a CGI that forks, and found something wrong with it - removed the 'text' off of the web server - and 'the code was still running' - so yeah, perl beats /bin/sh all to death on that point. } My concern here is how does it deal with the 'dynamically loadable' 'perl library' side of the game - eg: cf p296ff with regards to Audtoloader and of course the Autosplit - that will have generated the foo.al files... { cf also perldoc SelfLoader The SelfLoader will read from the FOOBAR::DATA filehandle to load in the data after `__DATA__', and load in any sub- routine when it is called. The costs are the one-time parsing of the data after `__DATA__', and a load delay for the _first_ call of any autoloaded function. The benefits (hopefully) are a speeded up compilation phase, with no need to load functions which are never used. }; # oh hell it's just an autonomous closure let the english lit # freaks whine - it makes me feel safer { man who comment email has other issues to resolve } [..] { is this the part where we note that DynaLoader itself is 'exposed' and that Text::ParseWords as well as GetOpt::Long, hence one is limiting the 'host local' coding options that you might wish to have for dealing with checking this host for a given problem if the NFS mount is a part of the problem? } Um not sure I understand that one. I am by every definition a beginner in this perl language thing :) Reading Learning Perl now to understand how to leverage this treed hash that Kstat has. Well we're in the Same Boat - so let's see if we can shake one of these 'power users' up to see if they can give it up. I just figured out that the whole POSIX::* hierarchy is a screaming meemee of *.al autoloader files. GetOpt::Long - you really gotta do the PerlDoc on that one as it will allow you really cool 'gnuIsh' tricks myCoolPerl --file=JoeBob --Bogart=joint,bong,water Text::ParseWords - saves on ugly lifting in doing 'expects' like so what did I get in that response? sorts of questions all of which have at least one autoloadable function - all of which are at risk in your core monitoring system DynaLoad is what you need for dynamic loading - and that is most likely gonna scram any code that calls for a FOO::BAR module that would need dynamic loading because we're all waiting on the NFS mounts to chill so that we can read the dynamically - but not locally - mounted portion of the code to finish the compile time events But I confess The modules directory is local but mirrored to every system using Tivoli. eg: to the best of your knowledge all the *.al files would be disk local at that point and not coming in over NFS??? That would seem to be cool - as long as none of the XS based code using the *.so and *.bs files - are not gonna hammer you at run time in the NFS cross mount problem. My Master needs to have source for NT, Solaris, Linux and OSF. I already know that my destination host is of type Solaris but It would take a little more work to figure out rev so I just push Solaris Modules. Until now there hasn't been a need to split them up. the AutoSplit is what I am worrying about - and trying to go to an nfs based solution may be putting you at risk. dude scope out Config - way makes life simpler on knowing what the version of Perl Thinks is the reality - cf: http://www.wetware.com/drieux/CS/Proj/PID/ if you want to see that in use for articulating the distinctions in say commandline arguments to ps for linux/solaris/darwin ciao drieux --- remember boys and girls for the price of a 600M hard drive back in 1990 you could only buy two AK-47's on the california legal market { 12 in subsaharan markets } Now you can't find either AK's or 600M hard drives - but for the price of a 80Gig hard drive you could, if you were in the subsaharan market pick up 2 way used AK-47's. And to think - AK's are holding value better than hard drives. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Test
Test Message. please disregard.
Looping through variables
Hello, All: I'm trying to loop through a list of variables and print their values. e.g., print $name, $age, $phone. What's the best way to do this? I've tried foreach (qw(name age phone)) { print ${$_}; } but that doesn't seem to work. -- Eric P. Los Gatos, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Looping through variables
close, but leave out the qw. foreach($name,$age,$phone){ print $_ ; } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 1:12 AM To: Beginners Perl Mailing List Subject: Looping through variables Hello, All: I'm trying to loop through a list of variables and print their values. e.g., print $name, $age, $phone. What's the best way to do this? I've tried foreach (qw(name age phone)) { print ${$_}; } .but that doesn't seem to work. -- Eric P. Los Gatos, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Looping through variables
I'm trying to loop through a list of variables and print their values. e.g., print $name, $age, $phone. What's the best way to do this? I've tried foreach (qw(name age phone)) { print ${$_}; } but that doesn't seem to work. It works for me (using perl 5.6.1), what seems to be the problem? Why do you want to do this instead of just having three print statements? Are you sure that you have data in the thre variables? /\/\ark -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I want it skips to the line where it stopped.
On Friday, May 17, 2002, at 03:18 , loan tran wrote: My question are: 1. Is there a way to make search_error.pl continue to read the errorlog_file after it was pruned without restarting the script. 2. In the situation I have to restart the script (like in case of machine have been bounced), I dont want the script starts reading from the beginning of errorlog_file, I want it skips to the line where it stopped. How can I make this happens. Thanks in advance for your input. Loan Tran [..] What you have here is the classic LogRolling Problem. what you want is a Signal Handler - $SIG{HUP} = \rollLog; sub rollLog { # our premise is that the log file was already open } an illustration is at: http://www.wetware.com/drieux/pbl/Sys/logRollModel.txt you might want to think about doing this as a real daemon http://www.wetware.com/drieux/pbl/Sys/daemon1.txt I understand that in the last five seconds - a lot of grot can roll in and it may take an arbitrarily long amount of time to get back to grovelling that log file - but have you thought about upping the sleeptime to allow other processes on the host a chance to use the system ??? ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Looping through variables
On Friday, May 17, 2002, at 05:16 , Mark Anderson wrote: we all agree that this is a 'bad' idea and that timothy has the right solution... now for the troubling bits... What's the best way to do this? I've tried foreach (qw(name age phone)) { print ${$_}; } but that doesn't seem to work. It works for me (using perl 5.6.1), what seems to be the problem? what version of perl 5.6.1 are you using? barring the fact that I had to turn strict off my ($name, $age, $phone) = qw/ drieux InHex cellular/; foreach($name,$age,$phone){ print \t$_ \n; } foreach (qw(name age phone)) { if ( ${$_} ) { print happy Thoughts $_ = ${$_} \n; } else { print \tUnhappy, know $_ but not \$\{$_\} \n; } } generates: drieux InHex cellular Unhappy, know name but not ${name} Unhappy, know age but not ${age} Unhappy, know phone but not ${phone} on the perl v5.6.1 - ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Looping through variables
On Fri, 17 May 2002, Mark Anderson wrote: It works for me (using perl 5.6.1), what seems to be the problem? Why do you want to do this instead of just having three print statements? Are you sure that you have data in the thre variables? FWIW: Looking back at my original script, I had declared the variables $name, $age, $phone *OUTSIDE*OF* the foreach loop. That's why they were undefined!!! my ($name, $age, $phone); foreach (qw(name age phone)) { print ${$_}; } (What a bone-head!) Actually, what I was *trying* to do was dereference variables and pass their values to DBI-quote() to build a string. e.g., # Build the value string 'eric','34','555-1212' foreach ($age $name $phone) { $values .= $dbh-quote($_) . ','; } # Remove the extra comma at the end chop $values; $dbh-do(INSERT INTO $dbfile ($column_names) VALUES ($values)); I suppose that I should just pass the variable's *value* to quote() instead of trying to pass the variable itself. Thanks! -- Eric P. Los Gatos, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: **Perl Import Problem**
On Friday, May 17, 2002, at 05:34 , Andy Schwarz wrote: [..] The e-mail headers look like: Date: Mon, 31 Jan 2000 19:09:12 -0600 Reply-To: Bob Jones [EMAIL PROTECTED] Sender: ISWORLD Information Systems World Network[EMAIL PROTECTED] From: Bob Jones [EMAIL PROTECTED] Subject: AMCIS 2000 Minitrack The Perl script: # find the date line $DatePos = index($ThisMessage, Date: ); $EndDatePos = index($ThisMessage, \n, $DatePos); # extract the date line from the header if ($DatePos 0) { $Date = Trim(substr($ThisMessage, $DatePos + 6, $EndDatePos - $DatePos - 6)); [..] how about a little simpler??? I had to add a line of Junk to even get yours to almost fly If I remove the line of HeaderStuff Junk it chokes but either way why not the simpler sub GrotDateFromMsg { my ($msg ) = @_; my $string = 'bad'; if ($msg =~ m/Date:\s+([^\n]+)/ ) { $string = $1; } $string; } given your 'message' it will return the thing I think you want and the print She Called it's a \$Date :$Date:\n ; puts your variable inbetween the colons :Mon, 31 Jan 2000 19:09:12 -0600: # the ':' are to show size then from there you can get along to reverse engineering what ever it is that you want... ciao drieux --- my $ThisMessage =EOM; HeaderStuff Junk Date: Mon, 31 Jan 2000 19:09:12 -0600 Reply-To: Bob Jones Sender: ISWORLD Information Systems World NetworkISWORLD\@LISTSERV.HEANET.IE From: Bob Jones bjones\@MAIL.COX.SMU.EDU Subject: AMCIS 2000 Minitrack EOM print Start with:\n$ThisMessage\n#---\n; my $DatePos = index($ThisMessage, Date:); my $EndDatePos = index($ThisMessage, \n, $DatePos); my $Date; # extract the date line from the header if ($DatePos 0) { $Date = Trim(substr($ThisMessage, $DatePos + 6, $EndDatePos - $DatePos - 6)); $Date = lc($Date); } if ($Date) { print $Date\n ; }else{ print No date for \$Date - it just sit by the phone\n; } if ($ThisMessage =~ m/Date:\s+([^\n]+)/ ) { $Date = $1; if ($Date) { print She Called it's a \$Date :$Date:\n ; } } # # sub Trim { my ($msg ) = @_; my $string = 'bad'; print Sub: with :$msg:\n; if ($msg =~ m/Date:\s+([^\n]+)/ ) { $string = $1; } $string; } # end of Trim -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Looping through variables
On Friday, May 17, 2002, at 01:41 , [EMAIL PROTECTED] wrote: # Build the value string 'eric','34','555-1212' foreach ($age $name $phone) { $values .= $dbh-quote($_) . ','; } # Remove the extra comma at the end chop $values; $dbh-do(INSERT INTO $dbfile ($column_names) VALUES ($values)); if you want to be wayDrok try my @list = my ($name, $phone, $reality) = qw/drieux ring what/; print We have $_ \n foreach(@list); The question of data structure selection really is the space you want to be thinking about note that the above gives you four variables - or you could toss out the intermediary grouping... and go with say use constant NAME= 0; use constant PHONE =1; use constant REALITY = 2; my @list = qw/drieux ring what/; print $_ - $list[$_]\n foreach (NAME,PHONE,REALITY); try it ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Regex, search until second digit
Hello all, I have a var, $DOC_NAME, holding a file name. I need to get the first part of the variable into another variable. Some examples are A98-12345, SO-02-789, P-99-029833 and GQE-37-2199. Examples: A98-12345, I need A98 SO-02-789, I need SO-02 P-99-029833 I need P-99 GQE-37-2199 I need GQE-37 I know if it were always the first X that I needed I could do this: $SUBDIR = (substr ($DOC_NAME, 0, X)); Really, I need everything until I get 2 digits in the new var. Anyone want to take a stab at this? Thanx for any help! CONFIDENTIALITY NOTICE: This message may contain legally confidential and privileged information and is intended only for the named recipient(s). No one else is authorized to read, disseminate, distribute, copy, or otherwise disclose the contents of this message. If you have received this message in error, please notify the sender immediately by e-mail or telephone and delete the message in its entirety. Thank you. GWIASIG 0.06c -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Looping through variables
On Friday, May 17, 2002, at 05:35 PM, drieux wrote: On Friday, May 17, 2002, at 05:16 , Mark Anderson wrote: we all agree that this is a 'bad' idea and that timothy has the right solution... now for the troubling bits... What's the best way to do this? I've tried foreach (qw(name age phone)) { print ${$_}; } but that doesn't seem to work. It works for me (using perl 5.6.1), what seems to be the problem? what version of perl 5.6.1 are you using? barring the fact that I had to turn strict off my ($name, $age, $phone) = qw/ drieux InHex cellular/; foreach($name,$age,$phone){ print \t$_ \n; } foreach (qw(name age phone)) { if ( ${$_} ) { print happy Thoughts $_ = ${$_} \n; } else { print \tUnhappy, know $_ but not \$\{$_\} \n; } } generates: drieux InHex cellular Unhappy, know name but not ${name} Unhappy, know age but not ${age} Unhappy, know phone but not ${phone} on the perl v5.6.1 - ciao drieux try it without the 'my' on your variables. and then tell me why that matters as you thwack yourself upside. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
A simple question
Hi All Is there an easier way of picking out the number 16764 in this line rather that using an array, split then $number[3] I just want to get 16764 into $recievedmail Is the answer something like this $recievedmail = ($data)[3]; $data = Received 921MB 16764 3955 375 2.2% 1296 7.7%; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: **Perl Import Problem**
Andy Schwarz wrote: Howdy! Hello, I am attempting to import some mailing list archives into lyris format using a Perl script. I have all of the script working, except for the importing of the dates. For some reason, the date field does not import correctly. Below is the data that I am trying to import and the script used. Any help or advice would be GREATLY appreciated!! Thank you! Andy Schwarz The e-mail headers look like: Date: Mon, 31 Jan 2000 19:09:12 -0600 Reply-To: Bob Jones [EMAIL PROTECTED] Sender: ISWORLD Information Systems World Network[EMAIL PROTECTED] From: Bob Jones [EMAIL PROTECTED] Subject: AMCIS 2000 Minitrack The Perl script: use warnings; use strict; # find the date line $DatePos = index($ThisMessage, Date: ); If the Date: string is at the beginning of $ThisMessage which it appears to be in your example then the value of $DatePos will be set to 0 (zero). $EndDatePos = index($ThisMessage, \n, $DatePos); If $DatePos is zero then this will be the same as: $EndDatePos = index($ThisMessage, \n); But since the newline will be at the end of the line this is the same as: $EndDatePos = length($ThisMessage) - 1; Or you could just use chomp() to remove the newline and use length(). # extract the date line from the header if ($DatePos 0) { $Date = Trim(substr($ThisMessage, $DatePos + 6, $EndDatePos - $DatePos - 6)); $Date = lc($Date); If $DatePos is zero as I pointed out earlier this will not run. # parse mail date format $Date =~ /([0-9]+[0-9]?) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)((1?9?([8-9]+[0-9]+))|(2?0? ([0-9]+[0-9]+)))/; $Day = $1; $Month = $months{$2}; $Year = $3; You should _always_ test that the regular expression worked before using the numeric scalars. $NewDate = $Month.'/'.$Day.'/'.$Year; $StdDate = UnformatDate($NewDate); Your sub UnformatDate can be replaced with an sprintf() my $StdDate = sprintf '%04d%02d%02d', $Year, $Month, $Day; #print Day: $Day Month: $Month Year: $Year $NewDate\n; if ($Month 1) { print Unable to parse date: $Date\n; STDIN; } else { $ThisAttribs{'Created'} = $StdDate; } sub UnformatDate { my $InDate = $_[0]; if ($InDate =~ /(.*?)\/(.*?)\/(.*)/) { my $tmpYear = 0019.$3; Why are you assuming a twentieth century date? my $tmpMonth = 00.$1; my $tmpDay = 00.$2; my $ReturnDate = substr($tmpYear, length($tmpYear) - 4).substr($tmpMonth, length($tmpMonth) - 2).substr($tmpDay, length($tmpDay) - 2); return $ReturnDate; } return; } If you have Date::Manip installed then: use Date::Manip; my $date; if ( /^Date:\s+(.+)/ ) { $date = ParseDate( $1 ); } my $StdDate = substr( $date, 0, 6 ); my ( $Year, $Month, $Day ) = unpack( 'a4a2a2', $date ); my $NewDate = $Month/$Day/$Year; __END__ If you don't have Date::Manip then: my %months = qw(Jan 1 Feb 2 Mar 3 Apr 4 May 5 Jun 6 Jul 7 Aug 8 Sep 9 Oct 10 Nov 11 Dec 12); my $mon_re = join '|', keys %months; my ( $Year, $Month, $Day ); if ( /^Date:\s+ # must start with Date: (?:Sun|Mon|Tue|Wed|Thu|Fri|Sat),\s+ # match weekday without capture (\d+)\s+ # match day of month ($mon_re)\s+ # match month (\d+)\s+ # match year /x ) { $Day = $1; $Month = $months{ $2 }; $Year = $3 } my $NewDate = $Month/$Day/$Year; my $StdDate = sprintf '%04d%02d%02d', $Year, $Month, $Day; __END__ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Regex, search until second digit
Bill Akins wrote: Hello all, Hello, I have a var, $DOC_NAME, holding a file name. I need to get the first part of the variable into another variable. Some examples are A98-12345, SO-02-789, P-99-029833 and GQE-37-2199. Examples: A98-12345, I need A98 SO-02-789, I need SO-02 P-99-029833 I need P-99 GQE-37-2199 I need GQE-37 I know if it were always the first X that I needed I could do this: $SUBDIR = (substr ($DOC_NAME, 0, X)); Really, I need everything until I get 2 digits in the new var. Anyone want to take a stab at this? $ perl -le' for my $DOC_NAME ( qw/A98-12345 SO-02-789 P-99-029833 GQE-37-2199/ ) { my ($SUBDIR) = $DOC_NAME =~ /(.*)-/; print $SUBDIR; } ' A98 SO-02 P-99 GQE-37 John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A simple question
Stuart Clark wrote: Hi All Is there an easier way of picking out the number 16764 in this line rather that using an array, split then $number[3] I just want to get 16764 into $recievedmail Is the answer something like this $recievedmail = ($data)[3]; $data = Received 921MB 16764 3955 375 2.2% 1296 7.7%; ($recievedmail) = $data =~ /\b(\d+)\b/; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]