Re: Flip-flop operator help

2006-07-24 Thread David Nicol
On 7/24/06, Craig Cardimon <[EMAIL PROTECTED]> wrote: > That is, indeed, the rub. Some files are HUGE (large enough to bring the > system to its knees), and slurping is out of the question -- much to my > chagrin. To make this script handle ALL cases, I have to pretend all > files are biggies, and

Re: recovering crontab result

2006-07-21 Thread David Nicol
~ 7/19/06, [EMAIL PROTECTED]: ~> is there a way of running an external command in such a way that I can get ~> a pass/fail result into my script? i think you want to look at the entry on $? aka $CHILD_ERROR in perldoc perlvar. -- David L Nicol you only get one stone per turn ___

Re: Flip-flop operator help

2006-07-19 Thread David Nicol
On 7/14/06, Craig Cardimon <[EMAIL PROTECTED]> wrote: > Anyone know how I might try to accomplish this? > > Craig another way to do it, if you have enough memory to slurp the whole file, would be to slurp the whole file and then split it on // and then look at those pieces in turn, before and aft

Re: Regexp substitution

2006-07-18 Thread David Nicol
On 7/17/06, Thurn, Martin <[EMAIL PROTECTED]> wrote: > You guys and gals should REALLY start using q{} and qq{} for your > literal strings. And especially, use qr{} for strings intended to be > used as a regex!!! > - - Martin yes, yes! I think you can $r1=qr{$p1} and eliminate all evals (except

Re: Perl Includes?

2006-06-26 Thread David Nicol
On 6/26/06, Daniel Rychlik <[EMAIL PROTECTED]> wrote: > we don't want to install > Perl on each of the 1200 servers that we update. Transferring this amount > of data X 7 is not feasible every time I need to change a Perl program to > include new tasks. My question is, how I can compile the DBI

golf hole regex to parse name=value pairs from a string

2006-06-15 Thread David Nicol
On 6/15/06, Bill Stennett - compuserve <[EMAIL PROTECTED]> wrote: I have a string formatted like this: my $mystring = 'var1=123::var2=abc456::var3=10.99::var4=def'; What I need to do is to be able to extract name=value. I cannot be sure where in the list a any value will occur so to extract a v

Re: To find if a function exists

2006-05-31 Thread David Nicol
# perl -wle 'sub aaa{print 1}; exists &main::aaa and print "yes"' yes# perl -wle 'sub aaa{print 1}; exists &main::aab and print "yes"' # -- David L Nicol"For every thousand hacking away at the leaves of evil, there is onestriking at the root." -- Thoreau. ___

Re: foreach question

2006-04-06 Thread David Nicol
No. On 4/6/06, Conrad, Bill (ThomasTech) <[EMAIL PROTECTED]> wrote: > Hi All > > Give a foreach loop > > foreach $entry ( @list ) { > > } > > Is there a way to get the position index within @list $entry is from > without counting the iterations of the loop > > Than

Re: How to tell if an array is empty?

2006-03-24 Thread David Nicol
On 3/24/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Dear list, > > I've got this code: > > # now grab sub_domains, if there are any > my @sub_domains = keys( %{ $HKU->{$full_domain} } ); > > # if there are sub-domains, we don't want the parent in the list > if ($#sub_domains >= 0) { >

Re: Anything better than Signal? - For Async Procsess notification

2006-02-27 Thread David Nicol
On 2/27/06, Arijit Das <[EMAIL PROTECTED]> wrote: > So, I was just wondering if there is any other method of async process > notification that I can use for this scenario apart from Signals? Basically, > my requirement is, I have a script which should keep on doing its job but > after 300 secs of

Re: Flocking a DBM files

2006-02-06 Thread David Nicol
i used to always open a separate file explicitly for locking, and flock that file, instead of fooling around with db internals. DBM, in particular, opens two files. Which one, if either, does tie() return? What if you switch to a database that does not use a fh as the tie object? By explicitly c

Re: ignoring exceptions

2006-01-19 Thread David Nicol
On 1/19/06, DZ-Jay <[EMAIL PROTECTED]> wrote: > Hello: > This might sound like a stupid question, I'm guessing that your current syntax works because you have declared prototypes for CATCH and POST of (\&) which coerces the block given as their arguments into a coderef? A pretty big synt

Re: Regular Expression question w/ long numbers

2006-01-10 Thread David Nicol
On 1/10/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Thanks! This is what I'm looking for. > > -- Original message -- > From: "DePriest, Jason R." <[EMAIL PROTECTED]> > > > use Math::BigFloat; > > $m = Math::BigFloat->new('7191750529163469.123'); # notice NO double >

Re: Regular Expression question w/ long numbers

2006-01-09 Thread David Nicol
On 1/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > It seems like a simpler question would be; how do I tell Perl to not convert > my long numbers to scientific notation? keep them as strings, as you are doing. Why do you need such accuracy? What process is generating real data that you ar

Re: Passing arguments by value

2005-12-13 Thread David Nicol
Is anyone besides $Bill Luebkert confused by the suggestion in perldoc that passing a perl reference to a container is the way to keep the container from getting flattened, to the point that the doc would benefit from a rewrite? -- David L Nicol I'll see your time division multiplexing and raise y

Re: Passing arguments by value

2005-12-12 Thread David Nicol
http://www.google.com/search?q=define%3A+pass+by+reference ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Passing arguments by value

2005-12-12 Thread David Nicol
On 12/12/05, Peter Scott <[EMAIL PROTECTED]> wrote: > On Sun, 11 Dec 2005 21:32:09 -0800, $Bill Luebkert wrote: > > We're talking Perl > > references here. > > No we aren't. The phrase "pass by reference" is a computer science term > that predates the invention of Perl. The word "reference" there

Re: Passing arguments by value

2005-12-11 Thread David Nicol
On 12/10/05, $Bill Luebkert <[EMAIL PROTECTED]> wrote: > Chaddaï Fouché wrote: > > > $Bill Luebkert wrote: > > > > > >>Perl normally passes by value . > >> > > > > That is unaccurate : Perl always passes by reference (or rather by > > alias), but we do the copy ourselves when we handle the argument

Re: STDERR and redirection

2005-12-09 Thread David Nicol
Here is a clue .. I have not done this, but I understand that it is possible to run an ioctl on a file descriptor to determine the nature of the descriptor, such as , is it a tty, or a pipe, or a file, or what. On 12/9/05, Phil Rafferty <[EMAIL PROTECTED]> wrote: > Can I find out > 1) whether

Re: Ah, another flame war in the making...

2005-11-22 Thread David Nicol
On 11/22/05, Lester Pyle <[EMAIL PROTECTED]> wrote: > I have a whole box of unused punch cards in my garage that I use for > making lists to go the the hardware store. One supposes that if you make a list for a store of a different type, your errand is halted with a compile-time fault? _

Re: Matching ip to Network

2005-11-11 Thread David Nicol
What, no bit-shifting?-- David L NicolI like that guy -- he once gave me a fish ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Matching ip to Network

2005-11-10 Thread David Nicol
On 11/10/05, Bullock, Howard A. <[EMAIL PROTECTED]> wrote a suite of conversion functions like ntoa and aton and so on in perl How about ipv6? Where does that fit in? ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http

Re: Matching ip to Network

2005-11-10 Thread David Nicol
On 11/10/05, David Budd <[EMAIL PROTECTED]> wrote: > > Raniak Robert is right. > > I did mistake in formulation. Right one is > > (256*256*256*A)+(256*256*B)+(256*C)+D > > I've always done ((A*256+B)*256+C)*256+D > Slightly more efficient is not. They both have three multiplications and three add

Re: network matching -> regexp

2005-11-10 Thread David Nicol
On 11/10/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > is it not better to teach a man to fish rather than giving him one? which > is more beneficial in the long run? In the case that you are an entrepreneur trying to market fish shop franchises, it is better to give fish away, as that will

Re: Passing references to DB handles between main and subs

2005-10-27 Thread David Nicol
On 10/27/05, Mark Knoop <[EMAIL PROTECTED]> wrote: > require Exporter; > my @ISA = qw(Exporter); > my @EXPORT = qw(GetDBHandle); @ISA and @EXPORT are going to be used outside of the file, so they should be C instead of C, if not use vars qw/@ISA @EXPORT/;

Re: Late-day brane fade question: dereferencing?

2005-10-20 Thread David Nicol
On 10/19/05, [EMAIL PROTECTED] >-ar => [EMAIL PROTECTED] ); # I wanna lose the "\" here if there's only one array you want to pass this way and you're cool with it always being the last thing in the arguments, you could do something like sub routine{ my ($foo,$bar,$baz,$smurf,@a

