[25283] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 7528 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 17 03:05:33 2004

Date: Fri, 17 Dec 2004 00:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 17 Dec 2004     Volume: 10 Number: 7528

Today's topics:
    Re: $ARGV, <>, and command-line Perl <lpetrov@yahoo.com>
    Re: $ftp->rget() does not work for MS Windows FTP Serve <vilain@spamcop.net>
    Re: [Q] $ARGV, <>, and command-line Perl <please_post@nomail.edu>
    Re: [Slightly OT] Perl interpreter (win32) single "thre <not@home.net>
    Re: HTML Parser <1usa@llenroc.ude.invalid>
    Re: HTML Parser <tadmc@augustmail.com>
    Re: HTML Parser <groups@gevorgian.com>
    Re: HTML Parser <uri@stemsystems.com>
    Re: HTML Parser <groups@gevorgian.com>
    Re: HTML Parser <groups@gevorgian.com>
    Re: HTML Parser <uri@stemsystems.com>
    Re: HTML Parser <uri@stemsystems.com>
    Re: HTML Parser <spamtrap@dot-app.org>
    Re: HTML Parser <jurgenex@hotmail.com>
    Re: HTML Parser <spamtrap@dot-app.org>
    Re: HTML Parser <groups@gevorgian.com>
    Re: HTML Parser <jurgenex@hotmail.com>
    Re: HTML Parser <groups@gevorgian.com>
        Regarding Inheritance <palemmahesh@yahoo.co.in>
        Regarding Inheritance <palemmahesh@yahoo.co.in>
    Re: Regarding Inheritance <spamtrap@dot-app.org>
    Re: Regarding Inheritance <spamtrap@dot-app.org>
    Re: search/replace and update the file in perl script <jurgenex@hotmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 16 Dec 2004 22:03:49 -0800
From: "lpetrov" <lpetrov@yahoo.com>
Subject: Re: $ARGV, <>, and command-line Perl
Message-Id: <1103263429.257592.99190@f14g2000cwb.googlegroups.com>

KKramsch wrote:
> In <QYjwd.25$I93.1155@news.uswest.net> "J. Gleixner"
<glex_nospam@qwest.invalid> writes:
>
> >J Krugman wrote:
> >> I've rtfm'd this to death, but I still don't get it.  If someone
> >> can explain it to me (as opposed to tell me something like "man
> >> perlfrotz"), I'd be very grateful.
> >>
> >> The immediate problem that serves as the context of the question
> >> is this: find all the files below /path/to/subdir (this is Linux)
> >> that contain either of the strings "foo bar baz" or "quux
frobozz",
> >> and do this *from the command line* (i.e. I'm looking for a
one-liner
> >> here, not a longwinded affair using File::Find, etc.).
> >>
> >> I tried
>
> >Since you're on a real OS, why not simply use the shell?
>
> >find /path/to/subdir -exec egrep -l 'foo bar baz|quux frobozz' {} \;
>
>
> I wish there were a standard term for "answering something other
> than what the OP asked."  I bet that this describes far more than
> 50% of the answers given to questions posted in the Usenet.
>
> I can think of one reason why the OP didn't simply "use the shell"
> and that is because there are times when one wants to use regexps
> (perhaps coupled with other tests, e.g. such as this regexp must
> happen in the file's first line) that are more sophisticated than
> the ones that egrep can handle (clearly the "foo bar" regexp was
> just a generic example).
>
> To the OP, I can't answer the more theoretical aspects of your
> question; I'll leave that to the experts.  But the following works
> for me:
>
>   $ find ~/ -type f | xargs perl -e 'for (@ARGV) { next unless -T;
while (<>) { ++$found if /(foo bar baz|quux frobozz)/; if (eof &&
$found) { print "$ARGV\n"; $found = 0; }}}'
>
> I'm sure there are less verbose and/or more efficient (e.g. not
> reading *every* line) ways of doing the above in Perl; I look
> forward to reading them.
>
> 	Karl
> --
> Sent from a spam-bucket account; I check it once in a blue moon.  If
> you still want to e-mail me, cut out the extension from my address,
> and make the obvious substitutions on what's left.
perl -ne '/search_string/ && print "$ARGV:$&\n"' *



