[28447] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9811 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 6 11:05:55 2006

Date: Fri, 6 Oct 2006 08:05:06 -0700 (PDT)
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, 6 Oct 2006     Volume: 10 Number: 9811

Today's topics:
    Re: "too many arguments" passing hash reference to subr <mritty@gmail.com>
    Re: "too many arguments" passing hash reference to subr <kenslaterpa@hotmail.com>
    Re: "too many arguments" passing hash reference to subr <de@spamfree.com>
    Re: Can perl test for .mp3 file? <itfred@cdw.com>
    Re: Can perl test for .mp3 file? <itfred@cdw.com>
    Re: Can perl test for .mp3 file? <itfred@cdw.com>
    Re: Complex regular expression <peace.is.our.profession@gmx.de>
    Re: Complex regular expression <peace.is.our.profession@gmx.de>
    Re: Complex regular expression chaitask@yahoo.com
    Re: Complex regular expression <scobloke2@infotop.co.uk>
    Re: Complex regular expression <peace.is.our.profession@gmx.de>
    Re: Complex regular expression <attn.steven.kuo@gmail.com>
    Re: Hard or Easy? To find string, then grab criterion m samiam@mytrashmail.com
    Re: Help with Code <scobloke2@infotop.co.uk>
        How to parse a new computer language in Perl? <zhushenli@gmail.com>
    Re: Parsing HTML - using HTML::TreeBuilder olson_ord@yahoo.it
    Re: Parsing HTML - using HTML::TreeBuilder <mritty@gmail.com>
    Re: Parsing HTML - using HTML::TreeBuilder olson_ord@yahoo.it
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 6 Oct 2006 03:39:13 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: "too many arguments" passing hash reference to subroutine
Message-Id: <1160131153.580873.313070@k70g2000cwa.googlegroups.com>

