06-12-2012
Check the
examples supplied with WWW::Mechanize, and ask specific questions. We're not here to do your work.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I am trying to write a script to automatically use a predefined program to open a file according to its extension... But I don't know how to pass "programeta" ... :confused:
while ]; do
case $1 in
-pdf ) programeta="kpdf"
shift 1 ;;
... (1 Reply)
Discussion started by: pau
1 Replies
2. Solaris
Hi, Is there a way to open and arrange terminal windows automatically under CDE? For example, I want to open and arrange terminal windows like this:
|------------|
| TW TW TW |
| TW TW TW |
| TW TW TW |
|------------|
Thank you in advanced! (5 Replies)
Discussion started by: aixlover
5 Replies
3. IP Networking
My router has UPnP,how to make it work with ubuntu to automatically open ports
I try to open the following command " /sbin/iptables -I INPUT -d 0/0 -s 0/0 -p tcp --dport 21 -j ACCEPT" ,local only opens ,if i put the ip 192.168.1.68, it works correctly, if i`m put my external ip does not work,I... (9 Replies)
Discussion started by: dhalus
9 Replies
4. Red Hat
hi,
I am using red hat .I want that when ever the user login in GUI interface the terminal windows automatically open and then the user want to logout it 1st close the terminal and then login. There is a file in #ls -a i.e .bashrc and .bash_logout
I does not know how to add my... (0 Replies)
Discussion started by: mypass
0 Replies
5. Shell Programming and Scripting
Hi All
Can anyone please help me how to open a webpage suppose(Google)
with the help of perl script and refresh it after every 5 minutes. (0 Replies)
Discussion started by: parthmittal2007
0 Replies
6. Shell Programming and Scripting
Hi All ,
i am trying to create an alias to open a new gnome-terminal and run some commands in each tab & to have a specific name for each tab
i am using csh ,
tried this command
gnome-terminal --tab -t "s1" --tab -t "s2" --tab -t "s3" --tab -t "s4"
it opened 4 tabs but the title didn't... (0 Replies)
Discussion started by: Assem
0 Replies
7. Shell Programming and Scripting
hi guys, its me, doritos guy, I've laid off of the doritos for a while, twas given me stomach problems. you know when you eat 10 family size bags a day it might cause a problem, any-who
i appreciated the help from last time when i was trying to script something, now i just have to try to... (2 Replies)
Discussion started by: ilovedoritos
2 Replies
8. Shell Programming and Scripting
Hi friends,
I have UNIX (HP-UX) server. I want to open a webpage (lets say www.unixhelp.com) on this webpage there is one checkbox. I just need to check it. and click on save.
Its just take a half a minute to do so in windows system. But I am wondering if this is possible though UNIX server.... (3 Replies)
Discussion started by: Nakul_sh
3 Replies
9. UNIX for Beginners Questions & Answers
Hi Friends,
Every I try to open a vi window vim help.txt automatically opens evertime.
After doing ZZ or :q! also the same page opens automatically.
How to stop this? Is it machine specific ? Other users who are opening the same servers and files are not facing this issue.
Thanks... (1 Reply)
Discussion started by: sudiptabhaskar
1 Replies
10. Shell Programming and Scripting
Hi Friends,
Every I try to open a vi window, vim help.txt automatically opens evertime.
After doing ZZ or :q! also the same page opens automatically.
How to stop this? Is it machine specific ? Other users who are opening the same servers and files are not facing this issue.
Thanks... (3 Replies)
Discussion started by: sudiptabhaskar
3 Replies
LEARN ABOUT DEBIAN
www::mechanize::treebuilder
WWW::Mechanize::TreeBuilder(3pm) User Contributed Perl Documentation WWW::Mechanize::TreeBuilder(3pm)
NAME
WWW::Mechanize::TreeBuilder - Module to optimize WWW::Mechanize and HTML::TreeBuilder use
SYNOPSIS
use Test::More tests => 2;
use Test::WWW::Mechanize;
use WWW::Mechanize::TreeBuilder;
# or
# use WWW::Mechanize;
# or
# use Test::WWW::Mechanize::Catalyst 'MyApp';
my $mech = Test::WWW::Mechanize->new;
# or
#my $mech = Test::WWW::Mechanize::Catalyst->new;
# etc. etc.
WWW::Mechanize::TreeBuilder->meta->apply($mech);
$mech->get_ok('/');
is( $mech->look_down(_tag => 'p')->as_trimmed_text, 'Some text', 'It worked' );
DESCRIPTION
This module combines WWW::Mechanize and HTML::TreeBuilder. Why? Because I've seen too much code like the following:
like($mech->content, qr{<p>some text</p>}, "Found the right tag");
Which is just all flavours of wrong - its akin to processing XML with regexps. Instead, do it like the following:
ok($mech->look_down(_tag => 'p', sub { $_[0]->as_trimmed_text eq 'some text' })
The anon-sub there is a bit icky, but this means that anyone should happen to add attributes to the "<p>" tag (such as an id or a class) it
will still work and find the right tag.
All of the methods available on HTML::Element (that aren't 'private' - i.e. that don't begin with an underscore) such as "look_down" or
"find" are automatically delegated to "$mech->tree" through the magic of Moose.
METHODS
Everything in WWW::Mechanize (or which ever sub class you apply it to) and all public methods from HTML::Element except those where
WWW::Mechanize and HTML::Element overlap. In the case where the two classes both define a method, the one from WWW::Mechanize will be used
(so that the existing behaviour of Mechanize doesn't break.)
USING XPATH OR OTHER SUBCLASSES
HTML::TreeBuilder::XPath allows you to use use xpath selectors to select elements in the tree. You can use that module by providing
parameters to the moose role:
with 'WWW::Mechanize::TreeBuilder' => {
tree_class => 'HTML::TreeBuilder::XPath'
};
# or
# NOTE: No hashref using this method
WWW::Mechanize::TreeBuilder->meta->apply($mech,
tree_class => 'HTML::TreeBuilder::XPath';
);
and class will be automatically loaded for you. This class will be used to construct the tree in the following manner:
$tree = $tree_class->new_from_content($req->decoded_content)->elementify;
You can also specify a "element_class" parameter which is the (HTML::Element sub)class that methods are proxied from. This module provides
defaults for element_class when "tree_class" is "HTML::TreeBuilder" or "HTML::TreeBuilder::XPath" - it will warn otherwise.
AUTHOR
Ash Berlin "<ash@cpan.org>"
LICENSE
Same as Perl 5.8, or at your option any later version of Perl.
perl v5.10.1 2010-12-16 WWW::Mechanize::TreeBuilder(3pm)