------------------------------

Date: Thu, 16 Dec 2004 19:56:40 -0800
From: Michael Vilain <vilain@spamcop.net>
Subject: Re: $ftp->rget() does not work for MS Windows FTP Server
Message-Id: <vilain-483F70.19564016122004@news.giganews.com>

In article <1103253179.986187.313520@f14g2000cwb.googlegroups.com>,
 semovrs@concord.edu wrote:

> Hello, everyone,
> Has anyone tried to use Net::FTP::Recursive to connect to windows ftp
> service and used ftp->rget() with it? I tried it several times and it
> would return success for ftp->rget() but it wouldn't download my
> directory and subdirectories from the Winblows ftp server. I tried the
> same code to connect to a linux box and it worked just fine. So I am
> wondering - could it be the OS that's wasting my time?
> Thanks for any input in advance.
> Roumen.

It seems the ftp server doesn't support that function.  Contact the 
owner and complain.

-- 
DeeDee, don't press that button!  DeeDee!  NO!  Dee...





------------------------------

Date: Fri, 17 Dec 2004 03:40:51 +0000 (UTC)
From: bill <please_post@nomail.edu>
Subject: Re: [Q] $ARGV, <>, and command-line Perl
Message-Id: <cptkg3$dfm$1@reader2.panix.com>

In <cpt1lf$s74$1@sun3.bham.ac.uk> Brian McCauley <nobull@mail.com> writes:

>bill wrote:

>> I tried
>> 
>> perl -ne 'if (/whatever/) { print "$ARGV\n"; last }'
>> 
>> which seems to work, but I really don't know what I'm doing.

>I would expect that to print only the first matching file.

No, actually, it prints more than one.

bill



------------------------------

Date: Fri, 17 Dec 2004 06:36:29 GMT
From: "JayEs" <not@home.net>
Subject: Re: [Slightly OT] Perl interpreter (win32) single "threaded"?
Message-Id: <N7vwd.556$wi2.58@newssvr11.news.prodigy.com>


> Well I have at last manged to run your script on a WinXP box and with
> one copy in does look subjectively jerky.  Most of the time the time 
> waiting on external resources - nowhere near maxing-out the CPU.

Please define "jerkey" :-)

Seriously, when you say "waiting on external resources", do you mean, 
waiting for the site to respond  or for resources outside of Perl but local 
to the machine? Do you thibk I should use LWP instead of the Mech?

> Appart from subjective observations do you have anything to support the 
> hypothesis that the Perl processes are waiting on each other?

That's why I was reluctant to post code, "Jerkey" is not how I would 
describe the performance of the script, at least not on our servers, but I 
don't know what that means in that I don't see a performance degrade between 
different sites I try (our or external). I do notice that if you put a bunch 
of print statements in and then run 10 at a time (either started in a .bat 
or just have perl start 10 copies) you never see any simultaneous action, or 
so it seems from subjective observation....

It gets crazy when you use IE::Mech. Or at least I see things I don't 
expect... One script started say, 5 times, you see it fill in a box in one 
IE window, move to the next and fill same box there, move to the next ect... 
until it done all five before the process repeats for the next text box.... 
I swear the same thing in VB gives me near simultaneous execution.

What gives? 




------------------------------

Date: 17 Dec 2004 04:02:18 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: HTML Parser
Message-Id: <Xns95C1EA5B4F495asu1cornelledu@132.236.56.8>

"Asoup" <groups@gevorgian.com> wrote in 
news:1103244637.209361.238980@c13g2000cwb.googlegroups.com:

> I am working on a perl script that will catch data from a HTML file.
> Thus I am using HTML::FormatText module in order to work with the data.

Then why do you mention HTML::Parser in your subject line.