Dean wrote:
> Running the code below I see the error:
>
> Too many arguments for main::print_rHoHoH at ./usenet.pl line 21, near
> "$xml)"
>
> #!/usr/bin/perl -w
> use XML::Simple;
>
> sub print_rHoHoH(){

You have unknowingly prototyped your subroutine to take zero arguments.
 The parentheses do not belong there.

Paul Lalli



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

Date: 6 Oct 2006 03:41:21 -0700
From: "kens" <kenslaterpa@hotmail.com>
Subject: Re: "too many arguments" passing hash reference to subroutine
Message-Id: <1160131280.979235.325720@b28g2000cwb.googlegroups.com>


Dean wrote:
> Running the code below I see the error:
>
> Too many arguments for main::print_rHoHoH at ./usenet.pl line 21, near
> "$xml)"

Whenever you see this message it means that the function/subroutine has
been
prototyped - it has a defined parameter list.

>
>
>
> #!/usr/bin/perl -w
> use XML::Simple;
>
> sub print_rHoHoH(){

Here you defined the prototype (unintentionally I presume). The empty
parenthese indicate that this function takes no parameters.
Omit the parentheses and see how that works.

> 	$rHoHoH=$_[0];
>     for my $k1 ( sort keys %$rHoHoH ) {
>         print "$k1\n";
>
>         for my $k2 ( sort keys %{$rHoHoH->{ $k1 }} ) {
>             print "\t$k2\n";
>
>             for my $k3 ( sort keys %{$rHoHoH->{ $k1 }->{ $k2 }} ) {
>                 print "\t\t$k3 => $rHoHoH->{ $k1 }->{ $k2 }->{ $k3 }\n";
>             }
>         }
>     }
> }
>
> $xml=XMLin($ARGV[0]);
> print_rHoHoH($xml);
>
>
>
> I don't understand why passing the reference to the hash in the call to the
> subroutine causes the error.
>
> If I change the last line to
> do print_rHoHoH($xml);
> it works, but with a warning about 'do' being deprecated.
> 
> Any insight would be much appreciated.
> Thanks.

HTH,
Ken



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

Date: Fri, 06 Oct 2006 12:55:40 +0100
From: Dean <de@spamfree.com>
Subject: Re: "too many arguments" passing hash reference to subroutine
Message-Id: <4526442a$0$8754$ed2619ec@ptn-nntp-reader02.plus.net>

On 6 Oct 2006 03:41:21 -0700, kens wrote:

>
>Dean wrote:
>> Running the code below I see the error:
>>
>> Too many arguments for main::print_rHoHoH at ./usenet.pl line 21, near
>> "$xml)"
>
>Whenever you see this message it means that the function/subroutine has
>been
>prototyped - it has a defined parameter list.
>
>>
>>
>>
>> #!/usr/bin/perl -w
>> use XML::Simple;
>>
>> sub print_rHoHoH(){
>
>Here you defined the prototype (unintentionally I presume). The empty
>parenthese indicate that this function takes no parameters.
>Omit the parentheses and see how that works.
>
>> 	$rHoHoH=$_[0];
>>     for my $k1 ( sort keys %$rHoHoH ) {
>>         print "$k1\n";
>>
>>         for my $k2 ( sort keys %{$rHoHoH->{ $k1 }} ) {
>>             print "\t$k2\n";
>>
>>             for my $k3 ( sort keys %{$rHoHoH->{ $k1 }->{ $k2 }} ) {
>>                 print "\t\t$k3 => $rHoHoH->{ $k1 }->{ $k2 }->{ $k3 }\n";
>>             }
>>         }
>>     }
>> }
>>
>> $xml=XMLin($ARGV[0]);
>> print_rHoHoH($xml);
>>
>>
>>
>> I don't understand why passing the reference to the hash in the call to the
>> subroutine causes the error.
>>
>> If I change the last line to
>> do print_rHoHoH($xml);
>> it works, but with a warning about 'do' being deprecated.
>> 
>> Any insight would be much appreciated.
>> Thanks.
>
>HTH,
>Ken

Many Thanks.  All I can say is I'd been doing some php prior to this and
completely overlooked it :-/



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

Date: Fri, 06 Oct 2006 10:21:05 -0400
From: Fred <itfred@cdw.com>
Subject: Re: Can perl test for .mp3 file?
Message-Id: <lMKdnRk79fzM-7vYnZ2dnUVZ_r6dnZ2d@giganews.com>

On Thu, 05 Oct 2006 23:00:46 -0700, Vilmos Soti wrote:

> Look for the File::MMagic module.
> 
> Vilmos


Thanks.  I found the File::Type module.  Listed below is an excerpt 
from the perl docs which mentions the File::MMagic module:


SEE ALSO
       File::MMagic and File::MimeInfo perform the same job, but have a number of problems that
       led to the creation of this module.





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

Date: Fri, 06 Oct 2006 10:21:23 -0400
From: Fred <itfred@cdw.com>
Subject: Re: Can perl test for .mp3 file?
Message-Id: <lMKdnRg79fz--7vYnZ2dnUVZ_r6dnZ2d@giganews.com>

On Fri, 06 Oct 2006 05:42:07 +0000, John Bokma wrote:

> The magic keyword is magic:
> 
> <http://search.cpan.org/search?query=magic&mode=all>
> 
> File::Type
> File::MimeInfo::Magic


Thank you.


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

Date: Fri, 06 Oct 2006 10:35:07 -0400
From: Fred <itfred@cdw.com>
Subject: Re: Can perl test for .mp3 file?
Message-Id: <rsednRN0PJAB9LvYnZ2dnUVZ_rKdnZ2d@giganews.com>

On Fri, 06 Oct 2006 05:42:07 +0000, John Bokma wrote:
 
> The magic keyword is magic:
> 
> <http://search.cpan.org/search?query=magic&mode=all>
> 
> File::Type
> File::MimeInfo::Magic


I just fond that if I pass an .mp3 file, an empty
text file, or a directory, to File::Type, it always
returns a MIME type of application/octet-stream.
I'm going to give File::MimeInfo::Magic a try...


antares:/home/fred/perls> filetest.pl tush.mp3
application/octet-stream

antares:/home/fred/perls> filetest.pl empty.txt
application/octet-stream

antares:/home/fred/perls> filetest.pl /tmp
application/octet-stream




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

Date: Fri, 06 Oct 2006 12:24:06 +0200
From: Mirco Wahab <peace.is.our.profession@gmx.de>
Subject: Re: Complex regular expression
Message-Id: <eg5b4h$he0$1@mlucom4.urz.uni-halle.de>

Thus spoke Bart Van der Donck (on 2006-10-06 10:54):
> Mirco Wahab wrote:
>>    my $regexp=qr/^
>>                 [*]{0,1}
>>                 \d{1,3}[-]{0,1}
>>                 \d{0,2}[-]{0,1}
>>                 \d{0,3}
>>                 [*]{0,1}
>>                 $/x;
> 
> No. That will incorrectly match things like
>    9-9

Yes, one would need the brackets + alternations
to fix the pattern to the left, as you said.

BTW: This looks like some
recursive regex would work ...

Any ideas?

Regards

Mirco


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

Date: Fri, 06 Oct 2006 12:31:14 +0200
From: Mirco Wahab <peace.is.our.profession@gmx.de>
Subject: Re: Complex regular expression
Message-Id: <eg5bhu$hje$1@mlucom4.urz.uni-halle.de>

Thus spoke Bart Van der Donck (on 2006-10-06 11:04):
> Mirco Wahab wrote:
> 
>>  /^\*?\d{1,3}-?\d{0,2}-?\d{0,3}\*?$/
> 
> Not correct. See my other reply to you in this thread.

Yes, you built a tree from the alternations ...

  qr/^\*?
          (  \d{1,3}
               | \d{3}-  (  \d{0,2}
                              | \d{2}-  ( \d{0,3}
                                        )
                          )
          )

       \*?$/x;

Thanks for your beautiful and (for me) instructive
solution.

Regards

Mirco




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

Date: 6 Oct 2006 04:21:43 -0700
From: chaitask@yahoo.com
Subject: Re: Complex regular expression
Message-Id: <1160133703.609866.28570@m7g2000cwm.googlegroups.com>

Hi John,

I've just read up the perldoc on perlretut and am not still very clear
on this expression.....do you think you could write up a little help
note on this (rather, on how you framed it......the process of thinking
about it and framing it)? If you have time, that is.....

Will be grateful for anything...

-Krish

>
> /\A\*?\d(?:\d(?:\d(?:-(?:\d(?:\d(?:-(?:\d(?:\d\d?)?)?)?)?)?)?)?)?\*?\z/
>



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

Date: Fri, 06 Oct 2006 14:24:24 +0100
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: Complex regular expression
Message-Id: <B-GdnRR4z-WXxLvYRVnyvw@bt.com>

John W. Krahn wrote:
> jayanthigk2004@yahoo.com wrote:
> 
>>Is it possible to write a regular expression for this ?
>>
>>Pattern: 999-99-999
>>
>>Where 9 is any number from 0 to 9
>>
>>However the user need not enter ALL the digits and dashes as given in
>>the format.
>>
>>Whatever numbers and dashes he had entered must match the above format,
>>from left to right, for only the charcters he has entered.
>>
>>For example
>>9
>>99
>>999
>>999-
>>999-9
>>999-99
>>999-99-
>>999-99-9
>>999-99-99
>>999-99-999
>>
>>Any of the above should result in a match
>>
>>Next, he can also put * before or after or before and after any of the
>>above combination
> 
> 
> 
> /\A\*?\d(?:\d(?:\d(?:-(?:\d(?:\d(?:-(?:\d(?:\d\d?)?)?)?)?)?)?)?)?\*?\z/
> 
> 
> 
> John

As Dr Ruud pointed out in a different thread, all the solutions 
involving \d will also match far more than ASCII digits 0-9. For example:
١٣-٤٢٣

Of course, this may be acceptable for the OP.


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

Date: Fri, 06 Oct 2006 15:17:55 +0200
From: Mirco Wahab <peace.is.our.profession@gmx.de>
Subject: Re: Complex regular expression
Message-Id: <eg5lae$kar$1@mlucom4.urz.uni-halle.de>

Thus spoke chaitask@yahoo.com (on 2006-10-06 13:21):
>>
>> /\A\*?\d(?:\d(?:\d(?:-(?:\d(?:\d(?:-(?:\d(?:\d\d?)?)?)?)?)?)?)?)?\*?\z/
>>
> 
> I've just read up the perldoc on perlretut and am not still very clear
> on this expression.....do you think you could write up a little help
> note on this (rather, on how you framed it......the process of thinking
> about it and framing it)? If you have time, that is.....

This is just a repeated sequence of
enclosing parentheses (), which do
not save their pattern:

  <`perldoc prelre`>
     ...
     If you want to use parentheses to
     delimit a subpattern (e.g., a set
     of alternatives) without saving it as
     a subpattern, follow the ( with a ?:
     ...
  </`perldoc prelre`>

Regards

M.

PS. (to JW): the above don't work here, -
is there some copy/paste error?



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

Date: 6 Oct 2006 07:31:39 -0700
From: "attn.steven.kuo@gmail.com" <attn.steven.kuo@gmail.com>
Subject: Re: Complex regular expression
Message-Id: <1160145092.498384.189790@m7g2000cwm.googlegroups.com>

jayanthigk2004@yahoo.com wrote:
> Is it possible to write a regular expression for this ?
>
> Pattern: 999-99-999
>
>
> Where 9 is any number from 0 to 9
>
>
> However the user need not enter ALL the digits and dashes as given in
> the format.
>
>
> Whatever numbers and dashes he had entered must match the above format,
>
> from left to right, for only the charcters he has entered.
>
>
> For example
> 9
> 99
> 999
> 999-
> 999-9
> 999-99
> 999-99-
> 999-99-9
> 999-99-99
> 999-99-999
>
>
> Any of the above should result in a match
>
>
> Next, he can also put * before or after or before and after any of the
> above combination


One way could be to construct the regular expression
based on the length of the target string itself:


my @sequence = (
    '',
    ('\d') x 3,
    '[-]',
    ('\d') x 2,
    '[-]',
    ('\d') x 3
);


while (<DATA>)
{
    chomp;
    if (length and /^\*?(??{
        no warnings 'uninitialized';
        join '', @sequence[0 .. length() - pos()], '?'})\*?$/)
    {
        print "$_ matches\n";
    }
    else
    {
        print "$_ does NOT match\n";
    }
}

__DATA__
9
*9
9*
*99-
999-
999*
z
999-99
999-990
999-99*
*999-990*
999-99-999
999-99-9999

-- 
Hope this helps,
Steven



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

Date: 6 Oct 2006 06:22:58 -0700
From: samiam@mytrashmail.com
Subject: Re: Hard or Easy? To find string, then grab criterion matched lines above and below?
Message-Id: <1160140978.792351.46970@m73g2000cwd.googlegroups.com>

Hi Tad,

Thanks for the reply.

Your code snippet is leaner and more elegant than the labyrinthine code
I imagined necessary.

Sorry about my second data file not reflecting a match to the 1st. Per
your rebuke I have amended my ways: Here are links to data file
examples with matching data points:

http://home.comcast.net/~tankomail/test.dsc
http://home.comcast.net/~tankomail/server1.aud

And below is a snippet of FILE-A data which matches FILE-B data.

For instance - the fail line 5.4.6.24 in FILE-B matches the # cached
logon credentials #  section in FILE-A vis-a-vis the section containing
the same 5.4.6.24 CSR#.

FILE-A is no more than sections delimited by #Section Title# , the
Registry key that needs to be changed, and identified by CSR numbers.

The goal is to pull the registry entry from each failed CSR section
(Identified in FILE-B) and pull from FILE-A:
1.) #section title#
2.) CSR#
3.) %%before and %% after registry keys

