RE: Mutliple Regexs within the same block, but seems to be bypassing when I can see the data there

2004-11-24 Thread Charles K. Clarkson
From: Wagner, David --- Senior Programmer Analyst --- WGO <> wrote: : I have been working on thie script to take MVS : JCl/Proc's and bring them together in a single output. I : parsing out the DSN ( data file name ) and then attempting to : determine if input, output or delete. : :

HTML::TokeParser::Simple / get_attr

2004-11-24 Thread Brian Volk
Hi All, I'm trying to only get the text from w/in a certain table in the HTML source. Right now I am getting all the text in the source. Here is my script I made notes in the script. #!/usr/bin/perl -w use HTML::TokeParser::Simple; use LWP::Simple; my $url = " http://www.kcprofes

Sinus and PI in perl

2004-11-24 Thread Bastian Angerstein
Hello, in an excel sheet I use: =SIN((2*PI()/96)*1) =SIN((2*PI()/96)*2) etc... my question is how to get this function in perl? The Results are values (in the example max. 96) on the Y-Axes of the Sinuswave. BTW: I want to replace the 96 (measuringpoints) and the multiplication value with varia

Subroutine call

2004-11-24 Thread TapasranjanMohapatra
Hi All, I have a querry if the following can be possible. Suppose I have many sub routines in a module abc.pm package abc; sub zzzq { } sub zzze { } sub zzzr { } Now I use this module in another script. I want to call the sub routines, as suggested by the argument passed to the script. i.e.

Log()

2004-11-24 Thread ds10025
Hi I need to learn Perl. I've a script that need to debug. I've read that you can use log() in to trace the problem. How best to use it? Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Log()

2004-11-24 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: I need to learn Perl. http://learn.perl.org/ I've a script that need to debug. I've read that you can use log() in to trace the problem. How best to use it? I don't know what log() is. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e

Re: Log()

2004-11-24 Thread Prasanna Kothari
You can use "perl -d

Re: Log()

2004-11-24 Thread ds10025
That could explain why I couldn't found any information. My understanding is that log() is a log() statement that logged progress of the script to a error log file. Dan At 10:51 24/11/2004, Gunnar Hjalmarsson wrote: [EMAIL PROTECTED] wrote: I need to learn Perl. http://learn.perl.org/ I've a scri

Re: Sinus and PI in perl

2004-11-24 Thread Owen Cook
-- On Wed, 24 Nov 2004, Bastian Angerstein wrote: > > in an excel sheet I use: > =SIN((2*PI()/96)*1) > =SIN((2*PI()/96)*2) etc... > > my question is how to get this function in perl? > > The Results are values (in the example max. 96) on the Y-Axes of the > Sinuswave. > > BTW: > I want to

RE: HTML::TokeParser::Simple / get_attr

2004-11-24 Thread Charles K. Clarkson
Brian Volk <[EMAIL PROTECTED]> wrote: : Hi All, : : I'm trying to only get the text from w/in a certain table in : the HTML source. Right now I am getting all the text in the : source. : Here is my script I made notes in the script. : : #!/usr/bin/perl -w Always use strict. use strict

RE: Subroutine call

2004-11-24 Thread Charles K. Clarkson
TapasranjanMohapatra <[EMAIL PROTECTED]> wrote: : Suppose I have many sub routines in a module abc.pm : : package abc; : : sub zzzq : { : } : : sub zzze : { : } : sub zzzr : { : } : : Now I use this module in another script. I want to call the : sub routines, as suggested by the argument passe

Re: Using regular expressions

2004-11-24 Thread FlashMX
Could you give an example of using grep on a array to do a replace? On Wed, 24 Nov 2004 10:05:39 +0530, Prasanna Kothari wrote: >Hi, >Replace >$output = ~ s/AAA*?BBBt/AAA 111 *?222 BBB/g; >with >my $output =~ s/AAA*?BBBt/AAA 111 *?222 BBB/g; > >You can use "perl -c " which will show you such ty

Re: Using regular expressions

