-
-
24 May 2021 11:36:26 UTC
- Distribution: FunctionalPerl
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (0)
- Testers (69 / 1 / 0)
- Kwalitee
Bus factor: 1- License: perl_5
- Perl: v5.16.4
- Activity
24 month- Tools
- Download (443.46KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors-
Christian Jaeger
- Dependencies
- Digest
- File::Path
- Getopt::Long
- Import::Into
- Math::BigInt
- NEXT
- PerlIO::utf8_strict
- Safe::Isa
- Scalar::Util
- Symbol
- Test::More
- autobox
- base
- overload
- utf8
- warnings
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Chj::xopen
SYNOPSIS
use Chj::xopen; { my $in = xopen_read "foo.txt"; my $out = glob_to_fh(*STDOUT,"utf-8"); local $_; while (<$in>) { # default operation. (overload not possible :/) $out->xprint($_); # print, throwing an exception on error } $out->xclose; # close explicitely, throwing an exception on error } # $in and $out are closed automatically in any case # (issuing a warning on error)
DESCRIPTION
Constructors around Chj::IO::File.
FUNCTIONS
- xopen ( EXPR | MODE,LIST )
-
Open the given file like the perl builtin "open" or croak on errors. Returns an anonymous symbol blessed into Chj::xopen::file, which can be used both as object or filehandle (more correctly: anonymous glob) (? always? Perl is a bit complicated when handling filehandles in indirect object notation).
(BTW, note that perl won't give an error if you open a directory instead of a file for reading. The returned filehandle will give empty results if either used with read or readdir. That's true for perl 5.005x - 5.6.1 on linux.)
- xopen_read EXPR
- xopen_write EXPR
- xopen_append EXPR
- xopen_update EXPR
-
Those *optionally exported* functions check the one given input parameter for <>+ chars at the beginning, and either croak if they don't match the purpose of the function, or prepend the right chars if missing.
BUGS
Stuff like >&1 not yet really supported by the above xopen_* functions.
SEE ALSO
Chj::IO::File, Chj::xsysopen, Chj::xopendir
NOTE
This is alpha software! Read the status section in the package README or on the website.
Module Install Instructions
To install FunctionalPerl, copy and paste the appropriate command in to your terminal.
cpanm FunctionalPerl
perl -MCPAN -e shell install FunctionalPerl
For more information on module installation, please visit the detailed CPAN module installation guide.