> My question is the following; Is there a way in HTML::FormatText that
> will allow me to catch a text that is located in, let's say <p
> class=news_title> (this is the text I need) </p> ?
> If you know of any other tricks please let me know :) thanks!

Use HTML::Parser.

Post your attempt if you encounter any problems.

Sinan,


------------------------------

Date: Thu, 16 Dec 2004 22:43:19 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: HTML Parser
Message-Id: <slrncs4ov7.4s8.tadmc@magna.augustmail.com>

Asoup <groups@gevorgian.com> wrote:


> I am working on a perl script that will catch data from a HTML file.
> Thus I am using HTML::FormatText module in order to work with the data.


That module will only help with the output part of your program.

What about getting the input in the first place?

Are you using HTML::TreeBuilder or some other module for that?


> My question is the following; Is there a way 


Yes.


> in HTML::FormatText 


No.


> that
> will allow me to catch a text that is located in, let's say <p
> class=news_title> (this is the text I need) </p> ?


Sure, there are many modules that will read HTML into some format
suitable for further processing (but HTML::FormatText isn't one of them).

Have you looked at search.cpan.org yet?

Or even tried looking for Frequently Asked Questions that
mention HTML?

   perldoc -q HTML


> If you know of any other tricks please let me know 


Programming with "tricks" is NOT something professional
programmers aspire to. [1]



[1] at work. Playing around is a whole different story.

-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: 16 Dec 2004 21:13:27 -0800
From: "Asoup" <groups@gevorgian.com>
Subject: Re: HTML Parser
Message-Id: <1103260407.937725.207940@f14g2000cwb.googlegroups.com>

>Then why do you mention HTML::Parser in your subject line.

I did not mention the module 'HTML::Parser' however, I think it is
related to the post. Anyway, thanks for the reply, however it did not
solve the problem.



------------------------------

Date: Fri, 17 Dec 2004 05:23:28 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: HTML Parser
Message-Id: <x71xdpijlb.fsf@mail.sysarch.com>

>>>>> "A" == Asoup  <groups@gevorgian.com> writes:

  >> Then why do you mention HTML::Parser in your subject line.
  A> I did not mention the module 'HTML::Parser' however, I think it is
  A> related to the post. Anyway, thanks for the reply, however it did not
  A> solve the problem.

i think you are in some sort of cone of foolishness. you mention PARSING
html in your subject and that is covered by HTML::Parser and related
modules. but you say you are using some form of HTML text generating
module to do your PARSING? either you don't know the meaning of the word
parse or you are doing a poor job of communicating what you are trying
to do. the quote above makes absolutely no sense at all as you did
mention the need in the subject. and it is the module you need. and
saying it did not solve the problem is no better than the classic newbie
cry of "it didn't work". how did it not solve the problem? what really
is the problem? do you have a proper grasp of the problem? is it an XY
problem (suspiciously so since you claim to be using one module for the
opposite of its intended purpose)?

i eagerly await your clear answer which explains your thought processes.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


------------------------------

Date: 16 Dec 2004 21:23:49 -0800
From: "Asoup" <groups@gevorgian.com>
Subject: Re: HTML Parser
Message-Id: <1103261029.368488.37300@z14g2000cwz.googlegroups.com>

Ted,

I've been working on this project on my spare time, and I've tried many
regexps :) None of them helped that's why I switched to perl modules
that remove the HTML Tags and leave the plain text (this is just a part
of the success). However, I want specific part of the text to be
displayed...

Also, thanks for the advice, I looked at the perldoc html... it didn't
help much.



------------------------------

Date: 16 Dec 2004 21:27:26 -0800
From: "Asoup" <groups@gevorgian.com>
Subject: Re: HTML Parser
Message-Id: <1103261246.137928.52960@z14g2000cwz.googlegroups.com>

What a schmuck... Is there a way to ignore people in this groups? lol
cuz Uri, you're wasting your time trying to make me upset "cry of
it"... lol



------------------------------

Date: Fri, 17 Dec 2004 05:33:33 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: HTML Parser
Message-Id: <x7y8fxh4k2.fsf@mail.sysarch.com>

