RE: slurping function like shell

2003-01-21 Thread Bob Showalter
R. Joseph Newton wrote: > The die function can be very useful > working in console mode, but it is hell for CGI debugging. > Since errors go into the server error log, which tends to be > accessible only to the system admin, it can be damn near > useless to have die statements in a CGI script. You

Re: slurping function like shell

2003-01-21 Thread John W. Krahn
Harry Putnam wrote: > > "John W. Krahn" <[EMAIL PROTECTED]> writes: > > > You shouldn't use ampersands unless you need the different behavior they > > provide. > > John, > I asked for a documentation pointer on this in a previous post that > hasn't hit the server here yet, but don't bother with

Re: slurping function like shell

2003-01-21 Thread R. Joseph Newton
" ... > open(FILE,">somefile") or die "Cannot open 'somefile' $!"; Not being argumentative here but I've seen this said before. Not really sure why it is important. I mean why is the open action singled out for this protection. It seems other actions could also cause a misfired script? ..."

Re: slurping function like shell

2003-01-21 Thread Harry Putnam
Ben Siders <[EMAIL PROTECTED]> writes: > You should always perform all error checking in any language to ensure Well thanks Ben. That was nice full explanation and makes a lot of sense. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: slurping function like shell

2003-01-21 Thread Ben Siders
strftime is an interface to a C function of the same name. It's a fairly common function in many applications that have to deal with dates and times. You may not need it here, but it's not a bad idea to get a little familiar with it. For the life of me, I can't ever remember all the format c

Re: slurping function like shell

2003-01-21 Thread Harry Putnam
"John W. Krahn" <[EMAIL PROTECTED]> writes: > You shouldn't use ampersands unless you need the different behavior they > provide. John, I asked for a documentation pointer on this in a previous post that hasn't hit the server here yet, but don't bother with that please. I found the info in perlf

Re: slurping function like shell

2003-01-21 Thread Harry Putnam
"John W. Krahn" <[EMAIL PROTECTED]> writes: > You should probably be using POSIX::strftime instead which is simpler > and faster. > > use POSIX 'strftime'; > > print FILE strftime( "An extra numeral <%D %T %w> appears\n", > localtime ); Probably coming off like some kind of carpy here but I'm

Re: slurping function like shell

2003-01-21 Thread Ben Siders
You should always perform all error checking in any language to ensure that your program, if it fails, declines gracefully. One of the greatest shortcomings of C is that error checking is entirely manual, and you simply must, in every real-world application, check the return value of almost ev

Re: slurping function like shell

2003-01-21 Thread Harry Putnam
Thanks for tips posters.. "John W. Krahn" <[EMAIL PROTECTED]> writes: > You should _always_ verify that the file opened successfully. > > open(FILE,">somefile") or die "Cannot open 'somefile' $!"; Not being argumentative here but I've seen this said before. Not really sure why it is import

Re: slurping function like shell

2003-01-20 Thread John W. Krahn
Harry Putnam wrote: > > Maybe unrelated to the comments above since this is `do' I'm posting > about in this post. But I'm still seeing something here I don't > understand. > > I'll use my reall example code since that is where I notice this > phenomena. > > My function to slurp looks like: >

Re: slurping function like shell

2003-01-20 Thread simran
You are actually not explicitly returning anything from the lctime subroutine, which means that implicitly perl will return the last return value of what happened in lctime. Here is what you need to do: * Change your printf to sprintf (i assume sprintf is what you really want) * put a

Re: slurping function like shell

2003-01-20 Thread Harry Putnam
Wiggins d'Anconia <[EMAIL PROTECTED]> writes: > "The file must return true as the last statement to indicate > successful execution of any initialization code, so it’s customary to > end such a file with "1;" unless you’re sure it’ll return true > otherwise. But it’s better just to put the "1;",

Re: slurping function like shell

2003-01-20 Thread Harry Putnam
Harry Putnam <[EMAIL PROTECTED]> writes: > Ick... I flew right over that about the `1' in perldoc -f require. > Always was confused by the term `return'. I guess its pretty basic > to programmers but to us lifetime heavy construction workers it can > be a bit mysterious. > > Thanks for the guida

Re: slurping function like shell

2003-01-20 Thread Harry Putnam
Wiggins d'Anconia <[EMAIL PROTECTED]> writes: > Sorry "customary" (as the perldoc for require states) is a better word > than "standard". From perldoc -f require: Ick... I flew right over that about the `1' in perldoc -f require. Always was confused by the term `return'. I guess its pretty bas

Re: slurping function like shell

2003-01-20 Thread Wiggins d'Anconia
Wiggins d'Anconia wrote: Harry Putnam wrote: pfnc.pm did not return a true value at ./use.pl line 2. BEGIN failed--compilation aborted at ./use.pl line 2. Place a line such as: 1; In the bottom of the library so that it "returns true". This is standard. http://danconia.org Sorry

Re: slurping function like shell

2003-01-20 Thread Wiggins d'Anconia
Harry Putnam wrote: pfnc.pm did not return a true value at ./use.pl line 2. BEGIN failed--compilation aborted at ./use.pl line 2. Place a line such as: 1; In the bottom of the library so that it "returns true". This is standard. http://danconia.org -- To unsubscribe, e-mail: [EMAIL

Re: slurping function like shell

2003-01-20 Thread Harry Putnam
Wiggins d'Anconia <[EMAIL PROTECTED]> writes: [...] > 'use' can be as simple or complex as you wish really. The only thing > slightly more complicated is if @INC doesn't contain where your *.pm > lives. But that would be a simple case of doing > > use lib ('/path/to/libs/'); > > before your other

RE: slurping function like shell

2003-01-20 Thread Bob Showalter
Harry Putnam wrote: > I know this is a horse that has been ridden hard before, but not so > easy to find the results. > > How does one slurp a function or series of functions in perl? > Similar to the way its done in shells': >. somefunction > > I know about the: > use (some.pm file); >

Re: slurping function like shell

2003-01-20 Thread Wiggins d'Anconia
Harry Putnam wrote: I know this is a horse that has been ridden hard before, but not so easy to find the results. How does one slurp a function or series of functions in perl? Similar to the way its done in shells': . somefunction I know about the: use (some.pm file); syntax, of course,

slurping function like shell

2003-01-20 Thread Harry Putnam
I know this is a horse that has been ridden hard before, but not so easy to find the results. How does one slurp a function or series of functions in perl? Similar to the way its done in shells': . somefunction I know about the: use (some.pm file); syntax, of course, but it seems to entail