2004-11-24 Thread FlashMX
To be able to do a grep on a file via a perl script do you have to read the whole file in before performing the search and replace? I've been hearing that reading the whole file in takes up memory and if multiple users are running the script then you better have alot of swap and memory. Is thi

Re: Using regular expressions

2004-11-24 Thread Michael S. E. Kraus
G'day... On Wed, 2004-11-24 at 23:10, FlashMX wrote: > To be able to do a grep on a file via a perl script do you have to read the > whole file in before performing the search and replace? I've been hearing > that reading the whole file in takes up > memory and if multiple users are running the

Re: Using regular expressions

2004-11-24 Thread Michael S. E. Kraus
G'day... On Wed, 2004-11-24 at 23:00, FlashMX wrote: > Could you give an example of using grep on a array to do a replace? grep example: if (grep(/bazza/i, @myarray)) { print "Bazza's home!\n"; } OR my @bazza_list = grep {/bazza/i} @myarray; (Either form is fine) However to do a repl

Re: Overridden methods

2004-11-24 Thread Michael S. E. Kraus
Am I asking to higher a level a question to be appropriate for this list? Thanks... -Mike On Wed, 2004-11-24 at 17:35, Michael Kraus wrote: > G'day... > > If a sublass has overrides a method in a superclass, and the subclasses > method calls the superclass's method, is there any mechanism to de

Re: Log()

2004-11-24 Thread Chris Devers
On Wed, 24 Nov 2004 [EMAIL PROTECTED] wrote: > That could explain why I couldn't found any information. > > My understanding is that log() is a log() statement that logged > progress of the script to a error log file. Who told you this? Are you being asked to maintain a script someone else wr

decompress downloaded page

2004-11-24 Thread Ing. Branislav Gerzo
Hi all, I have this snippet, and I'd like to decompress its contents: sub dwl { my $ua = LWP::UserAgent->new; $ua->default_header('Accept-Encoding' => 'gzip, deflate'); $resp = $ua->get(@_); return ($resp->content, $resp->status_line, $resp->is_success) if wantarray; return un

Re: Log()

2004-11-24 Thread Todd Lewis
If your writing something. I think you can output your die statement into a "log file" using print [logfile] "Whatever message you want\n" . You can also at certain points in your program output information on the status of your program. It helps in debugging your program. If it is a longrunnin

RE: Overridden methods

2004-11-24 Thread Bob Showalter
Michael Kraus wrote: > If a sublass has overrides a method in a superclass, and the > subclasses method calls the superclass's method, is there any > mechanism to detect that the superclass' method has been overridden? > > > I'm wanting to write a method in an abstract class that must be > overri

RE: Log()

2004-11-24 Thread Bob Showalter
Gunnar Hjalmarsson wrote: > I don't know what log() is. perldoc -f log :~) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Log()

2004-11-24 Thread Chris Devers
On Wed, 24 Nov 2004, Todd Lewis wrote: > If your [unspecified object, possibly "script"] [is] writing > something[comma] I think you can output your die statement into a "log > file" using print [logfile] "Whatever message you want\n". You can > also at certain points in your program output inf

Re: decompress downloaded page

2004-11-24 Thread Kelvin Wu
use Compress::Zlib; my $results = Compress::Zlib::memGunzip($resp->content); On Wed, 24 Nov 2004 14:32:27 +0100, Ing. Branislav Gerzo <[EMAIL PROTECTED]> wrote: > Hi all, > > I have this snippet, and I'd like to decompress its contents: > > sub dwl { >my $ua = LWP::UserAgent->new; >$ua

Re: Overridden methods

2004-11-24 Thread Paul Johnson
On Thu, Nov 25, 2004 at 12:03:55AM +1100, Michael S. E. Kraus wrote: > Am I asking to higher a level a question to be appropriate for this > list? It's a more advanced question than most, but not inappropriate for this list, I think. You may also wish to consider comp.lang.perl.misc or perlmonks

Re: decompress downloaded page