>>>>> "A" == Asoup  <groups@gevorgian.com> writes:

  A> What a schmuck... Is there a way to ignore people in this groups? lol
  A> cuz Uri, you're wasting your time trying to make me upset "cry of
  A> it"... lol

too bad. you lose. most of the regulars will now rightfully plonk
you. your reply to tad gave me a clue this would happen. this response
guarantees it. you can plonk me for all i care (if you can ever figure
out how to do it).

goodbye. go learn php.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


------------------------------

Date: Fri, 17 Dec 2004 05:37:42 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: HTML Parser
Message-Id: <x7vfb1h4d5.fsf@mail.sysarch.com>

>>>>> "A" == Asoup  <groups@gevorgian.com> writes:

  A> I've been working on this project on my spare time, and I've tried many
  A> regexps :) None of them helped that's why I switched to perl modules
  A> that remove the HTML Tags and leave the plain text (this is just a part
  A> of the success). However, I want specific part of the text to be
  A> displayed...

the perl FAQ already says you can't parse html with a regex. you would
have saved yourself all that work.

that request has nothing to do with html. so go back and rewrite the
subject and question. this is a good exercise for you. but i doubt you
will do it for various obvious reasons.

  A> Also, thanks for the advice, I looked at the perldoc html... it didn't
  A> help much.

and it was 'perldoc -q HTML'. there is a major difference from what you
say you did and that command.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


------------------------------

Date: Fri, 17 Dec 2004 00:48:25 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: HTML Parser
Message-Id: <FbudnU9Zerm37l_cRVn-vw@adelphia.com>

Asoup wrote:

> What a schmuck... Is there a way to ignore people in this groups?

Yes there is - unfortunately for you. Most of the people who might have 
helped you will now be using it to ignore you.

> you're wasting your time trying to make me upset

He's not trying to make you upset. He's trying to help you clarify your 
question. Your subject states that your parsing HTML, and your message 
more or less agrees with that - but you say you're using a module that 
*creates* HTML. In other words, your question makes no sense.

If you want a useful answer, you need to ask a coherent question.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


------------------------------

Date: Fri, 17 Dec 2004 06:30:49 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: HTML Parser
Message-Id: <t2vwd.6239$mn6.1516@trnddc07>

Asoup wrote:
> I've been working on this project on my spare time, and I've tried
> many regexps :) None of them helped

Well, yeah, no big surprise there. As has been pointed out in this NG many 
_MANY_ times REs are not a suitable tool to parse HTML.

> that's why I switched to perl
> modules that remove the HTML Tags and leave the plain text (this is
> just a part of the success).

The right move. Had you read the FAQ or any of the previous threads about 
this very subject you would have found that solution much earlier.

> However, I want specific part of the
> text to be displayed...

Ok, what have you tried (hint, hint: show us your code!), what did you 
expect it to do, and what behaviour did you observe?

One way to do that is included as an example with HTML::Parser. 
Unfortunately the examples are not part of the standard installation, so you 
will have to download and manually unpack the HTML::Parser module from CPAN.

> Also, thanks for the advice, I looked at the perldoc html... it didn't
> help much.

What do you mean by "the perldoc html"? I hope you are talking about the 
Perl FAQ answer concerning HTML?

jue 




------------------------------

Date: Fri, 17 Dec 2004 01:31:40 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: HTML Parser
Message-Id: <iZCdnb5U7NDQ4F_cRVn-og@adelphia.com>

On Dec 17, 2004, at 12:59 AM, Asoup wrote:

> I think you have hard time understanding my question.

Then write a better question.

> people. I don't want to turn this discussion into a Arab-Israeli
> conflic (sarcasm to you who's name pretty much shows who you are...)...

WTF are you talking about? My last name is English, although the 
earliest ancestor I know about came to the US over three centuries ago.

Are you trying to say something about CamelBones? That's a play on words 
- Cocoa libraries are packaged in units called frameworks. CamelBones is 
a framework for Perl. Perl's mascot is a camel. A camel's "framework" is 
bones. Get it?

> Let's just continue the discussion... If you ask nicely what am I
> trying to make, I may reply to you :)