Re: $^O special variable behavior

2005-10-18 Thread David Nicol
On 10/17/05, $Bill Luebkert <[EMAIL PROTECTED]> wrote: > The /g modifier is not wanted/needed. It's curious that the /g modifier has any effect at all, and more so in one os but not the other. If you can figure out why and fix it, you could get your name in the authors file, but this issue isn'

Re: Top posting

2005-10-04 Thread David Nicol
If this thread doesn't stop PDQ I will unsubscribe from the activeperl mailing list. The activeperl mailing list is too wide of a forum for such sophomorism. Please take it to your local perl mongers chapter, where it belongs. Call me what you will, but so's your mother. ___

Re: does anyone use prototypes

2005-09-16 Thread David Nicol
an it is written, as you try to remember what exactly the function does, when you are maintaining it, so it is good to have the recursive call in the recursive function follow the same protocol as is reccommended for use of the recursive function outside of itself. Back to work David Nicol _

Re: regexp /o in a sub

2005-09-12 Thread David Nicol
On 9/12/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > [ i get a performance improvement from the /o switch ] I am surprised, as I had thought that /o only applied when there was a variable within the regexp. I guess I was wrong on that count. Have you tried C on your switch variable? Does

Re: .bat to .pl

2005-09-03 Thread David Nicol
On 9/3/05, Rick Nakroshis <[EMAIL PROTECTED]> wrote: > To be more precise, no, there is no translator that analyzes what > your batch file is doing to then generate a perl script. If you show > us your batch file, we can give you some pointers and ideas if you like. > > Rick I can't think of a