2004-11-24 Thread Ing. Branislav Gerzo
Kelvin Wu [KW], on Wednesday, November 24, 2004 at 21:46 (+0800) made these points: KW> use Compress::Zlib; KW> my $results = Compress::Zlib::memGunzip($resp->content); thanks a lot, I knew that will be so easy :) hm, what exactly means deflate ? It is not compressed content ? So my browser accep

Re: Subroutine call

2004-11-24 Thread JupiterHost.Net
TapasranjanMohapatra wrote: Hi All, Hello, I have a querry if the following can be possible. Suppose I have many sub routines in a module abc.pm package abc; Your package should use strict and warnings :) sub zzzq { } sub zzze { } sub zzzr { } Now I use this module in another script. I want to cal

Re: Overridden methods

2004-11-24 Thread JupiterHost.Net
Michael Kraus wrote: G'day... 'Ello :) If a sublass has overrides a method in a superclass, and the subclasses method calls the superclass's method, is there any mechanism to detect that the superclass' method has been overridden? I'm wanting to write a method in an abstract class that must be ove

Re: Overridden methods

2004-11-24 Thread Jenda Krynicky
From: "Michael Kraus" <[EMAIL PROTECTED]> > If a sublass has overrides a method in a superclass, and the > subclasses method calls the superclass's method, is there any > mechanism to detect that the superclass' method has been overridden? > > > I'm wanting to write a method in an abstract class

Re: Subroutine call

2004-11-24 Thread Todd W
"Charles K. Clarkson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > TapasranjanMohapatra <[EMAIL PROTECTED]> wrote: > > : Suppose I have many sub routines in a module abc.pm > : > : package abc; > : > : sub zzzq > : { > : } > : > : sub zzze > : { > : } > : sub zzzr > : { > : } > :

RE: HTML::TokeParser::Simple / get_attr

2004-11-24 Thread Brian Volk
Charles, Thank you! It's working! I went w/ the... foreach approach... my $parser = HTML::TokeParser::Simple->new(\$page) || die "Could not parse page"; my ($tag, $attr); $tag = $parser->get_tag("table") foreach (1..10); $parser->get_tag("tr") foreach (1..11); $parser->get_tag("

Re: Log()

2004-11-24 Thread ds10025
Thanks everyone for you help. I'll use the suggestion below. Thanks Dan At 13:41 24/11/2004, Chris Devers wrote: On Wed, 24 Nov 2004, Todd Lewis wrote: > If your [unspecified object, possibly "script"] [is] writing > something[comma] I think you can output your die statement into a "log > file" usi

RE: Overridden methods

2004-11-24 Thread Peter Scott
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Bob Showalter) writes: >Michael Kraus wrote: >> I'm wanting to write a method in an abstract class that must be >> overriden by it's children. If it is called directly (i.e. without >> being overriden) then it registers an error, but if its called

re: open a file for input

2004-11-24 Thread FlashMX
Hi, I'm trying to understand the logic. When you open a file each line is read in one at a time. At that point you can do whatever you want to that line. In my case a search and replace. Can I do two search and replaces on the same line or would I have to open the file again for a second pass?

RE: Overridden methods

2004-11-24 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > In article > <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] (Bob Showalter) writes: > > Michael Kraus wrote: > > > I'm wanting to write a method in an abstract class that must be > > > overriden by it's children. If it is called directly (i.e. without > > > being overriden) t

RE: Overridden methods

