I don't know much about Graph::Writer, but getting a filename from a filehandle (or filedescriptor) is quite a thorny issue that cannot be solved in a platform independent way. If Graph::Writer supplies methods for opening files, your best bet is to also subclass that method and store the filename in the object.
-derby