How is this doing what I want it too?

2001-06-29 Thread Toni Janz
I am just learning perl and have been doing some of the exercises in the llama book. I was doing page exercise one from page 57 and I was pulling out my hair as to why it was not working and then I did something experimental and got it to work. But to be honest I have no idea why it works. I wil

Re: Code Review Needed!

2001-06-29 Thread dave hoover
At the suggestion of a few people I've converted the program into text files to make things easier for reviewers. Here are the four files: http://www.redsquirreldesign.com/soapbox/Soapbox.pm.txt http://www.redsquirreldesign.com/soapbox/main.txt http://www.redsquirreldesign.com/soapbox/soap.txt h

Re: RegExp

2001-06-29 Thread Jeff 'japhy' Pinyan
On Jun 29, Timothy said: >I'm sure this is a really easy question but here goes. I'd like to replace >each leading blank of a string with   I have currently: > > $strLine =~ s/^\s+/ /g; That /g is pointless there... >I can see that this will simply take all leading blanks and repl

RegExp

2001-06-29 Thread Timothy
I'm sure this is a really easy question but here goes. I'd like to replace each leading blank of a string with   I have currently: $strLine =~ s/^\s+/ /g; I can see that this will simply take all leading blanks and replace them with one   but how do I get *each* leading blank to

Re: [OT:style]deleting a line with a particular string.

2001-06-29 Thread Michael Fowler
On Fri, Jun 29, 2001 at 10:21:31AM +1000, Sam Lander wrote: > I wanted to do this just today. Although, I want to tidy up the resulting > line a bit by deleting everything before a colon, so I tried this: >perl -ne "/string/ && print s/.*://" file > I was surprised that I got this: >1

Re: Simple Split Question

2001-06-29 Thread Abdulaziz Ghuloum
Hello, You can do it in one line like: my $str = 'DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None"'; %hash = $str =~ /DimView\s+(\d+)\s+("[^"]*")\s+/g; print "$_ $hash{$_}\n" for keys %hash; Aziz,,, On Thu, 28 Jun 2001 16:32:28 -0400, Seitz, Scott said: > I'm having

RE: Simple Split Question

2001-06-29 Thread Stephen Nelson
I don't think you want to use split.. at least I wouldn't. I would do: my %foo = (); my $line = 'DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None"'; $foo{$1} = $2 while $line =~ m/DimView (\d) "([^"]+)"/g; That gives me %foo as (according to Data::Dumper): {

RE: Beginning