and push this data into CSV format for viewing with Excel.

--------------------------
FILE-B Aud file:

5.7.1.2~Password Expires Requirement~FAIL~FAIL~
5.4.6.62~Force Unlock Logon~FAIL~FAIL~
5.4.6.24~Cached logon credentials~FAIL~FAIL~1010
5.4.6.27~Smart Card Behavior~FAIL~FAIL~11
5.4.6.20~Auto Admin Login Settings~PASS~PASS~00
5.4.6.9~Sharing of Devices - Floppys~PASS~PASS~11
5.4.6.9~Sharing of Devices - CDRoms~PASS~PASS~11
5.4.6.7~Sharing of Devices - DASD~PASS~PASS~00
5.4.6.16~IPSec Security for Kerberos RSVP Traffic~PASS~PASS~11
5.4.6.17~Hide Computer Name~FAIL~FAIL~
---------------------------

Find the fail lines, get the CSR at the beginning of the line and match
to registry change section in FILE-A
-------------------------
FILE-A dsc file:

# cached logon credentials #
dialog set,text1,"5.4.6.24 Cached logon credentials"     **********
dialog set,text2,"5.4.6.24 Cached logon credentials"
%%before = @REGREAD(HLM,SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon,CachedLogonsCount,)
REGISTRY WRITE,HLM,SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon,CachedLogonsCount,2
%%after = @REGREAD(HLM,SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon,CachedLogonsCount,)
%%stat = FAIL
%%stat2 = FAIL
if @equal(%%before,"2")
%%stat = PASS
end
if @equal(%%after,"2")
%%stat2 = PASS
end
list add,debug,"Cached logon credentials:Setting Before Run" %%before
"Setting After Run:" %%after
list add,log,"5.4.6.24~Cached logon
credentials~"%%stat"~"%%stat2"~"%%before%%after
list savefile,log,%%logfile
list savefile,debug,%%debugfile
wait 0.2