Re: Sharing Variables among Processes...

2005-08-24 Thread David Nicol
On 8/24/05, Brian Raven <[EMAIL PROTECTED]> wrote: > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Arijit > Das > Sent: 24 August 2005 16:42 > To: activeperl@listserv.ActiveState.com; > perl-unix-users@listserv.ActiveState.com > Subject: Sharing Va

Re: Timing Out a Hanging function...how?

2005-07-28 Thread David Nicol
On 7/28/05, Arijit Das <[EMAIL PROTECTED]> wrote: > How can I time out a subroutine/function? > > print "My code is executing...the next sub inokation > takes a long time simetimes. SO, I want to ensure that > at max it should take 5 secsonds."; > my $device_name = Quota::getqcarg($path); > > >

Re: hashrefs and curlies? please help!

2005-07-27 Thread David Nicol
you do have a command line somewhere in your computer do you not? $ perl -wle '$H={a=>1,b=>2};print $H->{b}' 2 $ perl -wle '$H={a=>1,b=>2};print $H->b' Can't call method "b" on unblessed reference at -e line 1. ___ ActivePerl mailing list ActivePerl

Re: Requirement or Syntactic Sugar?

2005-07-27 Thread David Nicol
On 7/27/05, Brian Raven <[EMAIL PROTECTED]> wrote: > Then the first format is just: $thing = $stuff->member; > > This is a subrouting call. Assuming that $stuff is a blessed reference, > then this is effectively '$thing = ref($stuff)::member($stuff);' > > While the fancy one is:

Re: Variable reference

2005-07-27 Thread David Nicol
On 7/27/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > ``my'' variables (lexical variables) do not appear in the symbol table at > run time (as do package variables, whether declared or auto-vivified) and so > cannot be referenced ``symbolically''. lexical variables are dealt with > and

Re: Exit from Sub Routine without exit the script

2005-07-26 Thread David Nicol
Perl supports exception handling with the C keyword. package everything_is_an_error; sub AUTOLOAD { die "$AUTOLOAD is an error! (called with args @_)\n" }; package Chandrasekaran; eval { everything_is_an_error->wibble('frobnitz','lumpengroovy') } print "We got an error, y

Re: Caching Array value

