Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

How do I redefine a builtin function, operator, or method?

by faq_monk (Initiate)
on Oct 08, 1999 at 00:27 UTC ( #698=perlfaq nodetype: print w/ replies, xml ) Need Help??

Current Perl documentation can be found at

Here is our local, out-dated (pre-5.6) version:

Why do you want to do thatNULL :-)

If you want to override a predefined function, such as open(), then you'll have to import the new definition from a different module. See Overriding Builtin Functions. There's also an example in Class/Template.

If you want to overload a Perl operator, such as + or **, then you'll want to use the use overload pragma, documented in the overload manpage.

If you're talking about obscuring method calls in parent classes, see Overridden Methods.

Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2015-10-10 00:21 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (254 votes), past polls