:checktwentyseven
%%check = @INIREAD(checks,checktwentyseven)
if @equal(%%check,off)
goto checktwentyeight
end
---------------------------

Thanks for your help Tad!

L,
Sam

Tad McClellan wrote:
> samiam@mytrashmail.com <samiam@mytrashmail.com> wrote:
>
> > I know this is a trivial parse / grep job for any Perl rake worth his
> > salt, but does anyone have guidance on how this Perl newbie might pull
> > a string from one file and use this string to pull the lines in another
> > file out, and also pull the first line before (matching criteria) and
> > the first line after (matching criteria.)
>
>
> If you show us the code you have so far, we will help you fix it.
>
>
> > At first I thought to use VBScript, but then I realized that Perl is
> > portable, doesn't necessarily have to  be installed on the server, and
>
>
> What "server"?
>
> A server is not normally required to run Perl programs.
>
> Is this a stealth CGI question?
>
> If it is a CGI question, then you _do_ need to have perl installed
> on the web server.
>
>
> > Summary: I need to find CSR numbers in FILE-A that map to registry key
> > entries in FILE-B, and report the pertinent surrounding info.
>
>
> None of the failed CSR numbers in your example FILE-A map to any registry
> key entries in FILE-B, so the program must make no output...
>
>
> > a.) find the lines in *.aud files with "Fail" in them
> > b.) Extract the Section number from the beginning of that same line.
>
>
> Here's how to do that part:
>
> -----------------------------------------------
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> while ( <DATA>) {
>    my($csr, @fields) = split /~/;
>    next unless grep { $_ eq 'FAIL' } @fields;
>    print "$csr\n";
>
> }
>
> __DATA__
> 5.2.4~Local Printers Shared~NA~PASS~NA
> 5.8.1~FTP Server Installed~NA~PASS~NA
> 5.6.2~POSIX Subsystem Installed~PASS~PASS~
> 5.2.2~Posix Subsystem File Components - Posix.exe Not Found~NA~PASS~NA
> 5.2.2~Posix Subsystem File Components - Psxss.exe Not Found~NA~PASS~NA
> 5.2.2~Posix Subsystem File Components - Psxdll.dll Not Found~NA~PASS~NA
> 5.6.1.1~NetMeeting Disable Remote Desktop Sharing~FAIL~FAIL~
> 5.6.1.2~IE Security Zones are Local Only~FAIL~FAIL~
> 5.6.1.2.2~Allow User to Change IE Sec Policy~FAIL~FAIL~
> 5.6.1.2.3~IE Security Zones Map Editing~FAIL~FAIL~
> 5.6.1.2.4~IE Proxy Settings Set Per User~FAIL~FAIL~
> 5.6.1.2.5~IE Automatic Installs Disabled~FAIL~FAIL~
> 5.6.1.2.6~IE Software Update Check~FAIL~FAIL~
> -----------------------------------------------
>
>
>
> > Then use that CSR# to pull from a 2nd *.dsc file :
>
>
> I would have done that part too, but I could not be troubled
> to come up with a meaningful data file (and neither could you,
> it would appear).
>
>
> --
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas



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

