in reply to Re^2: override CORE sub and keep method in same package
in thread override CORE sub and keep method in same package
Update: I assuming from your typically terse description that you goal is to override the function of the built-in select only within the IO::Select module without overriding the select method it presents to its callers.
If that is not the case, perhaps you could clarify your requirements?
Yes. "CORE::GLOBAL::" is too aggressive.
Hm. The CORE::GLOBAL discussion is only a one part of the discussion referenced.
There is also use REGlob 'glob'; # override glob() in Foo:: only, amongst others.
But, to answer your specific problem, I'd suggest adding:
sub yourSelect { ... } sub select { local *CORE::GLOBAL::select = *yourSelect; shift if defined $_[0] && !ref($_[0]); my($r,$w,$e,$t) = @_; my @result = (); my $rb = defined $r ? $r->[VEC_BITS] : undef; my $wb = defined $w ? $w->[VEC_BITS] : undef; my $eb = defined $e ? $e->[VEC_BITS] : undef; if(select($rb,$wb,$eb,$t) > 0) ################################################ }
Wherever select is used in IO::Select. Make it conditional if appropriate.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: override CORE sub and keep method in same package (Updated)
by bulk88 (Priest) on Oct 15, 2013 at 14:53 UTC | |
by BrowserUk (Patriarch) on Oct 15, 2013 at 23:01 UTC |