GSoC/GCI Archive
Google Code-in 2010 Parrot Foundation and The Perl Foundation

Add an is_closed method to all Handle types

completed by: Fernando Brito

mentors: whiteknight

Task Description: Parrot's IO system is broken into a number of PMC types, all of which derive from the abstract type Handle. All of these PMCs should offer a minimal common interface, though each type is free to offer additional methods and functionalities specific to it's type. One method which should be common but is not shared is the is_closed() method.

FileHandle and StringHandle provide this method. Socket does not.

Steps to complete:

  1. Create a fork of the parrot/parrot repository on github
  2. Add a new is_closed method to src/pmc/socket.pmc. You can follow the examples in src/pmc/filehandle.pmc and src/pmc/stringhandle.pmc. The function VTABLE_get_bool(INTERP, SELF) will probably return the value you need
  3. Add a test for the new method in t/pmc/socket.t
  4. Build Parrot and run all tests (make fulltest) to see that they pass
  5. Open a pull request on Github to have your changes merged into the parrot repository

Links: http://github.com/parrot/parrot, https://github.com/parrot/parrot/blob/master/src/pmc/socket.pmc