[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#526436: libperl4caml-ocaml-dev: Using regexp fails with www_mechanize.follow_link



Package: libperl4caml-ocaml-dev
Version: 0.9.5-2
Severity: important
Tags: patch

In the module Pl_WWW_Mechanize, class www_mechanize, if I use the method
follow_link with label url_regex or text_regex I got a Perl error message
telling me the argument is not a regexp.

Here is the code of the method :

  method follow_link ?text ?text_regex ?url ?url_regex ?url_abs ?url_abs_regex
    ?name ?name_regex ?tag ?tag_regex ?n () =
    let args = ref [] in
    let add name f = function
      | None -> ()
      | Some p -> args := sv_of_string name :: f p :: !args
    in
    add "text" sv_of_string text;
    add "text_regex" sv_of_string text_regex;
    add "url" sv_of_string url;
    add "url_regex" sv_of_string url_regex;
    add "url_abs" sv_of_string url_abs;
    add "url_abs_regex" sv_of_string url_abs_regex;
    add "name" sv_of_string name;
    add "name_regex" sv_of_string name_regex;
    add "tag" sv_of_string tag;
    add "tag_regex" sv_of_string tag_regex; 
    add "n" sv_of_int n; 
    call_method_void sv "follow_link" !args


As you can see, sv_of_string text_regex is the sv of a string but not the sv of a regexp.
To correct this bug, I changed the four lines :

    add "url_abs_regex" sv_of_string url_abs_regex;
    add "url_regex" sv_of_string url_regex;
    add "name_regex" sv_of_string name_regex;
    add "tag_regex" sv_of_string tag_regex; 

with

    add "url_abs_regex" eval url_abs_regex;
    add "url_regex" eval url_regex;
    add "name_regex" eval name_regex;
    add "tag_regex" eval tag_regex; 

eval returns the sv of the evaluated string, which hopefully is a regexp.

Other occurences of this bug may be present in this package.

(perl -v : This is perl, v5.10.0 built for i486-linux-gnu-thread-multi)

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.29-1-amd64
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libperl4caml-ocaml-dev depends on:
ii  libdate-calc-perl            5.4-6       Perl library for accessing dates
ii  libhtml-tree-perl            3.23-1      represent and create HTML syntax t
ii  libnet-google-perl           1.0.1-1     Simple OOP-ish interface to the Go
ii  libperl4caml-ocaml           0.9.5-2     Use Perl code in OCaml programs, r
ii  libtemplate-perl             2.20-1      template processing system written
ii  liburi-perl                  1.37+dfsg-1 Manipulates and accesses URI strin

libperl4caml-ocaml-dev recommends no packages.

Versions of packages libperl4caml-ocaml-dev suggests:
ii  libcrypt-ssleay-perl          0.57-1+b1  Support for https protocol in LWP
ii  libperl4caml-ocaml-doc        0.9.5-2    Use Perl code in OCaml programs, d
ii  libtimedate-perl              1.1600-9   Time and date functions for Perl
ii  libwww-mechanize-perl         1.54-2     module to automate interaction wit
ii  libwww-perl                   5.825-1    WWW client/server library for Perl

-- no debconf information



Reply to: