Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: bullet proof SLURP file

by karlgoethebier (Abbot)
on Jan 09, 2018 at 21:14 UTC ( [id://1207016]=note: print w/replies, xml ) Need Help??


in reply to bullet proof SLURP file

Shouldn't something like this catch them all?

#!/usr/bin/env perl use strict; use warnings; use Path::Tiny; use Try::Tiny; use autodie qw(:all); use feature qw(say); my $file = shift; try { say path($file)->slurp_utf8; } catch { print $_; }; __END__

I'm not sure. And even worse: I have no idea for the moment/in a hurry how to test it.

Best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Replies are listed 'Best First'.
Re^2: bullet proof SLURP file
by haukex (Archbishop) on Jan 09, 2018 at 21:53 UTC
    Shouldn't something like this catch them all?

    Doesn't look like it, sorry :-( A look at the Path::Tiny source shows it seems to do no error checking on the reads at all.

      Too bad ;-[. And i need a while to digest the code you provided.

      Thanks and best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

      perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1207016]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-25 14:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found