Re: interpolated strings

2004-03-28 Thread WC -Sx- Jones
Bryan Harris wrote: $newtxt =~ s/([^\n])$/$1\n/; This is clearer: $newtext = "Hello\n\n\n"; $newtext =~ s/\n+/\n/; print $newtext; -Sx- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How to determine if STDIN has piped data?

2004-03-28 Thread Bryan Harris
> Alternatively, you can use the '-t' operator: > > exit 0 if -t STDIN I've been waiting for this for a LONG time, thanks Smoot. - B -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: interpolated strings

2004-03-28 Thread Bryan Harris
Wow, Johns, thanks for the tips... I'm going to have to study that map command very closely. Either way you've answered my question, thanks! Only one thing to add-- you ask: >>chomp $newtxt; >>print $newtxt, "\n"; > > Why remove "\n" in one line and then add it back on the next line

Re: Find User Apache is running as

2004-03-28 Thread WC -Sx- Jones
JupiterHost.Net wrote: problem is foo.pl can be run simultaneously by 2 different users so I'm not sure how I'd be able to make foo.pl tell which ps it belongs to. Not a problem - each will have it's own address space and PID. The issue - and you haven't shown any code - is mutual data access. Th

Re: Find User Apache is running as

2004-03-28 Thread WC -Sx- Jones
u235sentinel wrote: I'm wondering if there is a perl module to read from the apache server status screen. Doesn't it tell you the server version running? Also, when you connect to a web server, doesn't it pass along this information also? See #!/usr/local/bin/perl -w use strict; use Text::Wrap

Re: Find User Apache is running as

