On Mon, Dec 15, 2008 at 6:42 PM, jason switzer <jswit...@gmail.com> wrote: > It's lazy and kinda cheating, but for small simple tasks, it gets the job > done. I'm not up to speed with the IO spec, but a sort of auto-slurp > functionality would be nice. Something to the effect: > > @data = :slurp("mydatafile.txt");
A slurp() function has been specced to slurp a file into a string, as well as a lines() function that does the same into an array of lines. > I think File::Path::canonpath and File::Path::path would be > nice attributes to add to the File role. You didn't get the point of my Roles idea. It should not be added to a role File, but to the Role Nameable, which would be composed into whatever implements file filehandles, but for example also into Unix sockets. IMNSHO interfaces and implementation should be kept separate to maintain a proper abstraction level. > I would imagine a filter role would be useful. If they're roles, it allows > people to build layers of functionality on them to do various different > kinds of filters, turn them on and off, etc. With filters as roles, I would > love to imagine something like this: > > my File $fstab = new(:name</etc/fstab>, :filter<new WhitespaceTrim>) > You can already easily mix it in using 'does': $fstab = open('/etc/fstab', :r); $fstab does WhitespaceTrim; I don't think it's really necessary to include that into open(), though it might be useful syntactic sugar. Regards, Leon Timmermans