2001-06-29 Thread Stout, Joel R
One more note for beginners (like myself) buying Perl books - The Perl CD Bookshelf is $71.96 (USD) at Amazon and $47.97 (USD) at FatBrain.com. Shop around. (I have any no financial ties to FatBrain just looking to help the end user) -Original Message- From: Stout, Joel R [mailto:[

Re: Problem with hash value

2001-06-29 Thread Michael Fowler
On Sat, Jun 30, 2001 at 12:28:11AM +0200, M.W. Koskamp wrote: > From: Wang, Lanbo <[EMAIL PROTECTED]> > > Hi Members, > > #!/usr/local/bin/perl > > > > sub card{ > > > > my %card_map; > > my ($num)=@_; > > @card_map{1..9}= qw(one two three four five six seven eight nine); > > You are putting

Re: Problem with hash value

2001-06-29 Thread Michael Fowler
On Fri, Jun 29, 2001 at 06:04:33PM -0400, Wang, Lanbo wrote: > #!/usr/local/bin/perl This is your first mistake. You forgot -w and use strict; always use both when debugging code. It wouldn't have helped you here, but I guarantee you it will in the future. So: #!/usr/local/bin/perl -w us

RE: Beginning

2001-06-29 Thread Stout, Joel R
Learning languages by reverse engineering does not work for most people. Try Learning Perl and the Perl Cookbook for starters. Also go to http://learn.perl.org/ Cheers, Joel -Original Message- From: Jerry Preston [mailto:[EMAIL PROTECTED]] Sent: Friday, June 29, 2001 12:16 PM To: Sco

Re: Problem with hash value

2001-06-29 Thread Paul
--- Me <[EMAIL PROTECTED]> wrote: > > > my ($num) = @_; > > > > > > puts the length of @_ in $num. I don't think so? The parens should give $num a list context. It should have the first value in @_. Right? __ Do You Yahoo!? Get personaliz

Re: Problem with hash value

2001-06-29 Thread Abdulaziz Ghuloum
> while (<>) { >chomp; >print "card of $_ is:" &card($_), "\n"; > } ^ Add a comma (,) or a string cat (.) between the quote and the function :-) Aziz,,, On Fri, 29 Jun 2001 18:04:33 -0400, Wang, Lanbo said: > Hi Members, > > It seemed that a value

Re: Problem with hash value

2001-06-29 Thread Me
> > I would think you are always getting 'one', right? > > > > That's because: > > > > my ($num) = @_; > > > > puts the length of @_ in $num. Sorry, I'm being an idiot. You were doing the right thing. > $ more number > 3 > 5 > $test10.pl < number > ``rd > bard Hmm. > print "card of $

Re: Optional Variables

2001-06-29 Thread Brett W. McCoy
On Fri, 29 Jun 2001, M.W. Koskamp wrote: > > my $option = @ARGV ? shift : ; > > Above option only works for 1 parameter tho (and commandline arguments). > For function calls i like to use 'named parameters' by accepting a hash of > options. Well, yeah, but the topic *was* command-line arguments

Re: Simple Split Question

2001-06-29 Thread Paul
--- "Seitz, Scott" <[EMAIL PROTECTED]> wrote: > I'm having trouble with what I think is a very simple split question. > > I've got a line of text something like: > > DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None" > > I want a hash with (1, "All", 2, "Some", 3, "Most", 4, "N

Re: Problem with hash value

2001-06-29 Thread Me
> > sub card{ > > > > my %card_map; > > my ($num)=@_; > > @card_map{1..9}= qw(one two three four five six seven eight nine); > > You are putting the numbers 0..9 in the array @card_map here, not in the > hash %cardmap. No he isn't. (He's using a hash slice, which is fine.) I would think you

Re: Simple Split Question

2001-06-29 Thread Brett W. McCoy
On Thu, 28 Jun 2001, Seitz, Scott wrote: > I'm having trouble with what I think is a very simple split question. > > I've got a line of text something like: > > DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None" > > I want a hash with (1, "All", 2, "Some", 3, "Most", 4, "None") >

Re: Simple Split Question

2001-06-29 Thread Ken
Well, the reason it's not working is that there is only one Dimview between pairs, for a hash you need seperators between all elements. Here's a way to do it, although I bet others can come up with a quicker/more efficient way: my (%hash); $_ = 'DimView 1 "All" DimView 2 "Some" DimView 3 "Most"

Re: Problem with hash value

2001-06-29 Thread M.W. Koskamp
- Original Message - From: Wang, Lanbo <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, June 30, 2001 12:04 AM Subject: Problem with hash value > Hi Members, > > It seemed that a value was incorrectly retrieved from the hash list in the > following small Perl script. . > > #!

RE: [OT:style]deleting a line with a particular string.

2001-06-29 Thread Peter Scott
At 10:21 AM 6/29/01 +1000, Sam Lander wrote: > >> At a shell prompt / command line, enter: > >> > >> perl -ne '/string/ or print' file > >> > >> where string is the string and file is the file. > > > >I prefer 'print unless /string/'. > >As if it matters. ;o] > >I wanted to do this just today.

Problem with hash value

2001-06-29 Thread Wang, Lanbo
Hi Members, It seemed that a value was incorrectly retrieved from the hash list in the following small Perl script. . #!/usr/local/bin/perl sub card{ my %card_map; my ($num)=@_; @card_map{1..9}= qw(one two three four five six seven eight nine); if ($card_map{$num}) { $card_map{$num

RE: [OT:style]deleting a line with a particular string.

2001-06-29 Thread Sam Lander
>> At a shell prompt / command line, enter: >> >> perl -ne '/string/ or print' file >> >> where string is the string and file is the file. > >I prefer 'print unless /string/'. >As if it matters. ;o] I wanted to do this just today. Although, I want to tidy up the resulting line a bit by de

Simple Split Question

2001-06-29 Thread Seitz, Scott
I'm having trouble with what I think is a very simple split question. I've got a line of text something like: DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None" I want a hash with (1, "All", 2, "Some", 3, "Most", 4, "None") I'm spitting on /DimView/, but I can't get the syntax

