Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

move copy from IO::Handle to IO::Path, deprecate IO::Handle version

  • Loading branch information...
commit f737ff7bb095f81ef1c28664fe77b72979436766 1 parent 57e740a
Brent Laabs labster authored

Showing 1 changed file with 12 additions and 0 deletions. Show diff stats Hide diff stats

  1. +12 0 src/core/IO.pm
12 src/core/IO.pm
@@ -254,6 +254,7 @@ my class IO::Handle does IO::FileTestable {
254 254
255 255 # not spec'd
256 256 method copy($dest) {
  257 + warn "IO::Handle.copy is deprecated. Please use IO::Path.copy instead.";
257 258 try {
258 259 nqp::copy(nqp::unbox_s(~$!path), nqp::unbox_s(~$dest));
259 260 }
@@ -399,6 +400,17 @@ my class IO::Path is Cool does IO::FileTestable {
399 400 $childname);
400 401 }
401 402
  403 + method copy($dest, :$createonly = False) {
  404 + if $createonly and $dest.path.e {
  405 + fail(X::IO::Copy.new(from => $.Str, to => $dest,
  406 + os-error => "Destination file $dest exists and :createonly passed to copy."));
  407 + }
  408 + try {
  409 + nqp::copy(nqp::unbox_s($.Str), nqp::unbox_s(~$dest));
  410 + }
  411 + $! ?? fail(X::IO::Copy.new(from => $.Str, to => $dest, os-error => ~$!)) !! True
  412 + }
  413 +
402 414 }
403 415
404 416 my class IO::Path::Unix is IO::Path { method SPEC { IO::Spec::Unix }; }

0 comments on commit f737ff7

Please sign in to comment.
Something went wrong with that request. Please try again.