Date: Fri, 06 Oct 2006 14:11:34 +0100
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: Help with Code
Message-Id: <yfednWbGao2Vy7vYRVnytw@bt.com>

Dr.Ruud wrote:
> Ian Wilson schreef:
> 
> 
>>\d matches "0", "1" ... "8" or "9"
> 
> Last time I checked, \d matched 268 different characters. 

Both the above statements are true :-)
All 268 are characters, all are digits, few are numeric!

> Dear programmer, if you mean [0-9], then write [0-9].

No one has really followed up on this in the context set by the OP.

Assuming that some program writes a decimal checksum to a file and that 
checksum  contains non-ASCII numerals, would Perl arithmetic do the 
right thing?

-----------------------8<-----------------------------
#!/usr/bin/perl
#
use warnings;
use strict;

checksum('foo 1234 bar');
checksum("fie \x{0101} fum");
checksum("baz \x{0661}\x{0662}\x{0663}\x{0664} qux");

sub checksum {
   my $text = shift;
   if ($text =~ /(\d+)/) {
     print "$1 + 1 = ", $1+1, "\n";
   } else {
     print "no numbers in '$text' \n";
   }
}
-----------------------8<-----------------------------
$ perl -v
This is perl, v5.8.0 built for i386-linux-thread-multi

