[libweasel-perl] 01/10: * Add support for overriding 'page' attribute value's class
Robert James Clay
jame at rocasa.us
Tue Aug 15 19:16:10 UTC 2017
This is an automated email from the git hooks/post-receive script.
jame-guest pushed a commit to tag v0.06
in repository libweasel-perl.
commit b44bdcbc880187b02329ce55157c7ce1728cad86
Author: Erik Huelsmann <ehuels at gmail.com>
Date: Sun Jul 3 21:45:37 2016 +0200
* Add support for overriding 'page' attribute value's class
---
lib/Weasel/Session.pm | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/lib/Weasel/Session.pm b/lib/Weasel/Session.pm
index decb357..711a9c5 100644
--- a/lib/Weasel/Session.pm
+++ b/lib/Weasel/Session.pm
@@ -38,7 +38,7 @@ use warnings;
use Moose;
-use Weasel::Element::Document;
+use Module::Runtime qw/ use_module /;;
use Weasel::FindExpanders qw/ expand_finder_pattern /;
use Weasel::WidgetHandlers qw| best_match_handler_class |;
@@ -82,7 +82,7 @@ has 'base_url' => (is => 'rw',
=item page
-Returns the root element of the target HTML page (the 'html' tag).
+Holds the root element of the target HTML page (the 'html' tag).
=cut
@@ -92,10 +92,21 @@ has 'page' => (is => 'ro',
sub _page_builder {
my $self = shift;
+ my $class = use_module($self->page_class);
- return Weasel::Element::Document->new(session => $self);
+ return $class->new(session => $self);
}
+=item page_class
+
+Upon instantiation can be set to an alternative class name for the C<page>
+attribute.
+
+=cut
+
+has 'page_class' => (is => 'ro',
+ isa => 'Str',
+ default => 'Weasel::Element::Document');
=item retry_timeout
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libweasel-perl.git
More information about the Pkg-perl-cvs-commits
mailing list