How about I ask you nicely to kiss my ass instead?

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


------------------------------

Date: 16 Dec 2004 22:48:53 -0800
From: "Asoup" <groups@gevorgian.com>
Subject: Re: HTML Parser
Message-Id: <1103266133.715414.277400@f14g2000cwb.googlegroups.com>


J=FCrgen Exner wrote:
> Asoup wrote:
> > I've been working on this project on my spare time, and I've tried
> > many regexps :) None of them helped
>
> Well, yeah, no big surprise there. As has been pointed out in this NG
many
> _MANY_ times REs are not a suitable tool to parse HTML.
>
> > that's why I switched to perl
> > modules that remove the HTML Tags and leave the plain text (this is
> > just a part of the success).
>
> The right move. Had you read the FAQ or any of the previous threads
about
> this very subject you would have found that solution much earlier.
Actually, yes, I think that people here would like to argue than
actually help. So I did read some documentation on cpan. And I am going
to study the HTML::Element module closely.
>
> > However, I want specific part of the
> > text to be displayed...
>
> Ok, what have you tried (hint, hint: show us your code!), what did
you
> expect it to do, and what behaviour did you observe?
>
> One way to do that is included as an example with HTML::Parser.
> Unfortunately the examples are not part of the standard installation,
so you
> will have to download and manually unpack the HTML::Parser module
from CPAN.
>
> > Also, thanks for the advice, I looked at the perldoc html... it
didn't
> > help much.
>
> What do you mean by "the perldoc html"? I hope you are talking about
the
> Perl FAQ answer concerning HTML?
>
> jue

Here is what I have right now:

#!/usr/bin/perl

use lib '/perl/lib';

use LWP::Simple;
use HTML::TreeBuilder;
use HTML::FormatText;


$output_file =3D "/public_html/rss.txt";

$html =3D
get("http://www.yerkir.am/eng/index.php?sub=3Dnews_arm&id=3D11918");

$formatter =3D HTML::FormatText->new;

$tree_builder =3D HTML::TreeBuilder->new;

$tree_builder->parse($html);

$text =3D $formatter->format($tree_builder);

open(FILE,">$output_file");
print FILE $text;
close(FILE);

# It just removes the tags, but now I don't know how to sort and *grab*
the text I need and remove the rest...



------------------------------

Date: Fri, 17 Dec 2004 07:08:04 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: HTML Parser
Message-Id: <oBvwd.8988$DV3.2618@trnddc06>

Asoup wrote:
> Jürgen Exner wrote:
>> Asoup wrote:
[...]
>> The right move. Had you read the FAQ or any of the previous threads
>> about this very subject you would have found that solution much
>> earlier.
> Actually, yes, I think that people here would like to argue than
> actually help. So I did read some documentation on cpan. And I am
> going to study the HTML::Element module closely.

I've no idea what HTML::Element does, but I wonder why you persistently 
resist looking at HTML::Parser as suggested by several people.

>>
>>> However, I want specific part of the
>>> text to be displayed...
>>
>> Ok, what have you tried (hint, hint: show us your code!), what did
>> you expect it to do, and what behaviour did you observe?
>>
>> One way to do that is included as an example with HTML::Parser.
>> Unfortunately the examples are not part of the standard
>> installation, so you will have to download and manually unpack the
>> HTML::Parser module from CPAN.
>
> Here is what I have right now:
>
> #!/usr/bin/perl
>
> use lib '/perl/lib';
>
> use LWP::Simple;
> use HTML::TreeBuilder;

I haven't used HTML::TreeBuilder, so I can't comment on that.

[code snipped]
> # It just removes the tags, but now I don't know how to sort and
> *grab* the text I need and remove the rest...

