in reply to Removing AUTOLOAD from CGI.pm

Sounds fair and good. I like and tend to use CGI::Pretty. Sometimes just from the command line to get template snippets.

Replies are listed 'Best First'.
Re^2: Removing AUTOLOAD from CGI.pm
by leej (Monk) on Feb 23, 2015 at 08:40 UTC

    > I like and tend to use CGI::Pretty. Sometimes just from the command line to get template snippets.

    That is actually a sane use case, but unfortunately the way CGI::Pretty is written means i can't remove the AUTOLOAD stuff from CGI without breaking the pretty functionality of CGI::Pretty. Not just that, but it contains some very, er, "interesting" code!

    It probably *could* be kept functioning, but i'm not going to spend time on it and would rather deprecate it.

      Understood. Appreciate your efforts!

        Not sure why AUTOLOAD is needed in CGI anyway, the allowed HTML-tags seem to be exported from CGI to the local namespace, but only spring into existence within the stash of %CGI:: after first use! ¹

        Speed can't be that relevant, CGI doesn't do any syntax validation, so the same generic function could be installed at import time for all html-tags, maybe with a closed over $tag_name if necessary.

        What am I missing?

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)

        PS: Je suis Charlie!

        ¹) didn't know it's possible to predeclare an AUTOLOADed sub ... (scratch)

        update

        interesting...

        DB<181> package Test; sub AUTOLOAD { $AUTOLOAD,\@_ } DB<182> bar(1,2,3) Undefined subroutine &main::bar called at (eval 196)[multi_perl5db.pl: +644] line 2. DB<183> Test::bar(1,2,3) => ("Test::bar", [1, 2, 3]) DB<184> *bar=\&Test::bar DB<185> bar(1,2,3) => ("Test::bar", [1, 2, 3])

        but

        DB<186> *foo=*Test::foo DB<187> foo(1,2,3) Undefined subroutine &Test::foo called at (eval 206)[multi_perl5db.pl: +644] line 2.

Re^2: Removing AUTOLOAD from CGI.pm
by LanX (Saint) on Feb 20, 2015 at 18:12 UTC
    > CGI::Pretty.

    BTW the earliest example of a DSL that I encountered. (Ruby do you hear? :)

    Cheers Rolf

    PS: Je suis Charlie!

    (addicted to the Perl Programming Language and ☆☆☆☆ :)