{"action":"created","issue":{"url":"https://api.github.com/repos/p5pclub/ref-util/issues/9","repository_url":"https://api.github.com/repos/p5pclub/ref-util","labels_url":"https://api.github.com/repos/p5pclub/ref-util/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/p5pclub/ref-util/issues/9/comments","events_url":"https://api.github.com/repos/p5pclub/ref-util/issues/9/events","html_url":"https://github.com/p5pclub/ref-util/issues/9","id":138935963,"number":9,"title":"Regexp check is wrong for older perls","user":{"login":"xsawyerx","id":54725,"avatar_url":"https://avatars.githubusercontent.com/u/54725?v=3","gravatar_id":"","url":"https://api.github.com/users/xsawyerx","html_url":"https://github.com/xsawyerx","followers_url":"https://api.github.com/users/xsawyerx/followers","following_url":"https://api.github.com/users/xsawyerx/following{/other_user}","gists_url":"https://api.github.com/users/xsawyerx/gists{/gist_id}","starred_url":"https://api.github.com/users/xsawyerx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xsawyerx/subscriptions","organizations_url":"https://api.github.com/users/xsawyerx/orgs","repos_url":"https://api.github.com/users/xsawyerx/repos","events_url":"https://api.github.com/users/xsawyerx/events{/privacy}","received_events_url":"https://api.github.com/users/xsawyerx/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/p5pclub/ref-util/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-07T09:53:35Z","updated_at":"2016-03-07T10:09:20Z","closed_at":null,"body":"Reported by Yves Orton.\r\n\r\n> It should return true for is_regexpref(bless qr/foo/, foo), and as written it wouldn't.\r\n> You chould look at code in Data::Dump::Streamer, see\r\n> http://cpansearch.perl.org/src/YVES/Data-Dump-Streamer-2.39/lib/Data/Dump/Streamer.xs\r\n>\r\n> Search for:\r\n> mg_find(sv, PERL_MAGIC_qr)\r\n> Or you could look at the log for universal.c in perl, where in 803059618a6e90fb614193e8cdf81c79f27d8764 I added this:\r\n\r\n```\r\n  +regexp *\r\n  +Perl_get_re_arg( pTHX_ SV *sv, U32 flags, MAGIC **mgp) {\r\n  +    MAGIC *mg;\r\n  +    if (sv) {\r\n  +        if (SvMAGICAL(sv))\r\n  +            mg_get(sv);\r\n  +        if (SvROK(sv) &&\r\n  +            (sv = (SV*)SvRV(sv)) &&     /* assign deliberate */\r\n  +            SvTYPE(sv) == SVt_PVMG &&\r\n  +            (mg = mg_find(sv, PERL_MAGIC_qr))) /* assign deliberate */\r\n  +        {       \r\n  +            if (mgp) *mgp = mg;\r\n  +            return (regexp *)mg->mg_obj;      \r\n  +        }\r\n  +    }   \r\n  +    if (mgp) *mgp = NULL;\r\n  +    return ((flags && PL_curpm) ? PM_GETRE(PL_curpm) : NULL);\r\n  +}\r\n```\r\n\r\n> which contains pretty much what you want. BTW, re.pm has an is_regexp function, perhaps you should test yours against it. Dont forget to test blessed regexps."},"comment":{"url":"https://api.github.com/repos/p5pclub/ref-util/issues/comments/193190129","html_url":"https://github.com/p5pclub/ref-util/issues/9#issuecomment-193190129","issue_url":"https://api.github.com/repos/p5pclub/ref-util/issues/9","id":193190129,"user":{"login":"demerphq","id":106183,"avatar_url":"https://avatars.githubusercontent.com/u/106183?v=3","gravatar_id":"","url":"https://api.github.com/users/demerphq","html_url":"https://github.com/demerphq","followers_url":"https://api.github.com/users/demerphq/followers","following_url":"https://api.github.com/users/demerphq/following{/other_user}","gists_url":"https://api.github.com/users/demerphq/gists{/gist_id}","starred_url":"https://api.github.com/users/demerphq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/demerphq/subscriptions","organizations_url":"https://api.github.com/users/demerphq/orgs","repos_url":"https://api.github.com/users/demerphq/repos","events_url":"https://api.github.com/users/demerphq/events{/privacy}","received_events_url":"https://api.github.com/users/demerphq/received_events","type":"User","site_admin":false},"created_at":"2016-03-07T10:09:20Z","updated_at":"2016-03-07T10:09:20Z","body":"Probably the docs should also mention re::is_regexp(), which has one nice feature of always being available in modern Perls."}}