Well, I suppose after you removed the tags there is nothing left to help you 
identify the desired parts. So grab the right text _before_ removing the 
tags resp. while you still have the syntax tree or whatever 
HTML::TreeBuilder returns.

And once again: the documentation for HTML::Parser already contains an 
example for how to extract the body of a <title> element.
<quote>
The next example prints out the text that is inside the <title> element of 
an HTML document. Here we start by setting up a start handler. When it sees 
the title start tag it enables a text handler that prints any text found and 
an end handler that will terminate parsing as soon as the title end tag is 
seen:
[...]
More examples are found in the eg/ directory of the HTML-Parser 
distribution: the program hrefsub shows how you can edit all links found in 
a document; the program htextsub shows how to edit the text only; the 
program hstrip shows how you can strip out certain tags/elements and/or 
attributes; and the program htext show how to obtain the plain text, but not 
any script/style content.
</quote>

It can't be that difficult to adapt those examples for whatever you need to 
extract. BTW: did you notice, that you forgot to tell us _which_ part of the 
HTML file you want to extract?

jue 




------------------------------

Date: 16 Dec 2004 23:16:08 -0800
From: "Asoup" <groups@gevorgian.com>
Subject: Re: HTML Parser
Message-Id: <1103267768.780454.181390@z14g2000cwz.googlegroups.com>


J=FCrgen Exner wrote:
> Asoup wrote:
> > J=FCrgen Exner wrote:
> >> Asoup wrote:
> [...]
> >> The right move. Had you read the FAQ or any of the previous
threads
> >> about this very subject you would have found that solution much
> >> earlier.
> > Actually, yes, I think that people here would like to argue than
> > actually help. So I did read some documentation on cpan. And I am
> > going to study the HTML::Element module closely.
>
> I've no idea what HTML::Element does, but I wonder why you
persistently
> resist looking at HTML::Parser as suggested by several people.
>
> >>
> >>> However, I want specific part of the
> >>> text to be displayed...
> >>
> >> Ok, what have you tried (hint, hint: show us your code!), what did
> >> you expect it to do, and what behaviour did you observe?
> >>
> >> One way to do that is included as an example with HTML::Parser.
> >> Unfortunately the examples are not part of the standard
> >> installation, so you will have to download and manually unpack the
> >> HTML::Parser module from CPAN.
> >
> > Here is what I have right now:
> >
> > #!/usr/bin/perl
> >
> > use lib '/perl/lib';
> >
> > use LWP::Simple;
> > use HTML::TreeBuilder;
>
> I haven't used HTML::TreeBuilder, so I can't comment on that.
>
> [code snipped]
> > # It just removes the tags, but now I don't know how to sort and
> > *grab* the text I need and remove the rest...
>
> Well, I suppose after you removed the tags there is nothing left to
help you
> identify the desired parts. So grab the right text _before_ removing
the
> tags resp. while you still have the syntax tree or whatever
> HTML::TreeBuilder returns.
>
> And once again: the documentation for HTML::Parser already contains
an
> example for how to extract the body of a <title> element.
> <quote>
> The next example prints out the text that is inside the <title>
element of
> an HTML document. Here we start by setting up a start handler. When
it sees
> the title start tag it enables a text handler that prints any text
found and
> an end handler that will terminate parsing as soon as the title end
tag is
> seen:
> [...]
> More examples are found in the eg/ directory of the HTML-Parser
> distribution: the program hrefsub shows how you can edit all links
found in
> a document; the program htextsub shows how to edit the text only; the

> program hstrip shows how you can strip out certain tags/elements
and/or
> attributes; and the program htext show how to obtain the plain text,
but not
> any script/style content.
> </quote>
>
> It can't be that difficult to adapt those examples for whatever you
need to
> extract. BTW: did you notice, that you forgot to tell us _which_ part
of the
> HTML file you want to extract?
>
> jue

jue,

Thanks I will look at the HTML::Parser again.

I am looking at the <body>...</body>

The text that I need is located after: <b class=3Dtitle_news>
And another part that I need is located after: <b class=3Dnum2>