$ perl numbers.pl
1234 + 1 = 1235
Wide character in print at numbers.pl line 15.
no numbers in 'fie ā fum'
Argument "\x{661}\x{662}..." isn't numeric in addition (+) at numbers.pl 
line 13.
Wide character in print at numbers.pl line 13.
١٢٣٤ + 1 = 1

(Actually the last line looked different before I cut & pasted it, it 
ended " + 1 = 1")

Why doesn't perl handle any unicode digit named "XXXX DIGIT NINE" as 
numerically equivalent to DIGIT NINE?


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

Date: 6 Oct 2006 08:02:13 -0700
From: "Davy" <zhushenli@gmail.com>
Subject: How to parse a new computer language in Perl?
Message-Id: <1160146933.876581.56710@m7g2000cwm.googlegroups.com>

Hi all,

I was told that when design a new computer language, I need something
like yacc to define the language parser principle. And other people
told me that XML can be used to parse the computer language.

Please recommand a simple computer language parser module in Perl.

Best regards,
Davy



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

Date: 6 Oct 2006 04:46:21 -0700
From: olson_ord@yahoo.it
Subject: Re: Parsing HTML - using HTML::TreeBuilder
Message-Id: <1160135181.444769.90430@m73g2000cwd.googlegroups.com>

Dear Paul,
	Thanks a lot for taking your time to answer. I am not new to
programming (i.e. I use C++ for my work)but I am new to Perl. Yes, now
at least I got this initial part to work. I think I would have more
questions in the future.
	If you prefer to use HTML::TokeParser I would love to look at it
myself. So if you have some handy tutorials on using the TokeParser
then it would be helpful for me. (Right now I could only locate
something at http://www.perlmonks.org/index.pl?node_id=99254 I would
look at this later.
Thanks again,
O.O.



Paul Lalli wrote:

>
> I personally prefer HTML::TokeParser for parsing HTML, but TIMTOWTDI
>

> >   my $tree = HTML::TreeBuilder->new();
> >     $tree->parse_file($html);
>
> This attempts to find a file named by the string in $html and parse
> that file.  Obviously, no such file exists.
> 
> You want
> $tree->parse($html);
> 
> Paul Lalli



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

Date: 6 Oct 2006 04:52:10 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Parsing HTML - using HTML::TreeBuilder
Message-Id: <1160135530.536586.292340@h48g2000cwc.googlegroups.com>

olson_ord@yahoo.it wrote:

> 	If you prefer to use HTML::TokeParser I would love to look at it
> myself. So if you have some handy tutorials on using the TokeParser
> then it would be helpful for me.

I don't know about tutorials, but the documentation for the module is
pretty decent:
http://search.cpan.org/~gaas/HTML-Parser-3.55/lib/HTML/TokeParser.pm

Paul Lalli



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

Date: 6 Oct 2006 07:58:50 -0700
From: olson_ord@yahoo.it
Subject: Re: Parsing HTML - using HTML::TreeBuilder
Message-Id: <1160146729.937799.31230@e3g2000cwe.googlegroups.com>

Thanks a lot Paul.
	I looked at the documentation HTML::TokeParser and it does not tell me
if there is an easy way to find a certain token (e.g. "h2") i.e. It
seems that I would have to start from the beginning and then scan all
the tokens until I reach the required token. (I am basically looking
for a find() function - or something similar.)
Thanks a lot for your help.
Regards,
O.O.

Paul Lalli wrote:
> olson_ord@yahoo.it wrote:
>
> > 	If you prefer to use HTML::TokeParser I would love to look at it
> > myself. So if you have some handy tutorials on using the TokeParser
> > then it would be helpful for me.
>
> I don't know about tutorials, but the documentation for the module is
> pretty decent:
> http://search.cpan.org/~gaas/HTML-Parser-3.55/lib/HTML/TokeParser.pm
> 
> Paul Lalli



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

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 9811
***************************************


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