2004-03-28 Thread u235sentinel
I'm wondering if there is a perl module to read from the apache server status screen. Doesn't it tell you the server version running? Also, when you connect to a web server, doesn't it pass along this information also? Been awhile since I've worked with web servers (I'm still a perl noob btw)

Re: Find User Apache is running as

2004-03-28 Thread JupiterHost.Net
Thank you Gaffney and Jones for your input. I may have to parse external program output I suppose. I was hoping there would be a more built in or Modular way to get it. Part of the problem is foo.pl can be run simultaneously by 2 different users so I'm not sure how I'd be able to make foo.pl te

Re: warn ?!

2004-03-28 Thread John W. Krahn
"Randy W. Sims" wrote: > > On 3/27/2004 10:12 PM, John W. Krahn wrote: > > > > Did you know that $! is one of those "magical" variables that contains > > both a number and a string at the same time! AMAZING BUT TRUE! Here is > > an exerpt from the perl source: > > I regret to inform you that yo

Re: How to determine if STDIN has piped data?

2004-03-28 Thread drieux
On Mar 28, 2004, at 5:01 PM, Keith P. Boruff wrote: [..] In other words, how do I get this code: while() { print $_ . "\n"; } not to even loop at all if it has to wait for a human being to enter data? [..] actually the simplest trick would be say: use IO::Handle; my $io = new

Re: interpolated strings

2004-03-28 Thread John W. Krahn
Bryan Harris wrote: > > Is there a way to interpolate strings that the user enters? > > I'm writing a filter (pipe-cat = pat) that lets you add text to the front or > end of some piped data: > > echo "2" | pat "1" - "3\n" > > The "-" represents the piped data, so the above should print: > > %

Re: How to determine if STDIN has piped data?

2004-03-28 Thread Smoot Carl-Mitchell
On Sun, 28 Mar 2004 20:01:18 -0500 "Keith P. Boruff" <[EMAIL PROTECTED]> wrote: > What I'm trying to do though is to allow the script to read data > that's piped in but quit if there is none. > > In other words, how do I get this code: > > while() > { > print $_ . "\n"; > } You can use the

Re: Find User Apache is running as

2004-03-28 Thread WC -Sx- Jones
JupiterHost.Net wrote: Hello List! I was trying to figure out how to see the user the script/webserver is running as. (Like Apache is 'nobody' or the owner 'foomonkey' perhaps with SuExec enabled) ps -ef |grep -i httpd And, where ever your apache server logs are; do - grep -i suexec error*log

How to determine if STDIN has piped data?

2004-03-28 Thread Keith P. Boruff
Hey all, I've determined that if I pipe info into a perl script, it's read from the STDIN file handle. Easy enough. No problem there. I've also determined that if I pipe nothing to this script, it waits for me type something on the keyboard. Again, easy enough. What I'm trying to do though is

Re: Find User Apache is running as

2004-03-28 Thread Andrew Gaffney
JupiterHost.Net wrote: Hello List! I was trying to figure out how to see the user the script/webserver is running as. (Like Apache is 'nobody' or the owner 'foomonkey' perhaps with SuExec enabled) I looked in %ENV and didn't see it in there. Any ideas? If you're running Linux (might work on ot

Find User Apache is running as

2004-03-28 Thread JupiterHost.Net
Hello List! I was trying to figure out how to see the user the script/webserver is running as. (Like Apache is 'nobody' or the owner 'foomonkey' perhaps with SuExec enabled) I looked in %ENV and didn't see it in there. Any ideas? TIA Lee.M - JupiterHost.Net -- To unsubscribe, e-mail: [EMAIL

Re: warn ?!

2004-03-28 Thread WC -Sx- Jones
my $ns = dualvar 42, 'The Answer to Life, the Universe, and Everything'; printf("as number = '%d', as string = '%s'\n", $ns, $ns); Wow, learnt something new :) use Scalar::Util "dualvar"; my $que = dualvar 54, 'What do you get when you multiply 6 by 9'; printf("\nas number = '%d', as string = '

Re: Process control from LAN master computer

2004-03-28 Thread drieux
On Mar 24, 2004, at 8:43 AM, Peterson, Darren - Contractor.Westar wrote: [..] I tried Proc::Background so my script wouldn't wait on the invoked task as with the Perl system command. Actually, I've found that ssh isn't what I need since the invoked task displays on the local, and not remote, ma

Re: warn ?!

2004-03-28 Thread Paul Johnson
On Sun, Mar 28, 2004 at 09:41:09AM -0500, Randy W. Sims wrote: > On 3/27/2004 9:15 PM, R. Joseph Newton wrote: > > >What is intriguing to me in this is that an overloaded operator > >wouuld be attched to a variable. this sounds like it gets into > >prtions of Perl that I've never really delved in

Re: NOT matching e-mail addresses

2004-03-28 Thread WC -Sx- Jones
In the venue of answering my own posts - WC -Sx- Jones wrote: That should be: /\<(?:[!gjyz]\w*(?!\@).*|k\w{3,})\>/ After more tests I ended up with: /\<(?!\!doctype)(?!.*@)(?:[!gjyz].*|k\w{3,})\>/ Thx to Tom and Nathan's excellent book: The Perl Cookbook pg 201. ISBN: 1-56592-243-3 $39.95 USD -

Re: date math

2004-03-28 Thread Andrew Gaffney
R. Joseph Newton wrote: Andrew Gaffney wrote: My code ended up looking like: use strict; use warnings; This code is running under mod_perl, so I think both of those are already being used. use constant PAY_PERIOD_DAYS => 14; Good idea. I never use constants. My code makes sense to me, but few oth

Re: interpolated strings

2004-03-28 Thread John McKown
On Sun, 28 Mar 2004, Bryan Harris wrote: > > > Is there a way to interpolate strings that the user enters? > > I'm writing a filter (pipe-cat = pat) that lets you add text to the front or > end of some piped data: > > echo "2" | pat "1" - "3\n" > > The "-" represents the piped data, so the ab

Re: NOT matching e-mail addresses

2004-03-28 Thread WC -Sx- Jones
Correction (minor) - WC -Sx- Jones wrote: /<(?:[!gjyz]\w*(?!\@).*|k\w{3,})\>/ That should be: /\<(?:[!gjyz]\w*(?!\@).*|k\w{3,})\>/ And yes, I know it doesn't work as I would have hoped... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: date math

2004-03-28 Thread R. Joseph Newton
Andrew Gaffney wrote: > > My code ended up looking like: use strict; use warnings; use constant PAY_PERIOD_DAYS => 14; > > > my @payperiods; Underscores are both permissible and advisable in variable names: my @pay_periods; > > my @finalpayperiods; > my $lastperiodend = Date::Simple->new('2004

NOT matching e-mail addresses

2004-03-28 Thread WC -Sx- Jones
I am working on a Postfix server which uses PCRE to perform certain checks on both the headers and bodies of the e-mails which travels thru the system. I have this version thus far for a particular check: /<(?:[!gjyz]\w*(?!\@).*|k\w{3,})\>/ (I don't want to match e-mail addresses in the form of -

Re: warn ?!

2004-03-28 Thread R. Joseph Newton
"Randy W. Sims" wrote: > #!/usr/bin/perl > > package NumStr; This makes sense to me. As a package, it makes sense to have overloaded operations. This is why I was asking if the value was really stored as a number. > use strict; > ... > printf("as number = '%d', as string = '%s'\n", $ns, $ns);

interpolated strings

2004-03-28 Thread Bryan Harris
Is there a way to interpolate strings that the user enters? I'm writing a filter (pipe-cat = pat) that lets you add text to the front or end of some piped data: echo "2" | pat "1" - "3\n" The "-" represents the piped data, so the above should print: % echo "2" | pat "1\n" - "3\n" 1 2 3 % But

Re: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-28 Thread WC -Sx- Jones
Randy W. Sims wrote: There have been a lot of corrections, but I have seen very few messages that I would consider flames. Don't take it too personally. I dont :) The really nasty ones were off list. But like I stated I'm a big guy and can handle it. Once the problem is presented the whole commu

Re: date math

2004-03-28 Thread Andrew Gaffney
Chris Charley wrote: Hello Andrew I've enclosed a text file that demonstrates Date::Simple. HTH Chris - Original Message - From: "Andrew Gaffney" <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: "beginners" <[EMAIL PROTECTED]> Sent: Saturday, March 27, 2004 7:52 PM Subject: date math

Re: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-28 Thread Randy W. Sims
On 3/28/2004 11:29 AM, WC -Sx- Jones wrote: Peter Scott wrote: In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Wc -Sx- Jones) writes: This edition I will show you how to declare variables WITHOUT using *my* $var everywhere... [snip dangerous advice] This is reprehensible. #! /usr/bin/p

Re: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-28 Thread WC -Sx- Jones
Peter Scott wrote: In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Wc -Sx- Jones) writes: This edition I will show you how to declare variables WITHOUT using *my* $var everywhere... [snip dangerous advice] This is reprehensible. #! /usr/bin/perl eval 'exec perl -S $0 "$@"' if 0; use strict;

Re: warn ?!

2004-03-28 Thread Randy W. Sims
On 3/27/2004 9:15 PM, R. Joseph Newton wrote: Cool. Somehow, though It seems {6 * 1 == 12 / 2}-ish. By the time the variable is effectively accessed, the text is there. I never said that it was usefull ;-) Greetings! E:\d_drive\perlStuff>perl open IN, 'some_nonexistent_filename' or print $!; ^Z

Re: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-28 Thread Peter Scott
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Wc -Sx- Jones) writes: >HOW-TO of the Month Club (end Of MARCH Edition) > >(Even though many of you *flamed* me - _I' bck_ :) > >This edition I will show you how to declare variables >WITHOUT using *my* $var everywhere... [snip dangerous

Re: warn ?!

2004-03-28 Thread Randy W. Sims
On 3/27/2004 10:12 PM, John W. Krahn wrote: "Randy W. Sims" wrote: James Edward Gray II wrote: Fact: This has nothing to do with ANY variables, it is the way warn() is designed. Trivia: Did you know that $! does NOT contain an error string. It contains the error *number*. The only reason you s