Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 21021
Status: rejected
Priority: 0/
Queue: WWW-Mechanize

People
Owner: Nobody in particular
Requestors: ericslaw [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: bugfix 3035 may be too restrictive?
Date: Wed, 16 Aug 2006 12:27:13 -0400
To: bug-WWW-Mechanize [...] rt.cpan.org
From: "Eric Law" <ericslaw [...] gmail.com>
"bugfix #3035 find_link() et al should squak on bad regexes" seems to have added code that tries to insure that the values to url_regex and text_regex are regular expressions. The specific bit of code looks like this: $val_regex = ( ref($val) eq "Regexp" ); But I am not yet able to force a text string into a regex _except_ by doing the inverted if in the following code snippet. Keep in mind that the split actually occurs on an input file, not on the actual string shown here: my ( $field, $value ) = split(/,/, "url_regex, pattern", 2 ); # having to do this next step seems contradictory to just passing in the parameters $value = qr/$value/ if $field =~/_regex/; $mech->find_link( $field => $value ); seems like bugfix 3035 makes the tool harder to use, or should contain a small snippet on how to force a string into a Regexp ? -Eric Law
From: MARKSTOS [...] cpan.org
On Wed Aug 16 12:27:27 2006, ericslaw@gmail.com wrote: Show quoted text
> "bugfix #3035 find_link() et al should squak on bad regexes" > seems to have added code that tries to insure that the values to > url_regex and text_regex are regular expressions. > The specific bit of code looks like this: > $val_regex = ( ref($val) eq "Regexp" ); > > But I am not yet able to force a text string into a regex _except_ by > doing the > inverted if in the following code snippet. Keep in mind that the > split actually occurs on an input file, not on the actual string shown > here: > > my ( $field, $value ) = split(/,/, "url_regex, pattern", 2 ); > # having to do this next step seems contradictory to just passing in > the parameters > $value = qr/$value/ if $field =~/_regex/; > $mech->find_link( $field => $value ); > > seems like bugfix 3035 makes the tool harder to use, or should contain > a small > snippet on how to force a string into a Regexp ? > > -Eric Law
Eric, I maintain Data::FormValidator which tries to accept strings as Regexp's, and also accepts formal regexeps, through the use of 'qr'. It's a lot cleaner and simpler to just support 'qr', so I support that design change. Please submit a patch for the docs that explain through text or example that Using 'qr' is how to cast a string into a regular expression. Mark