I have several hundred different misc cgis that I want to override CGI->new in. Basically I want to stash a ref to the original CGI::new coderef, call it, then run some routines after it finishes.

These scripts are all very different, but do use some custom libraries (e.g. use Company::CustomLib;). So I want to put the override code in CustomLib.pm.

I got my code working in the body of a cgi using the Sub::Override module. However when I move that to CustomLib.pm it doesn't override, I assume some namespace issue I don't understand.

I've been experimenting a lot with symbol tables and what not, as well as googling around still haven't stumbled arcross how to make it be overridden if it's in CustomLib.pm. I'm about ready to just hack CGI.pm but really dont' want to have to do that when I know there's some better way.

thanks for help

cheers to the all!

In reply to over ride CGI::new from existing package by damian45

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.