in reply to Getting filename from IO::File object
To my knowledge, the IO::File module has no method for retrieving the filename of a IO::File object, so no luck there.
Then you have to think about how to extend the _write_graph object with backwards compatibility. I suggest adding an optional parameter. When this parameter is not set, just use the original code. If it is set, switch to your new code (which can then use the new parameter).