Code Monkey home page Code Monkey logo

Comments (8)

brunoV avatar brunoV commented on August 24, 2024

+1 for Path::Class

from perl5i.

ewilhelm avatar ewilhelm commented on August 24, 2024

File::Fu?

from perl5i.

schwern avatar schwern commented on August 24, 2024

Easier, Eric, not more bizarre. :P

from perl5i.

schwern avatar schwern commented on August 24, 2024

Here's another way to look at this. I don't ever want to have to load a small legion of file modules just to do things I can do easily in shell. File::Copy, File::Basename, File::Find, File::Path, Shell::Command, IPC::Run off the top of my head.

from perl5i.

ewilhelm avatar ewilhelm commented on August 24, 2024

Let's say we turn off the "bizarre operators floating around wherever" and put the guts of the thing in Path::Fu, with a sub fu (&) {...} to enable the operator fu.

use Path::Fu;
my $file = fu {dir("something") / "subdir" + "filename.txt"};

is the same as:
my $file = dir("something")->subdir("subdir")->file("filename.txt");

And then you can get on to the important part of being able to do

my $libs = [Path::Fu->which("dpkg")->run("-L", "libxml2")->getlines]
  ->grep(λ{m{^/usr/lib/}})->map(λ{file($_)});

and such.

from perl5i.

spacebat avatar spacebat commented on August 24, 2024

I recently watched the 2010 OSDC talk on perl5i, and there's a bunch of examples along the lines of
$path_string->file->readline(func ($line) { print $line });

Are we any closer to this and is there a branch where this work left off that I should tinker with?
Cheers

from perl5i.

schwern avatar schwern commented on August 24, 2024

I started a project for that two years ago called Paths for the Grand Unified All In Wonder File And Directory Handling Module. There's a little code and a whole bunch of notes.
https://github.com/schwern/Paths/blob/master/NOTES

I've given you a commit bit on Paths. Please dust things off and go!

from perl5i.

schwern avatar schwern commented on August 24, 2024

The incorporation of Path::Tiny covers this nicely.

from perl5i.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.