------------------------------

Date: 16 Dec 2004 20:35:55 -0800
From: "Mahesh" <palemmahesh@yahoo.co.in>
Subject: Regarding Inheritance
Message-Id: <1103258155.327513.140970@z14g2000cwz.googlegroups.com>

I have two packages package1 and package2.

Suppose this the code of package1
package package1;

my $file_scope_var = "var in package1"

sub new
{
my $proto = shift;
my $self = { };
my $class = ref ($proto) || $proto;
bless ($self, $class);
$self->{NAME} = undef;
}

sub print_package1
{
my $self = shift;
my $name = $self->NAME();
my $file_scope_var = $self->file_scope_var();
print"\n\n Name is $name and file scope var is $file_scope_var";
}


suppose the code of package2 is
package package2
@ISA=("package1");

sub new
{
my $proto = shift;
my $self = { };
my $class = ref ($proto) || $proto;
}

sub  print_package2
{
my $self = shift;
$self->print_package1();
}

now my problem is that since Iam inheriting package1 into package2.
and Iam calling print_package1 in package2.

Will that call to print_package2 will print file_scope_var value or
not. Since it is a file scope variable will it get printed when we call
print_package2 or not.

Please help me in this soon as I was stuck in the middle of the work.
Thanks and Regards,
Mahesh



------------------------------

Date: 16 Dec 2004 20:36:24 -0800
From: "Mahesh" <palemmahesh@yahoo.co.in>
Subject: Regarding Inheritance
Message-Id: <1103258184.151497.40410@f14g2000cwb.googlegroups.com>

I have two packages package1 and package2.

Suppose this the code of package1
package package1;

my $file_scope_var = "var in package1"

sub new
{
my $proto = shift;
my $self = { };
my $class = ref ($proto) || $proto;
bless ($self, $class);
$self->{NAME} = undef;
}

sub print_package1
{
my $self = shift;
my $name = $self->NAME();
my $file_scope_var = $self->file_scope_var();
print"\n\n Name is $name and file scope var is $file_scope_var";
}


suppose the code of package2 is
package package2
@ISA=("package1");

sub new
{
my $proto = shift;
my $self = { };
my $class = ref ($proto) || $proto;
}

sub  print_package2
{
my $self = shift;
$self->print_package1();
}

now my problem is that since Iam inheriting package1 into package2.
and Iam calling print_package1 in package2.

Will that call to print_package2 will print file_scope_var value or
not. Since it is a file scope variable will it get printed when we call
print_package2 or not.

Please help me in this soon as I was stuck in the middle of the work.
Thanks and Regards,
Mahesh



------------------------------

Date: Fri, 17 Dec 2004 00:23:44 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Regarding Inheritance
Message-Id: <3cSdnRhPno398F_cRVn-vA@adelphia.com>

Mahesh wrote:

> Will that call to print_package2 will print file_scope_var value or
> not. Since it is a file scope variable will it get printed when we call
> print_package2 or not.

Have a look at "perldoc perltooc", in the section "Inheritance Concerns" 
for a discussion of class variables and inheritance mix.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


------------------------------

Date: Fri, 17 Dec 2004 00:25:27 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Regarding Inheritance
Message-Id: <3cSdnRtPno1a8F_cRVn-vA@adelphia.com>

Mahesh wrote:

 ... twice. Please don't do that. We heard you the first time.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


------------------------------

Date: Fri, 17 Dec 2004 02:45:31 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: search/replace and update the file in perl script
Message-Id: <fLrwd.421$tG3.237@trnddc02>

jrefactors@hotmail.com wrote:
> I need a perl script to search and replace the keywords in a file, and
> update that file with new
> keyword.
>
> The usage should be perl modify.pl oldvalue newvalue filename
>
> I wrote the script, I can search and replace, but I guess
> the problem is I don't know how to update the file.
[...]
> Please advise. Thanks!!

Please see
    perldoc -q "change one line"

jue 




------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 7528
***************************************


home help back first fref pref prev next nref lref last post