[libio-all-perl] 06/14: Basics of a File plugin
Axel Beckert
abe at deuxchevaux.org
Sun Apr 26 22:25:27 UTC 2015
This is an automated email from the git hooks/post-receive script.
abe pushed a commit to tag alt-io-all-new-0.00
in repository libio-all-perl.
commit 591eb475f9861cdbaab77b6b07f3586426927334
Author: Ingy döt Net <ingy at ingy.net>
Date: Mon Jul 16 00:49:59 2012 -0700
Basics of a File plugin
---
lib/IO/All/File.pm | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/lib/IO/All/File.pm b/lib/IO/All/File.pm
new file mode 100644
index 0000000..2fe0288
--- /dev/null
+++ b/lib/IO/All/File.pm
@@ -0,0 +1,37 @@
+##
+# name: IO::All
+# author: Ingy döt Net
+# abstract: File Plugin For IO::All
+# license: perl
+# copyright: 2004, 2006, 2008, 2010, 2012
+
+package IO::All::File;
+use IO::All::OO;
+extends 'IO::All::Plugin';
+
+sub io_upgrade {
+ my ($self) = @_;
+ $self->file if
+ defined $self->name and
+ -e $self->name;
+}
+
+use constant io_methods => [qw(file print)];
+
+use constant io_overloads => {
+ 'file > file' => 'overload_file_to_file',
+ 'file < file' => 'overload_file_from_file',
+ '${} file' => 'overload_file_as_scalar',
+ '@{} file' => 'overload_file_as_array',
+ '%{} file' => 'overload_file_as_dbm',
+};
+
+sub file {
+ my $self = shift;
+ bless $self, __PACKAGE__;
+ $self->name(shift) if @_;
+ return $self;
+ return $self->_init;
+}
+
+1;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libio-all-perl.git
More information about the Pkg-perl-cvs-commits
mailing list