On Mon, Aug 30, 2021 at 10:02 AM Yuki Kimoto <kimoto.yuki@gmail.com> wrote: > > 2021-8-30 14:12 Dan Book <grinnz@gmail.com> wrote: > >> On Mon, Aug 30, 2021 at 1:09 AM Yuki Kimoto <kimoto.yuki@gmail.com> >> wrote: >> >> Imported symbols override builtins already, this is how modules like >> autodie and Time::HiRes work. But yes, this chance of collision is >> unavoidable and we have to take more care with more common names. >> >> -Dan >> > > > Imported symbols override builtins already > > Is this really? > > perl -E 'sub substr { print "substr\n" }; substr();' > > Output > > Not enough arguments for substr at -e line 1, near "substr()" > Execution of -e aborted due to compilation errors. > > Imported symbols don't seem to override CORE::substr, > That's not actually imported though. $ perl -E 'BEGIN { package foo; *::substr=sub { print "substr\n" } } substr();' substr $ Yes, it needs that package declaration ⦠EirikThread Previous | Thread Next