2004-11-24 Thread Bob Showalter
Bob Showalter wrote: >sub foo { >my $self = shift; >my $class = ref $self; >if ($class->can('foo') eq \&foo) { Oops, this should be $self->can, not $class->can >print "$class does not override foo\n"; >} >else { >print "$class ov

Re: Subroutine call

2004-11-24 Thread Lawrence Statton N1GAK/XE2
[EMAIL PROTECTED] (TapasranjanMohapatra) writes: > Now I use this module in another script. I want to call the sub routines, as > suggested by the argument passed to the script. > i.e. > my_script q should call the sub routine zzzq, > my_script e should call the sub routine zzze, > ... > > whe

re: open a file for input

2004-11-24 Thread Chris Devers
On Wed, 24 Nov 2004, FlashMX wrote: > I'm trying to understand the logic. When you open a file each line is > read in one at a time. At that point you can do whatever you want to > that line. In my case a search and replace. > > Can I do two search and replaces on the same line or would I have t

re: open a file for input

2004-11-24 Thread FlashMX
Right...but my problem is I don't want the substitutions to happen on ALL the lines matched. Notice from the below input and output examples I do a grep to search for "0 AAA ". I then do a substitution on "0 AAA " to "0 AAA BBB ". Then the first occurence of "XXX" after the "0 AAA " substitutio

RE: Multiple Regexs within the same block, but seems to be bypassing when I can see the data there

2004-11-24 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Charles K. Clarkson wrote: > From: Wagner, David --- Senior Programmer Analyst --- WGO <> wrote: > >> I have been working on thie script to take MVS >> JCl/Proc's and bring them together in a single output. I >> parsing out the DSN ( data file name ) and then attempting to >> determine if in

re: open a file for input

2004-11-24 Thread Chris Devers
On Wed, 24 Nov 2004, FlashMX wrote: > Right...but my problem is I don't want the substitutions to happen on > ALL the lines matched. Fine then. $line = sub_one( $line ) COND; Where COND is any condition you specify, e.g. $line = sub_one( $line ) if ( $line =~ /pattern one/ );

Perl module to compare images?

2004-11-24 Thread brian . barto
Hi all, Is there a module available to compare two images to detect differences between the two, i.e. motion? Searched CPAN to no avail. Thanks in advance! -Brian

RE: Perl module to compare images?

2004-11-24 Thread Larsen, Errin M HMMA/IT
Hi Brian, I don't have an answer to your question. But ... Did you know that O'reilly has a whole book to answer questions like these? Check out: http://www.oreilly.com/catalog/perlgp/ --Errin > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > Sent: Wednes

Re: Using regular expressions

2004-11-24 Thread John W. Krahn
Michael S. E. Kraus wrote: G'day... Hello, On Wed, 2004-11-24 at 23:00, FlashMX wrote: Could you give an example of using grep on a array to do a replace? grep example: if (grep(/bazza/i, @myarray)) { print "Bazza's home!\n"; } OR my @bazza_list = grep {/bazza/i} @myarray; (Either form is

Re: Using regular expressions

2004-11-24 Thread John W. Krahn
Michael S. E. Kraus wrote: G'day... Hello, On Wed, 2004-11-24 at 23:10, FlashMX wrote: To be able to do a grep on a file via a perl script do you have to read the whole file in before performing the search and replace? I've been hearing that reading the whole file in takes up memory and if multipl

RE: Spam:Re: Using regular expressions

2004-11-24 Thread Michael Kraus
John, Lighten up matey... The examples I've given are just that examples... Error checking functionality is up the end programmer... (And you are quite right, you should check the status of operations.) This is a beginers list, let's keep it friendly, eh? ... and FWIW ... for my $line () {

Re: open a file for input

2004-11-24 Thread John W. Krahn
FlashMX wrote: Right...but my problem is I don't want the substitutions to happen on ALL the lines matched. Notice from the below input and output examples I do a grep to search for "0 AAA ". I then do a substitution on "0 AAA " to "0 AAA BBB ". Then the first occurence of "XXX" after the "0 AAA "

RE: Overridden methods

2004-11-24 Thread Michael Kraus
G'day... Firstly ***thanks*** to everyone who has been helping me with this Really appreciated... Now, for friendly arguments sake... > > I'm wanting to write a method in an abstract class that must be > > overriden by it's children. If it is called directly (i.e. without > > being overrid

Re: Using regular expressions

2004-11-24 Thread Gunnar Hjalmarsson
[ Please do not quote the whole message you are responding to, but only what's needed to give context. Also, please type your reply *below* the part(s) of the message you are commenting on. ] Michael Kraus wrote: John W. Krahn wrote: You should *always* verify that the files were opened correctl

RE: Spam:RE: Spam:Re: Using regular expressions

2004-11-24 Thread Michael Kraus
Erps... Just re-read where you said: > You imply above that you will read the file "a line at a time" however > using a for loop will read the whole file into a list in memory. You > need to use a while loop to read a line at a time. ... And you're right... :) Regards, Michael S. E. Kraus

Re: Overridden methods

2004-11-24 Thread Todd W
"Michael S. E. Kraus" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Am I asking to higher a level a question to be appropriate for this > list? > > Thanks... > > -Mike I saw this browsing CPAN the other day... yep: http://search.cpan.org/~mschwern/Class-Virtual-0.04/ Hopefully t

Re: Perl module to compare images?

2004-11-24 Thread Kevin Lee Phair II
[EMAIL PROTECTED] wrote: Hi all, Is there a module available to compare two images to detect differences between the two, i.e. motion? Searched CPAN to no avail. Thanks in advance! -Brian While searching for a text conversion module yesterday I ran across at least one (I think more) module that

Substitution inside a loop

2004-11-24 Thread Brian Volk
Hi All, I have a .txt file which contains item numbers like so.. 1234 1245 1278 1240 etc. I am trying to print the entire url, $main_url after substituting the item number in the .txt file... I'm having a little trouble w/ my loop... Below is the script. #!/usr/bin/perl -w use strict; my

Re: Substitution inside a loop

2004-11-24 Thread Gunnar Hjalmarsson
Brian Volk wrote: I have a .txt file which contains item numbers like so.. 1234 1245 1278 1240 etc. I am trying to print the entire url, $main_url after substituting the item number in the .txt file... I'm having a little trouble w/ my loop... Below is the script. #!/usr/bin/perl -w use stric

Re: Spam:Re: Using regular expressions

2004-11-24 Thread John W. Krahn
[ Please do not top-post. TIA ] [ Please trim your posts. ( excess message trimmed ) TIA ] Michael Kraus wrote: John, Lighten up matey... The examples I've given are just that examples... Error checking functionality is up the end programmer... (And you are quite right, you should check the statu

Re: Substitution inside a loop

2004-11-24 Thread Gunnar Hjalmarsson
Gunnar Hjalmarsson wrote: Brian Volk wrote: while () { You want to remove the newline character: chomp; print "$main_url\n"; s/1804/KCITEM/ and print "$main_url\n"; You probably mean: $main_url =~ s/1804/$_/ and print "$main_url\n"; Hmm.. That suggestion wasn't very clever, I think. $ma

sprintf query

2004-11-24 Thread David Clarke
Does anyone know how to format a string so that the spaces are padded on the right, not the left. Im using $dates = sprintf("%64s", $dates); this right justifies the data and pads the left with spaces. I need the other way around - left justified and padded with spaces on the right. ***

Check file contents

2004-11-24 Thread Prabahar Mosas
  Dear All, How to check whether a file have junk contents or not I have confussion regarding this If any one know regarding this mail me

RE: sprintf query

2004-11-24 Thread Michael Kraus
G'day... > Does anyone know how to format a string so that the spaces are padded > on the right, not the left. > > Im using $dates = sprintf("%64s", $dates); > > this right justifies the data and pads the left with spaces. > I need the other way around - left justified and padded with spaces o

Re: Check file contents

2004-11-24 Thread Chris Devers
On Wed, 25 Nov 2004, Prabahar Mosas wrote: > How to check whether a file have junk contents or not I have > confussion regarding this If any one know regarding this mail me You're going to have to start by defining "junk contents" -- that could mean just about anything when stated in t

How to install LWP.pm module

2004-11-24 Thread Prabahar Mosas
  Dear All, I am using perl 5.00503. In this perl lot of pm modules are missing. I want to add LWP.pm,Warnings.pm in this perl. If anybody know regarding this mail me. by prabahar