2005-07-11 Thread David Nicol
On 7/10/05, Joseph C. Bautista <[EMAIL PROTECTED]> wrote: > Hi All, > >I have a menu in hierarchical forms that have a 28K parent/child > nodes. And I don't like to query it again and again everytime the > user(s) clicked a certain item to view the information and see the > children nodes. I w

Re: OpenSSL

2005-06-26 Thread David Nicol
On 6/26/05, Joseph C. Bautista <[EMAIL PROTECTED]> wrote: > My script will just encrypt the password and decrypt it for > validation purposes Better to use a one-way hash instead of something decryptable. ___ ActivePerl mailing list ActivePerl@list

Re: comparing data in array

2005-06-02 Thread David Nicol
> I have data in an array and then compare each data with a certain > condition. How can I retrieve each data in an array and then compare it? > > my $condition = data5; > > @array1 = data1, data2, data3, data4, etc. > > > if ($condition eq @array1) { > print "true"; > } Here's anothe

Re: timing functions

2005-05-25 Thread David Nicol
there's also POSIX::clock, for what it's worth ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Preserving State in CGI

2005-05-19 Thread David Nicol
On 5/18/05, $Bill Luebkert <[EMAIL PROTECTED]> wrote: > > Even with the goto's, you could just verify that the state vrbl > was legit (using a hash) and then just do the goto without all > the rest of the junk. > > if (exists $hash{$state}) { > goto $state; > } else { > error > }

Re: reading socket stream with timeout

2005-05-09 Thread David Nicol
On 5/7/05, Foo Ji-Haw <[EMAIL PROTECTED]> wrote: > Great idea. Will check that out as well. Thanks. > > But as a technical question, has anyone faced such a problem? If so, how > do you resolve this? alarm 5; $SIG{ALRM} = sub {what to do when the alrm happens}; works with cygperl but not activepe

Re: Starting process on remote machine

2005-04-20 Thread David Nicol
On 4/20/05, Hemphill, Barry <[EMAIL PROTECTED]> wrote: > The main requirement is that we can not install any code on the remote > systems. then you're dead in the water and the best thing to do is walk out immediately. Any technology that could do what you are asking would be a powerful intrusi

Re: How to build a list of files on a drive...

2005-04-18 Thread David Nicol
> Here's a newbie question I guess. How would I build a list of all > files on a specified drive, recursively building the list? > Suggestions or snippets would be appreciated. > > Robert Maxwell $drive = 'c'; open MYFILELIST, "dir $drive: /s/b |" or die "could not spawn d

Re: A better way? templates maybe?

2005-04-01 Thread David Nicol
On Apr 1, 2005 9:42 AM, $Bill Luebkert <[EMAIL PROTECTED]> wrote: > Daniel Wilson wrote: > > > Your Thoughts? > > Perl has a formatted write, but I don't like it. but in this case it would be a good tool. ___ ActivePerl mailing list ActivePerl@listser

Re: GAMS

2005-03-31 Thread David Nicol
typing "perl" into the search widget at www.gams.com gives three pages, one of which is http://www.gams.com/presentations/poster_gams-x.pdf which appears to be a commercial product promising some kind of Perl interface. GAMS appears to be a console-driven application with file configuration, and

Re: Dynamic Hash Array Declare?

2005-03-28 Thread David Nicol
don't understand the question. the code example is a lot of array references. Push, pop, splice all work on anonymous arrays, if that helps On Mon, 28 Mar 2005 12:59:24 -0500, Daniel Wilson <[EMAIL PROTECTED]> wrote: > Hello Perl World! > > I need a little help.. > > I currently have the

Re: [Kc] Permission denied on unlink

2005-03-24 Thread David Nicol
Ken Cornetet correctly advised me that I may have been trying to delete a file that had an open handle on it. ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Permission denied on unlink

2005-03-24 Thread David Nicol
The following is a FAQ, right? Does anyone know the answer to the question posed at http://aspn.activestate.com/ASPN/Mail/Message/perl-win32-admin/213580 I too am having trouble unlinking files, in directories that were created tge same way, and $! is set to Permission denied when I do a ls

Re: commenting script

2005-03-23 Thread David Nicol
in vi there's always :.,+100s/^/# / but if your editor doesn't have legacy command line editing capability, a decent way to comment out a block of syntactically correct perl code is to enclose it in if(0){ ... }; another possibility is