Skip Menu |

This queue is for tickets about the IO CPAN distribution.

Report information
The Basics
Id: 65836
Status: resolved
Priority: 0/
Queue: IO

People
Owner: Nobody in particular
Requestors: michael.jemmeson [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: (no value)



Subject: Change 'new Object()' syntax to Object->new() in POD synopses
The Synopses for IO::File, IO::Handle, IO::Pipe and IO::Poll all have outdated construction syntax in the POD Synopses
Please see if this patch helps. Show quoted text
> The Synopses for IO::File, IO::Handle, IO::Pipe and IO::Poll all have > outdated construction syntax in the POD Synopses
Subject: bug65836.patch
diff --git a/dist/IO/lib/IO/Dir.pm b/dist/IO/lib/IO/Dir.pm index cce392c..32da24c 100644 --- a/dist/IO/lib/IO/Dir.pm +++ b/dist/IO/lib/IO/Dir.pm @@ -26,7 +26,7 @@ $VERSION = eval $VERSION; sub DIR_UNLINK () { 1 } sub new { - @_ >= 1 && @_ <= 2 or croak 'usage: new IO::Dir [DIRNAME]'; + @_ >= 1 && @_ <= 2 or croak 'usage: IO::Dir->new([DIRNAME])'; my $class = shift; my $dh = gensym; if (@_) { diff --git a/dist/IO/lib/IO/File.pm b/dist/IO/lib/IO/File.pm index d33d090..efa0360 100644 --- a/dist/IO/lib/IO/File.pm +++ b/dist/IO/lib/IO/File.pm @@ -10,25 +10,25 @@ IO::File - supply object methods for filehandles use IO::File; - $fh = new IO::File; + $fh = IO::File->new(); if ($fh->open("< file")) { print <$fh>; $fh->close; } - $fh = new IO::File "> file"; + $fh = IO::File->new("> file"); if (defined $fh) { print $fh "bar\n"; $fh->close; } - $fh = new IO::File "file", "r"; + $fh = IO::File->new("file", "r"); if (defined $fh) { print <$fh>; undef $fh; # automatically closes the file } - $fh = new IO::File "file", O_WRONLY|O_APPEND; + $fh = IO::File->new("file", O_WRONLY|O_APPEND); if (defined $fh) { print $fh "corge\n"; @@ -157,7 +157,7 @@ sub new { my $type = shift; my $class = ref($type) || $type || "IO::File"; @_ >= 0 && @_ <= 3 - or croak "usage: new $class [FILENAME [,MODE [,PERMS]]]"; + or croak "usage: $class->new([FILENAME [,MODE [,PERMS]]])"; my $fh = $class->SUPER::new(); if (@_) { $fh->open(@_) diff --git a/dist/IO/lib/IO/Handle.pm b/dist/IO/lib/IO/Handle.pm index f4114ad..3836843 100644 --- a/dist/IO/lib/IO/Handle.pm +++ b/dist/IO/lib/IO/Handle.pm @@ -8,13 +8,13 @@ IO::Handle - supply object methods for I/O handles use IO::Handle; - $io = new IO::Handle; + $io = IO::Handle->new(); if ($io->fdopen(fileno(STDIN),"r")) { print $io->getline; $io->close; } - $io = new IO::Handle; + $io = IO::Handle->new(); if ($io->fdopen(fileno(STDOUT),"w")) { $io->print("Some text\n"); } @@ -309,14 +309,14 @@ $VERSION = eval $VERSION; sub new { my $class = ref($_[0]) || $_[0] || "IO::Handle"; - @_ == 1 or croak "usage: new $class"; + @_ == 1 or croak "usage: $class->new()"; my $io = gensym; bless $io, $class; } sub new_from_fd { my $class = ref($_[0]) || $_[0] || "IO::Handle"; - @_ == 3 or croak "usage: new_from_fd $class FD, MODE"; + @_ == 3 or croak "usage: $class->new_from_fd(FD, MODE)"; my $io = gensym; shift; IO::Handle::fdopen($io, @_) diff --git a/dist/IO/lib/IO/Pipe.pm b/dist/IO/lib/IO/Pipe.pm index 827cc48..0a913f9 100644 --- a/dist/IO/lib/IO/Pipe.pm +++ b/dist/IO/lib/IO/Pipe.pm @@ -19,7 +19,7 @@ $VERSION = "1.13"; sub new { my $type = shift; my $class = ref($type) || $type || "IO::Pipe"; - @_ == 0 || @_ == 2 or croak "usage: new $class [READFH, WRITEFH]"; + @_ == 0 || @_ == 2 or croak "usage: $class->([READFH, WRITEFH])"; my $me = bless gensym(), $class; @@ -166,7 +166,7 @@ IO::Pipe - supply object methods for pipes use IO::Pipe; - $pipe = new IO::Pipe; + $pipe = IO::Pipe->new(); if($pid = fork()) { # Parent $pipe->reader(); @@ -184,7 +184,7 @@ IO::Pipe - supply object methods for pipes or - $pipe = new IO::Pipe; + $pipe = IO::Pipe->new(); $pipe->reader(qw(ls -l)); diff --git a/dist/IO/lib/IO/Poll.pm b/dist/IO/lib/IO/Poll.pm index e7fb013..d442526 100644 --- a/dist/IO/lib/IO/Poll.pm +++ b/dist/IO/lib/IO/Poll.pm @@ -140,7 +140,7 @@ IO::Poll - Object interface to system poll call use IO::Poll qw(POLLRDNORM POLLWRNORM POLLIN POLLHUP); - $poll = new IO::Poll; + $poll = IO::Poll->new(); $poll->mask($input_handle => POLLIN); $poll->mask($output_handle => POLLOUT); diff --git a/dist/IO/lib/IO/Select.pm b/dist/IO/lib/IO/Select.pm index c9da8d4..97fafcf 100644 --- a/dist/IO/lib/IO/Select.pm +++ b/dist/IO/lib/IO/Select.pm @@ -352,8 +352,8 @@ listening for more connections on a listen socket use IO::Select; use IO::Socket; - $lsn = new IO::Socket::INET(Listen => 1, LocalPort => 8080); - $sel = new IO::Select( $lsn ); + $lsn = IO::Socket::INET->new(Listen => 1, LocalPort => 8080); + $sel = IO::Select->new( $lsn ); while(@ready = $sel->can_read) { foreach $fh (@ready) {
Ticket migrated to github as https://github.com/toddr/IO/issues/41