in reply to Re: Wrong idioms
in thread Wrong idioms
the problem with that is undef opens a temporary file
:) its http://search.cpan.org/perldoc/Dancer::FileUtils#read_file_content
sub open_file { my ( $mode, $filename ) = @_; open my $fh, $mode, $filename or raise core_fileutils => "$! while opening '$filename' using m +ode '$mode'"; return set_file_mode($fh); } sub read_file_content { my $file = shift or return; my $fh = open_file( '<', $file ); return wantarray ? read_glob_content($fh) : scalar read_glob_content($fh); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Wrong idioms (open $fh, '<', undef)
by BrowserUk (Patriarch) on Mar 30, 2013 at 01:57 UTC | |
by Anonymous Monk on Mar 30, 2013 at 02:39 UTC | |
by BrowserUk (Patriarch) on Mar 30, 2013 at 02:45 UTC | |
by Anonymous Monk on Mar 30, 2013 at 02:46 UTC | |
by BrowserUk (Patriarch) on Mar 30, 2013 at 04:53 UTC | |
| |
Re^3: Wrong idioms (open $fh, '<', undef)
by vsespb (Chaplain) on Mar 30, 2013 at 00:38 UTC | |
by Anonymous Monk on Mar 30, 2013 at 02:40 UTC | |
by vsespb (Chaplain) on Mar 30, 2013 at 09:04 UTC | |
by Anonymous Monk on Apr 02, 2013 at 08:38 UTC | |
by vsespb (Chaplain) on Apr 02, 2013 at 09:47 UTC | |
|
In Section
Seekers of Perl Wisdom