Permalink
Browse files

Got rid of trailing space.

  • Loading branch information...
1 parent e42378a commit 2d881b443d539063b97a8a7b71203ca6ddb59ea7 @shlomif shlomif committed Sep 15, 2010
View
@@ -87,7 +87,7 @@ IO::All - IO::All of it to Graham and Damian!
"Thank you!" > $connection; # Thank the caller
$connection->close; # Hang up
io(':6666')->accept->slurp > io->devnull; # Take a complaint and file it
-
+
# DBM database operations:
$dbm = io 'my/database'; # Create a database object
print $dbm->{grocery_list}; # Hash context makes it a DBM
@@ -102,7 +102,7 @@ IO::All - IO::All of it to Graham and Damian!
@$io = reverse @$io; # Reverse lines in a file
# Stat functions:
- printf "%s %s %s\n", # Print name, uid and size of
+ printf "%s %s %s\n", # Print name, uid and size of
$_->name, $_->uid, $_->size # contents of current directory
for io('.')->all;
print "$_\n" for sort # Use mtime method to sort all
@@ -111,10 +111,10 @@ IO::All - IO::All of it to Graham and Damian!
# File::Spec support:
$contents < io->catfile(qw(dir file.txt)); # Portable IO operation
-
+
# Miscellaneous:
@lines = io('file.txt')->chomp->slurp; # Chomp as you slurp
- @chunks =
+ @chunks =
io('file.txt')->separator('xxx')->slurp; # Use alternnate record sep
$binary = io('file.bin')->binary->all; # Read a binary file
io('a-symlink')->readlink->slurp; # Readlink returns an object
@@ -141,7 +141,7 @@ IO::String, Tie::File, File::Spec, File::Path and File::ReadBackwards;
as well as all the DBM and MLDBM modules. You can use most of the
methods found in these classes and in IO::Handle (which they inherit
from). IO::All adds dozens of other helpful idiomatic methods
-including file stat and manipulation functions.
+including file stat and manipulation functions.
IO::All is pluggable, and modules like L<IO::All::LWP> and L<IO::All::Mailto>
add even more functionality. Optionally, every IO::All object can be
@@ -360,7 +360,7 @@ chain the calls.
NOTE: This operation requires that you have the L<File::ReadBackwards>
module installed.
-
+
=head2 Client/Server Sockets
IO::All makes it really easy to write a forking socket server and a
@@ -402,7 +402,7 @@ dynamic pages:
There is are a lot of subtle things going on here. First we accept a socket
and fork the server. Then we overload the new socket as a code ref. This code
-ref takes one argument, another code ref, which is used as a callback.
+ref takes one argument, another code ref, which is used as a callback.
The callback is called once for every line read on the socket. The line
is put into C<$_> and the socket itself is passed in to the callback.
@@ -414,7 +414,7 @@ we create a piped command as our IO::All object. This somewhat approximates
CGI support.
Whatever the resulting object is, we direct the contents back at our socket
-which is in C<$_[0]>. Pretty simple, eh?
+which is in C<$_[0]>. Pretty simple, eh?
=head2 DBM Files
@@ -452,20 +452,20 @@ then pass control to the real C<open>.
First the code using the module:
use IO::Dumper;
-
+
io('./mydump')->dump($hash);
And next the IO::Dumper module itself:
package IO::Dumper;
use IO::All -base;
use Data::Dumper;
-
+
sub dump {
my $self = shift;
Dumper(@_) > $self;
}
-
+
1;
=head2 Inline Subclassing
@@ -477,11 +477,11 @@ method manually.
IO::Dumper->import;
io('./mydump')->dump($hash);
-
+
package IO::Dumper;
use IO::All -base;
use Data::Dumper;
-
+
sub dump {
my $self = shift;
Dumper(@_) > $self;
@@ -509,7 +509,7 @@ attributes are copied from the instance object.
io(file-descriptor);
IO::All->new(file-descriptor);
$io->new(file-descriptor);
-
+
All three forms take a single argument, a file descriptor. A file
descriptor can be any of the following:
@@ -600,7 +600,7 @@ serialization module. The first DBM module that is available is used to
process the MLDBM file. The serialization module can be Data::Dumper,
Storable or FreezeThaw.
- io('mymldbm')->mldbm('GDBM_File', 'Storable')->{author} =
+ io('mymldbm')->mldbm('GDBM_File', 'Storable')->{author} =
{nickname => 'ingy'};
=item * string
@@ -973,7 +973,7 @@ Read all contents into a single string.
=item * all (For directories)
Returns a list of IO::All objects for all files and subdirectories in a
-directory.
+directory.
'.' and '..' are excluded.
@@ -1569,7 +1569,7 @@ To keep input objects from closing at EOF, do this:
$io->autoclose(0);
-=item *
+=item *
You can always call C<open> and C<close> explicitly, if you need that
level of control. To test if an object is currently open, use the
View
@@ -19,7 +19,7 @@ sub import {
else {
my @flags = @_;
for my $export (@{$class . '::EXPORT'}) {
- *{$package . "::$export"} = $export eq 'io'
+ *{$package . "::$export"} = $export eq 'io'
? $class->generate_constructor(@flags)
: \&{$class . "::$export"};
}
@@ -99,9 +99,9 @@ sub field {
sub {
my $self = shift;
unless (exists *$self->{$field}) {
- *$self->{$field} =
+ *$self->{$field} =
ref($default) eq 'ARRAY' ? [] :
- ref($default) eq 'HASH' ? {} :
+ ref($default) eq 'HASH' ? {} :
$default;
}
return *$self->{$field} unless @_;
@@ -143,7 +143,7 @@ sub proxy_open {
$self->error_check;
wantarray ? @return : $return[0];
};
- *{"$package\::$proxy"} =
+ *{"$package\::$proxy"} =
(@args and $args[0] eq '>') ?
sub {
my $self = shift;
View
@@ -17,7 +17,7 @@ sub dbm {
sub assert_open {
my $self = shift;
- return $self->tied_file
+ return $self->tied_file
if $self->tied_file;
$self->open;
}
@@ -56,7 +56,7 @@ sub open {
$self->_dbm_class->import;
my $type = eval '$DB_HASH'; die $@ if $@;
# XXX Not sure about this warning
- warn "Using DB_File::Lock in IO::All without the rdonly or rdwr method\n"
+ warn "Using DB_File::Lock in IO::All without the rdonly or rdwr method\n"
if not ($self->_rdwr or $self->_rdonly);
my $flag = $self->_rdwr ? 'write' : 'read';
$mode = $self->_rdwr ? O_RDWR : O_RDONLY;
@@ -72,7 +72,7 @@ sub tie_dbm {
my $self = shift;
my $hash;
my $filename = $self->name;
- my $db = tie %$hash, $self->_dbm_class, $filename, $self->mode, $self->perms,
+ my $db = tie %$hash, $self->_dbm_class, $filename, $self->mode, $self->perms,
@{$self->_dbm_extra}
or $self->throw("Can't open '$filename' as DBM file:\n$!");
$self->add_utf8_dbm_filter($db)
@@ -91,7 +91,7 @@ sub add_utf8_dbm_filter {
=encoding utf8
-=head1 NAME
+=head1 NAME
IO::All::DBM - DBM Support for IO::All
View
@@ -120,7 +120,7 @@ sub empty {
opendir($dh, $self->pathname) or die;
while (my $dir = readdir($dh)) {
return 0 unless $dir =~ /^\.{1,2}$/;
- }
+ }
return 1;
}
@@ -153,13 +153,13 @@ sub readdir {
my $self = shift;
$self->assert_open;
if (wantarray) {
- my @return = grep {
- not /^\.{1,2}$/
+ my @return = grep {
+ not /^\.{1,2}$/
} $self->io_handle->read;
$self->close;
return @return;
}
- my $name = '.';
+ my $name = '.';
while ($name =~ /^\.{1,2}$/) {
$name = $self->io_handle->read;
unless (defined $name) {
@@ -201,17 +201,17 @@ sub overload_as_array {
}
sub overload_as_hash {
- +{
+ +{
map {
(my $name = $_->pathname) =~ s/.*[\/\\]//;
($name, $_);
- } $_[1]->all
+ } $_[1]->all
};
}
=encoding utf8
-=head1 NAME
+=head1 NAME
IO::All::Dir - Directory Support for IO::All
View
@@ -56,7 +56,7 @@ sub assert_tied_file {
my $self = shift;
return $self->tied_file || do {
eval {require Tie::File};
- $self->throw("Tie::File required for file array operations:\n$@")
+ $self->throw("Tie::File required for file array operations:\n$@")
if $@;
my $array_ref = do { my @array; \@array };
my $name = $self->pathname;
@@ -81,7 +81,7 @@ sub open {
push @args, $self->perms if defined $self->perms;
if (defined $self->pathname) {
$self->io_handle(IO::File->new);
- $self->io_handle->open($self->pathname, @args)
+ $self->io_handle->open($self->pathname, @args)
or $self->throw($self->open_msg);
}
elsif (defined $self->_handle and
@@ -242,7 +242,7 @@ sub overload_file_as_scalar {
=encoding utf8
-=head1 NAME
+=head1 NAME
IO::All::File - File Support for IO::All
View
@@ -24,7 +24,7 @@ sub filename {
sub is_absolute {
my $self = shift;
return *$self->{is_absolute} = shift if @_;
- return *$self->{is_absolute}
+ return *$self->{is_absolute}
if defined *$self->{is_absolute};
*$self->{is_absolute} = IO::All::is_absolute($self) ? 1 : 0;
}
@@ -102,7 +102,7 @@ sub utime {
=encoding utf8
-=head1 NAME
+=head1 NAME
IO::All::Filesys - File System Methods Mixin for IO::All
View
@@ -55,7 +55,7 @@ sub target {
=encoding utf8
-=head1 NAME
+=head1 NAME
IO::All::Link - Symbolic Link Support for IO::All
View
@@ -7,7 +7,7 @@ field _serializer => 'Data::Dumper';
sub mldbm {
my $self = shift;
- bless $self, __PACKAGE__;
+ bless $self, __PACKAGE__;
my ($serializer) = grep { /^(Storable|Data::Dumper|FreezeThaw)$/ } @_;
$self->_serializer($serializer) if defined $serializer;
my @dbm_list = grep { not /^(Storable|Data::Dumper|FreezeThaw)$/ } @_;
@@ -23,7 +23,7 @@ sub tie_dbm {
eval "use MLDBM qw($dbm_class $serializer)";
$self->throw("Can't open '$filename' as MLDBM:\n$@") if $@;
my $hash;
- my $db = tie %$hash, 'MLDBM', $filename, $self->mode, $self->perms,
+ my $db = tie %$hash, 'MLDBM', $filename, $self->mode, $self->perms,
@{$self->_dbm_extra}
or $self->throw("Can't open '$filename' as MLDBM file:\n$!");
$self->add_utf8_dbm_filter($db)
@@ -33,7 +33,7 @@ sub tie_dbm {
=encoding utf8
-=head1 NAME
+=head1 NAME
IO::All::MLDBM - MLDBM Support for IO::All
View
@@ -29,7 +29,7 @@ sub open {
my $command = $self->name;
$command =~ s/(^\||\|$)//;
my $mode = shift || $self->mode || '<';
- my $pipe_mode =
+ my $pipe_mode =
$mode eq '>' ? '|-' :
$mode eq '<' ? '-|' :
$self->throw("Invalid usage mode '$mode' for pipe");
@@ -55,7 +55,7 @@ sub open_msg {
=encoding utf8
-=head1 NAME
+=head1 NAME
IO::All::Pipe - Pipe Support for IO::All
View
@@ -53,7 +53,7 @@ sub open_stderr {
=encoding utf8
-=head1 NAME
+=head1 NAME
IO::All::STDIO - STDIO Support for IO::All
View
@@ -38,7 +38,7 @@ sub accept {
$self->_listen(1);
$self->assert_open;
my $server = $self->io_handle;
- my $socket;
+ my $socket;
while (1) {
$socket = $server->accept;
last unless $self->_fork;
@@ -141,7 +141,7 @@ sub overload_any_to_any {
=encoding utf8
-=head1 NAME
+=head1 NAME
IO::All::Socket - Socket Support for IO::All
View
@@ -22,7 +22,7 @@ sub open {
=encoding utf8
-=head1 NAME
+=head1 NAME
IO::All::String - String IO Support for IO::All
View
@@ -17,7 +17,7 @@ sub temp {
=encoding utf8
-=head1 NAME
+=head1 NAME
IO::All::Temp - Temporary File Support for IO::All
Oops, something went wrong.

0 comments on commit 2d881b4

Please sign in to comment.