Sponsored Content
Top Forums Shell Programming and Scripting Perl syntax and html ole parsing Post 302712995 by wakatana on Wednesday 10th of October 2012 06:24:30 AM
Old 10-10-2012
Perl syntax and html ole parsing

Hi gurus
I am trying to understand some advanced (for me) perl constructions (syntax) following this tutorial I am trying to parse html:
Using Mojo:SmilieOM | Joel Berger [blogs.perl.org]


Code:
say "div days:";
say $_->text for $dom->find('div.days')->each;

say "\nspan hours:";
say $_->text for $dom->find('span.hours')->each;

What does this syntax mean, what is going on here ?
- What kind of loop is this, classic for construction looks like this: for(i=0;i<10;i++){ code } not: {code} for (some_condition)
- What does "each" keyword mean in this context ? Does it have somethin common with "each" build in perl function
each - perldoc.perl.org or it is specific to Mojo:SmilieOM ?
IMHO on Mojo:SmilieOM homepage I did not found any mention about "each" under methods section Mojo:SmilieOM - search.cpan.org
so it must be a build in function of perl, but this buildin "each" function has completelly different syntax, how is this possible, am I missing somethin ?



Another example from tutorial page
Code:
say "Open Times:";
say for $dom->find('div.openTime')
            ->map(sub{$_->children->each})
            ->map(sub{$_->text})
            ->each;

Same issue as above for "map" and "sub" methods
map - perldoc.perl.org sub - perldoc.perl.org



- Can be those pieces of "Perlish" code rewriten in more "C specific" maner so I can understand it?
- Most important: How to list all methods their parameters and return values contained in Mojo:SmilieOM ?
it must be done somehow, because I read that even for perl there are IDE with intelisense (autcompletition) so this IDE must know the methods return value types etc.



Thank you very much
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

HTML parsing by PERL

i have a HTML report file..its in attachment(a part of the whole report is attached..name "input html.doc").also its source is attached in "report source code.txt" i just want to seperate the datas like in first line it should be.. NHTEST-3848498958-NHTEST-10.2-no-baloo a and so on for whole... (3 Replies)
Discussion started by: avik1983
3 Replies

2. Shell Programming and Scripting

Perl parsing compared to Ksh parsing

#! /usr/local/bin/perl -w $ip = "$ARGV"; $rw = "$ARGV"; $snmpg = "/usr/local/bin/snmpbulkget -v2c -Cn1 -Cn2 -Os -c $rw"; $snmpw = "/usr/local/bin/snmpwalk -Os -c $rw"; $syst=`$snmpg $ip system sysName sysObjectID`; sysDescr.0 = STRING: Cisco Internetwork Operating System Software... (1 Reply)
Discussion started by: popeye
1 Replies

3. Shell Programming and Scripting

Parsing: How to go from HTML to CSV?

Dear all, I have to parse a large amount of html files, which I would like to transform into comma separated values. The html-files have the following structure: <tag1> CATEGORY_1 <tag2><tag3> HEADER_1 <tag4> <tag5> paragraph_1 <tag6> <tag5> paragraph_2 <tag6> <tag3>HEADER_2... (2 Replies)
Discussion started by: docdudetheman
2 Replies

4. Shell Programming and Scripting

Spell Check in MS Word using PERL OLE

Hi, I am trying automate couting number of spell and typo errors in MS Word document using perl script. In perl script, i am using Win32::OLE module of perl to read MS word document. Can anybody tell me are there any modules available in perl which can be imported into my script to... (0 Replies)
Discussion started by: 123an
0 Replies

5. UNIX for Advanced & Expert Users

html parsing using unix

hi all, I had raised the same question a few weeks back but forgot to mention a lot of points ... so i am raising a new thread furnishing my requirement ... sorry for that .... here is my problem. i have a html that look like below <tr class="modifications-oddrow"> <td... (2 Replies)
Discussion started by: sais
2 Replies

6. Shell Programming and Scripting

OLE ERROR in perl

