Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^4: $io->can('seek') == true, but $io->seek(pos, whence) == 'Illegal seek' - bug ?

by hakkr (Chaplain)
on Nov 15, 2004 at 14:46 UTC ( [id://407831]=note: print w/replies, xml ) Need Help??


in reply to Re^3: $io->can('seek') == true, but $io->seek(pos, whence) == 'Illegal seek' - bug ?
in thread $io->can('seek') == true, but $io->seek(pos, whence) == 'Illegal seek' - bug ?

I agree there is nothing wrong with inheriting methods that are not implemented. You could say that seek is an abstract method of the base class which in this case has not been implemented.

It is still correct to have it in there as the base class is defining as part of an interface and saying it always must be

Now if it really bothers you then you can put in your own overridden implementation of seek() that just throws a better error like 'not relevant to this instance type'.

sub seek () { die "inherited method not callable or implemented on this type of obje +ct"; }
  • Comment on Re^4: $io->can('seek') == true, but $io->seek(pos, whence) == 'Illegal seek' - bug ?
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://407831]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-16 16:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found