Timeofday jumping

2001-06-29 Thread paul
Hi, has anyone used the timeofday function in Time::Hires on Win32? The reason I ask is that I am repeatedly getting and printing the microseconds: @thetime = timeofday; print $thetime[1]; The microseconds only have a millisecond componant, so they are of the range 00 to 999000 (the

RE: Web Page Interaction...

2001-06-29 Thread Stephen Neu
:also, there's a chapter on Web Automation in the :Perl Cookbook. That's true... _The Perl Cookbook_, chapter 20. Excellent resource. If you don't have it, I would recommend getting it. 20.1 - Fetching a URL from a Perl script 20.2 - Automating Form Submission 2

Re: Optional Variables

2001-06-29 Thread M.W. Koskamp
> > my $option = defined $ARGV[0] ? $ARGV[0] : "default"; > > Didn't we already go through all of this a few hours ago? Randal (of > course) came up with the most succint solution: > > my $option = @ARGV ? shift : ; > Sorry for trying to be helpful. Mailing list arent represented in threads in ou

Re: Open a HTM Page

2001-06-29 Thread Ryan Gralinski
you could just do print `cat file.html` if (condition); On Fri, 29 Jun 2001, Mike Truong wrote: > Is there any way to open a HTM page from the Perl program? When the script runs, it >opens the page after some conditions were checked. > > Thanks in advance for you help. >

Re: Web Page Interaction...

2001-06-29 Thread Prachi Shroff
Hi, I have been something similar lately to what u want to do. Browsing thru webpages.filing out formsfollowing links on a page etc. LWP::UserAgent and HTTP::Request can be used to do that. I would suggest you take a look at "Web Client Programming with Perl by Clinton Wong - QReill

Re: Optional Variables

2001-06-29 Thread Brett W. McCoy
On Fri, 29 Jun 2001, M.W. Koskamp wrote: > > > my $option = $ARGV[0] || 1; > > > > And what if $ARGV[0] equal to 0 ? Ops .. > > > > Remember what evaluates to FALSE : > > * "0" > > * 0 > > * empty string > > * undef > > my $option = defined $ARGV[0] ? $ARGV[0] : "default"; Didn't we already go t

Re: Optional Variables

2001-06-29 Thread M.W. Koskamp
- Original Message - From: Evgeny Goldin (aka Genie) <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: Brett W. McCoy <[EMAIL PROTECTED]> Sent: Friday, June 29, 2001 11:34 PM Subject: Re: Optional Variables > > > my $option = $ARGV[0] || 1; > > And what if $ARGV[0] equal to 0 ? Ops ..

RE: Web Page Interaction...

2001-06-29 Thread Stephen Neu
Craig, you are wanting to write a script that goes out and surfs the internet like a user would, right? Or are you wanting to actually write html documents with your script? If you are wanting the former, LWP is the best way to go, in my opinion. HTTP::Request::Common provides a

Re: Web Page Interaction...

2001-06-29 Thread Lara J. Fabans
CGI.pm can also create forms. And to have the pages pre-filled in, just use $q->textfield('my value for this particular element') set and it will be prefilled in. (all of the rest of the form elements would use something like: $q->checkbox_group(-values=>['Shampoo', 'Toothbrush', 'Potato Salad']

Re: Optional Variables

2001-06-29 Thread Evgeny Goldin (aka Genie)
> my $option = $ARGV[0] || 1; And what if $ARGV[0] equal to 0 ? Ops .. Remember what evaluates to FALSE : * "0" * 0 * empty string * undef

Re: Web Page Interaction...

2001-06-29 Thread Craig S Monroe
I took a look at the cgi.pm. It looks as though it deals with receiving variables from forms, writing dynamic pages, etc. Is this your impression? What I am looking to do, is fill out pages as if a human(or something close) were doing it. For example, visit http://www.yoursite.com click on a pa

Re: Web Page Interaction...

2001-06-29 Thread Craig S Monroe
I took a look at the cgi.pm. It looks as though it deals with receiving variables from forms, writing dynamic pages, etc. Is this your impression? What I am looking to do, is fill out pages as if a human(or something close) were doing it. For example, visit http://www.yoursite.com click on a pa

Re[OT]loop counting

2001-06-29 Thread Paul
--- Bob Mangold <[EMAIL PROTECTED]> wrote: > Within the loop, some other programs are executed and occasionally it > may take a few minutes to complete everything and then continue. So > I'm just throwing a little counter to STDOUT so I can monitor the > progress, to ensure it doesn't get hung up

Formatting

2001-06-29 Thread Kim Green
What would cause this format for the output file to result in the error message "Format not terminated at end of line" : format OUTPUTFORMAT = @<<<,@< ,@<<< ,@< $servicename,$filename ,$servi

Re: loop counting

2001-06-29 Thread Bob Mangold
Paul, Within the loop, some other programs are executed and occasionally it may take a few minutes to complete everything and then continue. So I'm just throwing a little counter to STDOUT so I can monitor the progress, to ensure it doesn't get hung up somewhere. I knew of all the different ways

RE: Idea.. OCR in perl?

2001-06-29 Thread RTaylor
Pierre, I'm working on such solution right now. Hit a dead-end with PerlMagick on Win32, so this weekend I'll start over on Linux. Here's what I found: Manipulate images (i.e.,crop) http://www.eecs.umich.edu/~addi/perl/Imager/ ImageMagick - cut and manipulate images http:

Re: loop counting

2001-06-29 Thread Paul
--- Bob Mangold <[EMAIL PROTECTED]> wrote: > Is there a perl variable that automatically counts loop iterations. > Such that I don't have to use '$count': > > foreach (@array){ > $count++; > ..whatever.. > } Lot's of people with suggestions, but I have a question -- what are you using $coun

Re[OT]loop counting

2001-06-29 Thread Paul
--- Michael Fowler <[EMAIL PROTECTED]> wrote: > > for my $i (0 .. $#foo) { > > my $element = $foo[$i]; > > # ... > > } > > or > > for (my $i = 0; $i < @foo; $i++) { > ... > } > > for (;;) isn't a bad word. :) lol -- depends on where you were raised. ;o] _

RE: loop counting

2001-06-29 Thread Kipp, James
if your looping thru the elements of an array you can always just grab the # of elements: $elem = scalar(@array); > > Is there a perl variable that automatically counts loop > iterations. Such that I > > don't have to use '$count': > > > > foreach (@array){ > > $count++; > > ..whatever..

Re: Beginning

2001-06-29 Thread Jerry Preston
Scott, I knew nothing when I started. I found a copy of a program and dug out every word until it I understood it and the flow from top to bottom. I have found this a good way to learn any language. Jerry Scott Dortch wrote: > > Where should I begin? I would like to get to know perl but

Re: loop counting

2001-06-29 Thread Michael Fowler
On Fri, Jun 29, 2001 at 02:58:20PM -0400, Jeff 'japhy' Pinyan wrote: > No there is not. Either do: > > my $i = 0; > for (@foo) { > # ... > } > continue { $i++ } > > or do: > > for my $i (0 .. $#foo) { > my $element = $foo[$i]; > # ... > } or for (my $i = 0; $i < @

Re: loop counting

2001-06-29 Thread Brett W. McCoy
On Fri, 29 Jun 2001, Bob Mangold wrote: > Is there a perl variable that automatically counts loop iterations. Such that I > don't have to use '$count': > > foreach (@array){ > $count++; > ..whatever.. > } You can always do, if you need a loop variable: foreach my $i (0..$#array) {

Re: loop counting

2001-06-29 Thread Jeff 'japhy' Pinyan
On Jun 29, Bob Mangold said: >Is there a perl variable that automatically counts loop iterations. Such that I >don't have to use '$count': No there is not. Either do: my $i = 0; for (@foo) { # ... } continue { $i++ } or do: for my $i (0 .. $#foo) { my $element = $foo[$i];

loop counting

2001-06-29 Thread Bob Mangold
Is there a perl variable that automatically counts loop iterations. Such that I don't have to use '$count': foreach (@array){ $count++; ..whatever.. } ? Thanks, Bob __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http:

Re: Open a HTM Page

2001-06-29 Thread Mike Truong
Hi Brett, The HTML page is a help book content. It contains other page links. The other page links contain other pages. It was designed to run from /help/ directory. The content page printed with your method contains other link pages in different folder, when I click the other page link , the

Re: module install

2001-06-29 Thread Elaine -HFB- Ashton
Hal Wigoda [[EMAIL PROTECTED]] quoth: *>I'm trying to install a module as root *>from cpan *>and it is looking for my ncftp program *>and it is not found. *> *>What do i do now?? *> *>I'm using mandrake 7.2 on my linux server. Configure CPAN.pm to use ftp elaine@chaos /home/chaos/elaine> perl -M

Re: CSS in Perl

2001-06-29 Thread Richard
Hi there Scuse any netiquette errors - I'm new to mailing lists so I'm a bit shaky on the rules. Use an external style sheet to hold your css information then all you need to do is add the following line to your perl code in the head tags in the html output to put this into a perl context pr

RE: Running PERL as root

2001-06-29 Thread Farouk Khawaja
Also, the fact that this system is a protected system means that there IS something worth protecting... stealing. Further reason not to run any cgi as root. Bill Pierson <[EMAIL PROTECTED]> wrote: > Thanks for your replies. Actually, I'd like to be able to modify system > config file

RE: Running PERL as root

2001-06-29 Thread Farouk Khawaja
Here's a suggestion. When you receive data from a form, the cgi that parses this data should run as an ordinary user. The process will act as a buffer, cleaning data, looking for invalid values, and other oddities. Then when all concerns are satisfied, the data is written to disk to be p

RE: System calls in perl for "ps" and "netstat" - lessexpensive way?

2001-06-29 Thread Kipp, James
> > sorry about the terse code snippet no problem, it is good code :-) > > Basically, I have an SSH tunnel that is controlled by another > process and I want to tell when that ssh tunnel is closed. Have you or R U looking into or using IO::Socket::SSL ?? There might be a method in there

Re: Web Page Interaction...

2001-06-29 Thread Aaron Craig
CGI.pm is the most advanced module around for dealing with forms. At 13:44 29.06.2001 -0400, Craig S Monroe wrote: >All, > >I have done some searching, looking for a module for interacting with web >pages. >The only module, that appears to be related is LWP. I read through those >docs, >and, I

Re: module install

2001-06-29 Thread Adam Turoff
On Fri, Jun 29, 2001 at 12:10:04PM -0500, Hal Wigoda wrote: > I'm trying to install a module as root > from cpan > and it is looking for my ncftp program > and it is not found. > > What do i do now?? > > I'm using mandrake 7.2 on my linux server. You can install ncftp from your mandrake CDs, or

Re: Beginning

2001-06-29 Thread Craig S Monroe
Scott, I have read a couple of books. It depends on your background. I have a highly technical background, but knew zero about programming. I started with Perl for dummies, and then purchased Learning Perl. I found that a good transition for me, but you may be able to jump right. Craig [EMAI

Re: Open a HTM Page

2001-06-29 Thread Chas Owens
On 29 Jun 2001 13:01:08 -0400, Mike Truong wrote: > Is there any way to open a HTM page from the Perl program? > When the script runs, it opens the page after some conditions > were checked. > > Thanks in advance for you help. By "open" do you mean open in some other application or open for re

Re: Inheritance of package global variables

2001-06-29 Thread Michael Fowler
On Fri, Jun 29, 2001 at 12:14:23AM -0400, Richard J. Barbalace wrote: > I don't really want to export the variables; I'm not modifying them in > the parent package, just copying and expanding them in the inheriting > package. Well then, you are copying and modifying as simply as it can be done.

Beginning

2001-06-29 Thread Scott Dortch
Where should I begin? I would like to get to know perl but do not know where to start. Are there recommended books/websites etc. for in depth documentation? Any suggestions would be greatly appreciated. Scott Dortch Director of Operations The Order Fulfillment Group

Web Page Interaction...

2001-06-29 Thread Craig S Monroe
All, I have done some searching, looking for a module for interacting with web pages. The only module, that appears to be related is LWP. I read through those docs, and, I am a novice, so they are a little confusing. Does anyone know of a good tutorial, resource for an explanation on how to in

Re: module install

2001-06-29 Thread Farouk Khawaja
You're probably using $ perl -MCPAN -e shell > install If you're not, you should. Anyway, this method tries 3 different ways to download a module, lwp, Net::Ftp and ncftp. Any one of these should work if you have them installed. If not, install them. Hal Wigoda <[EMAIL PRO

Re: module install

2001-06-29 Thread Michael Fowler
On Fri, Jun 29, 2001 at 11:31:28AM -0500, Hal Wigoda wrote: > When you install a perl module from CPAN > should you do it as root??? Often the answer you'll see in response to this question is "yes", as evidenced by the two answers I see to your question already. The real answer is "it depends"

RE: System calls in perl for "ps" and "netstat" - less expensive way?

2001-06-29 Thread Matt Weatherford
sorry about the terse code snippet Basically, I have an SSH tunnel that is controlled by another process and I want to tell when that ssh tunnel is closed. (I have both the PID for this SSH tunnel process and the port # of the local side of the tunnel) I am checking for closed tunnels 2 w

Re: Open a HTM Page

2001-06-29 Thread Brett W. McCoy
On Fri, 29 Jun 2001, Brett W. McCoy wrote: > > Is there any way to open a HTM page from the Perl program? When the > > script runs, it opens the page after some conditions were checked. > > open(HTML, " > while() { print } > > close(HTML) ^^^ Oops, left off the final ; ! -- Brett

Re: background processing (again?)

2001-06-29 Thread Karthik Krishnamurthy
dunno about the select module, but a normal call to select will block. that is why in my other mail i had given you the option of blocking on select in another thread/process /kk On Fri, Jun 29, 2001 at 12:36:20PM -0400, Ronald J. Yacketta wrote: > Maybe I just don't understand.. > but wont there

Re: short filehandle question

2001-06-29 Thread Michael Fowler
On Fri, Jun 29, 2001 at 02:28:50PM +0200, Ela Jarecka wrote: > Hi, > Executing my program with -w option I get the following warning: > 'Value of construct can be "0"; test with defined() at readData > line 65535.' > > Surely I do not have 65535 lines in my program, but I suspect this one: > >

Re: Open a HTM Page

2001-06-29 Thread Brett W. McCoy
On Fri, 29 Jun 2001, Mike Truong wrote: > Is there any way to open a HTM page from the Perl program? When the > script runs, it opens the page after some conditions were checked. open(HTML, ") { print } close(HTML) -- Brett http://www.chapelperilous.net/btfw

Re: FW: Optional Variables

2001-06-29 Thread Chas Owens
On 29 Jun 2001 09:00:50 -0700, Randal L. Schwartz wrote: > > "Chas" == Chas Owens <[EMAIL PROTECTED]> writes: > > Chas> my $query = " > Chas> SELECT a.filename, a.size, a.date, b.owner, c.group > Chas> FROM filesystem a, outer owner b, outer group c > Chas>

module install

2001-06-29 Thread Hal Wigoda
I'm trying to install a module as root from cpan and it is looking for my ncftp program and it is not found. What do i do now?? I'm using mandrake 7.2 on my linux server.

Ugly Code..How to beautify or at least clarify

2001-06-29 Thread Gary Luther
I have a Perl program that loads a bunch of report names in a hash (%TITLES). I then read through files in a directory trying to match the report name of the file to the report name in the hash. When I get a hit, I use the reference of the hash hit to pick up an array that tells me on what line o

Open a HTM Page

2001-06-29 Thread Mike Truong
Is there any way to open a HTM page from the Perl program? When the script runs, it opens the page after some conditions were checked. Thanks in advance for you help.

RE: System calls in perl for "ps" and "netstat" - lessexpensive way?

2001-06-29 Thread Kipp, James
Hi Matt Can you describe a little bit what U are trying to do or include more of the code. Depending on what U are trying to do, there may be less expensive alternatives Thanks Jim > > > > > From PERL, I have been doing some system calls like this: > (see * lines) > > > * my $procentry=`

Re: module install

2001-06-29 Thread Brett W. McCoy
On Fri, 29 Jun 2001, Hal Wigoda wrote: > When you install a perl module from CPAN > should you do it as root??? Yes. -- Brett http://www.chapelperilous.net/btfwk/ "We can't schedule an or

Re: module install

2001-06-29 Thread Adam Turoff
On Fri, Jun 29, 2001 at 11:31:28AM -0500, Hal Wigoda wrote: > > When you install a perl module from CPAN > should you do it as root??? That's the easiest way to do it. Another possibility is to install somewhere else on the file system, not in the system site_perl directory. That other direct

RE: background processing (again?)

2001-06-29 Thread Ronald J. Yacketta
Maybe I just don't understand.. but wont there _always_ be data to read from netstat? to me, it seems as tho the loop _not_ work as intended, it would always pass the can_read and read data from netstat and never parse the other code? Regards, Ron > -Original Message- > From: David M. L

System calls in perl for "ps" and "netstat" - less expensive way?

2001-06-29 Thread Matt Weatherford
>From PERL, I have been doing some system calls like this: (see * lines) * my $procentry=`ps -ef | grep -v grep | grep $self->{pid} `; chomp $procentry; $self->debug(1, "Procentry: [$procentry]"); if ($procentry =~ /\/ ) { $self->debug(1, " <--- closed ssh tunnel. Tunnel proc

module install

2001-06-29 Thread Hal Wigoda
When you install a perl module from CPAN should you do it as root???

Re: data matching

2001-06-29 Thread Michael Fowler
On Fri, Jun 29, 2001 at 10:15:54AM -0400, F.H wrote: > CITY:while (my $line = ){ > > my @line = split /\s*,\s*/, $line; > my $city = $line[3]; > > foreach my $city (keys %state) { > foreach my $street (@{ $state{$city} } ){ > if (

FW: Win32 fork(), parent then child

2001-06-29 Thread Robin Lavallee (LMC)
> Hi, > > I tested with a while loop. They do change after > a while. This probably has to do with how the > output is done on the same terminal in windows > and how it handle timesharing. > > Fork does work correctly with my version > of ActivePerl on Win32... > > -Robin > > -Original M

RE: Invalid switch message

2001-06-29 Thread John Edwards
You could do this $returned = `spam -momittag -c $tooldir/nsgmls.cat $dtddir/$.dtd $file`; $returned will now contain whatever your program would have printed to the console. You can work with the data in a perl script, or just save it out using perl open OUT, ">$newfile" or die "Can't create

Invalid switch message

2001-06-29 Thread Keith Haynes
Hi all, I am relatively new to Perl and my background is not programming although I quite enjoy manipulating text using Perl, with this in mind I would appreciate any replies being kept relatively simple, if that's possible. My problem, I am running an exe file within perl and receiving the mes

Re: FW: Optional Variables

2001-06-29 Thread Chas Owens
On 29 Jun 2001 10:46:39 -0400, Kim Green wrote: > > Brett and Chas, > > I did create two file handles and alter my conditional statements, one to > work when there is a variable, and one for when there's no variable. The > first SQL statement should return everything for a given filename; the o

Re: is this a structure of some kind?

2001-06-29 Thread Brett W. McCoy
On Fri, 29 Jun 2001, Humberto Varela wrote: > sorry to ask such a simple question, but i can't find reference to this syntax in a >couple of my Perl reference books (i think it's time i bought the Camel book) > > -- > > > ALL_SESSIONS: foreach $session_dir (@ARGV) { > @studies = `ls

Win32 fork(), parent then child

2001-06-29 Thread Paul Murphy
Hey everyone: Anyone using fork() in Win32 ActivePerl? Consider the following code: use FileHandle; STDOUT->autoflush(1); $kidpid = fork(); print "pid = $$ kidpid = $kidpid\n"; print "pid = $$ kidpid = $kidpid\n"; print "pid = $$ kidpid = $ki

Re: trailing newline

2001-06-29 Thread Nigel G Romeril
This bit of code generates a file with all three types of new line in it open(TESTFILE, "> test.txt") or die "Sorry, cannot open the test file"; binmode(TESTFILE); print TESTFILE "This is a DOS line ending\x0d\x0a"; print TESTFILE "This is a Mac line ending\x0d"; print TESTFILE "This is

Re: AW: short filehandle question

2001-06-29 Thread Paul
--- Jerry Preston <[EMAIL PROTECTED]> wrote: > The * is a typeglob that are still used for passing or storing > filehandles. Using my is to the most frequently used form of > lexically scoped > declaration. You might look at scoped declarations. For most cases, I'd recommend using the FileHan

Re: Modules question

2001-06-29 Thread Nigel G Romeril
On Win32, typing ppm verify at the command prompt will list all the modules installed on your system quit will exit the ppm tool [EMAIL PROTECTED] wrote: > Help with Modules please. > > Is there a option I can run with perl to find out if a particular module is >installed? > > Thanks, > > Anna

FW: Optional Variables

2001-06-29 Thread Kim Green
Brett and Chas, I did create two file handles and alter my conditional statements, one to work when there is a variable, and one for when there's no variable. The first SQL statement should return everything for a given filename; the other should return everything for all filenames that meet th

RE: background processing (again?)

2001-06-29 Thread David M. Lloyd
On Thu, 28 Jun 2001, Ronald J. Yacketta wrote: > I have heard doing it this way will cause grief.. need blocking i/o or > something along that lines. Also, I head that the flow of the program > would _stop_ when reading the data... > > are there any other solutions? You can get around blocking

Re: AW: short filehandle question

2001-06-29 Thread Jerry Preston
Ela, The * is a typeglob that are still used for passing or storing filehandles. Using my is to the most frequently used form of lexically scoped declaration. You might look at scoped declarations. Jerry Ela Jarecka wrote: > > Hi, > It is declared as my $FILEH at the beginning of the file

Re: is this a structure of some kind?

2001-06-29 Thread Chas Owens
Labels are very useful for breaking out of nested loops: LOOP1: while (condition1) { LOOP2 while (condition2) { last LOOP1 if (fatal error); } } On 29 Jun 2001 16:17:54 +0200, Aaron Craig wrote: > ALL_CAPS: > is a label that sets off a blo

Re: help with running -T

2001-06-29 Thread Kevin Meltzer
Hi dave, I assume you have Blah.pm in the same directory as tst? -T removed . (the cwd) from @INC, so it isn't finding it. You can a) put Blah.pm somewhere in @INC, or b) use lib qw(.); You may also want to read the perlsec doc, which explains more about tainting. On Fri, Jun 29, 2001 at 07:21:

RE: is this a structure of some kind?

2001-06-29 Thread John Edwards
You can also use if for inner and outer loops. For example OUTER: foreach(@array1) { INNER: foreach(@array2) { next OUTER if /find this/; } } So for every value in @array1, you are testing each value in @array2. When you find that value in @array2, you stop and mo

Re: is this a structure of some kind <- found it!

2001-06-29 Thread Humberto Varela
i found it. page 104 of Learning Perl, 2nd. sheesh... this is what happens when i'm only 1/2 cup of coffee into the morning. thanks all! -- On Friday, June 29, 2001 09:10, Humberto Varela <[EMAIL PROTECTED]> wrote: >sorry to ask such a simple question, but i can't find reference >to this sy

help with running -T

2001-06-29 Thread dave hoover
Here is an ultra-simple script "tst": --- #!/usr/bin/perl -w use Blah; $b = new Blah; print "foo"; $b->bar(); --- Here is the ultra simple module "Blah.pm": package Blah; sub new { my $pkg = shift; bless {}; $pkg; } sub bar

Re: is this a structure of some kind?

2001-06-29 Thread Aaron Craig
ALL_CAPS: is a label that sets off a block of code. A more obvious use for it would be to emulate the switch structure in C++: SWITCH: { if($var == 1) { do something last SWITCH; # skip the rest of this block }

Re: data matching

2001-06-29 Thread F.H
Michael Fowler <[EMAIL PROTECTED]> wrote: > > You probably shouldn't be using a bare block as a looping construct.  What > is the intent of your code, what do you want it to do if $street eq 'MAIN' > or $street ne 'MAIN'? > Sorry I have not been quite clear about what I want to get: use strict

is this a structure of some kind?

2001-06-29 Thread Humberto Varela
sorry to ask such a simple question, but i can't find reference to this syntax in a couple of my Perl reference books (i think it's time i bought the Camel book) -- ALL_SESSIONS: foreach $session_dir (@ARGV) { @studies = `ls -1 "$session_dir" `; @session_path = split /\//, $ses

Re: Optional Variables

2001-06-29 Thread Randal L. Schwartz
> "Chas" == Chas Owens <[EMAIL PROTECTED]> writes: Chas> In cases where you expect 0 to be a valid value it may be better to use Chas> this construct: Chas> $var = defined($ARGV[0]) ? $ARGV[0] : DEFAULT; I prefer the sensible: $var = @ARGV ? shift : DEFAULT; Why test defined when you know

  1   2   >