Hello All, I have executed one script where i am getting this error,what may be the reason..... please help me out. OLE exception from Microsoft Excel Win32::OLE(0.1403) error 0x800a03ec in METHOD/PROPERTYGET "open" (1 Reply)
Discussion started by: suvenduperl
1 Replies

7. Shell Programming and Scripting

PERL Win32::OLE Inserting Picture in Excel

I am trying to insert a picture into a worksheet in Excel using Perl the following is the code use Win32::OLE; use Win32::OLE::Const "Microsoft Excel"; use Win32::OLE qw(in with); # Initiate Excel application $Excel = Win32::OLE->new('Excel.Application', 'Quit'); $Excel->{Visible} =1; #... (1 Reply)
Discussion started by: cold_Que
1 Replies

8. Shell Programming and Scripting

Parsing HTML, get text between 2 HTML tags

Hi there, I'm quite new to the forum and shell scripting. I want to filter out the "166.0 points". The results, that i found in google / the forum search didn't helped me :( <a href="/user/test" class="headitem menu" style="color:rgb(83,186,224);">test</a><a href="/points" class="headitem... (1 Reply)
Discussion started by: Mysthik
1 Replies

9. Shell Programming and Scripting

win32 ole in deepr details in perl

Hello Gurus, I am begginer in perl. I would like to ask several questions, some related to perl and its syntax but most will be regarding to WIN32 OLE. My main goal is to develop script that will check word document structure (return some information) and make some changes in this document (if it... (0 Replies)
Discussion started by: wakatana
0 Replies

10. Programming

Perl OLE Selection property iteration in cycle

Hi gurus, i am trying to write simple perl script using win32 ole which will iterate over all M$ word paragraphs (any text that ends with a hard return) and print only those paragraphs that matches the specified condition. The problem is that I need to access font size property. It seems to me that... (0 Replies)
Discussion started by: wakatana
0 Replies
SVN::Class::Repos(3pm)					User Contributed Perl Documentation				    SVN::Class::Repos(3pm)

NAME
SVN::Class::Repos - represents the repository of a Subversion workspace SYNOPSIS
use SVN::Class; my $file = svn_file( 'path/to/file' ); my $info = $file->info; my $url = $info->url; print "repository URL is $url "; DESCRIPTION
SVN::Class::URL represents the source repository for a workspace. METHODS
SVN::Class::URL inherits from Rose::URI and SVN::Class. init Override the base Rose::URI method to set some default values in object. AUTHOR
Peter Karman, "<karman at cpan.org>" BUGS
Please report any bugs or feature requests to "bug-svn-class at rt.cpan.org", or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SVN-Class <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SVN-Class>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. SUPPORT
You can find documentation for this module with the perldoc command. perldoc SVN::Class You can also look for information at: o AnnoCPAN: Annotated CPAN documentation http://annocpan.org/dist/SVN-Class <http://annocpan.org/dist/SVN-Class> o CPAN Ratings http://cpanratings.perl.org/d/SVN-Class <http://cpanratings.perl.org/d/SVN-Class> o RT: CPAN's request tracker http://rt.cpan.org/NoAuth/Bugs.html?Dist=SVN-Class <http://rt.cpan.org/NoAuth/Bugs.html?Dist=SVN-Class> o Search CPAN http://search.cpan.org/dist/SVN-Class <http://search.cpan.org/dist/SVN-Class> ACKNOWLEDGEMENTS
I looked at SVN::Agent before starting this project. It has a different API, more like SVN::Client in the SVN::Core, but I cribbed some of the ideas. The Minnesota Supercomputing Institute "http://www.msi.umn.edu/" sponsored the development of this software. COPYRIGHT
Copyright 2008 by the Regents of the University of Minnesota. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Rose::URI, Path::Class, Class::Accessor::Fast, SVN::Agent, IPC::Cmd perl v5.14.2 2012-01-31 SVN::Class::Repos(3pm)
All times are GMT -4. The time now is 10:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy