in reply to Making Coro::Socket Override IO::Socket::INET
package Bar; sub import { print "Hi!\n"; } package main; use warnings; use strict; BEGIN{*{Foo::} = *{Bar::};} # can't "use" there because there is no Foo.pm Foo::->import; __END__ Hi!
Write a header in your script that once uses Coro::Socket and then replaces IO::Socket::INET:: namespace with Coro::Socket::. Subsequent uses of IO::Socket::INET will call import() from Coro::Socket and will use its subroutines.
Edit: you'll probably need to use IO::Socket::INET before replacing namespaces, too, so further calls to it won't eval it and overwrite Coro::Socket's subs back.
|
|---|