home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
zkuste
/
Perl
/
ActivePerl-5.6.0.613.msi
/
䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥
/
_36028d79f75d4cffafeb5907ae7a80d7
< prev
next >
Wrap
Text File
|
2000-03-23
|
4KB
|
117 lines
<HTML>
<HEAD>
<TITLE>File::Copy - Copy files or filehandles</TITLE>
<LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
<LINK REV="made" HREF="mailto:">
</HEAD>
<BODY>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> File::Copy - Copy files or filehandles</P></STRONG>
</TD></TR>
</TABLE>
<A NAME="__index__"></A>
<!-- INDEX BEGIN -->
<UL>
<LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
<LI><A HREF="#usage">USAGE</A></LI>
<LI><A HREF="#description">DESCRIPTION</A></LI>
<UL>
<LI><A HREF="#copy">copy</A></LI>
<LI><A HREF="#copydir">copydir</A></LI>
</UL>
<LI><A HREF="#see also">SEE ALSO</A></LI>
<LI><A HREF="#author">AUTHOR</A></LI>
</UL>
<!-- INDEX END -->
<HR>
<P>
<H1><A NAME="name">NAME</A></H1>
<P>File::Copy - Copy files or filehandles</P>
<P>
<HR>
<H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
<UL>
<LI>Linux</LI>
<LI>Solaris</LI>
<LI>Windows</LI>
</UL>
<HR>
<H1><A NAME="usage">USAGE</A></H1>
<PRE>
use File::Copy;</PRE>
<PRE>
copy("file1","file2");
copy("Copy.pm",\*STDOUT);'</PRE>
<PRE>
use POSIX;
use File::Copy cp;</PRE>
<PRE>
$n=FileHandle->new("/dev/null","r");
cp($n,"x");'</PRE>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P>The Copy module provides two functions (copy and copydir)</P>
<P>
<H2><A NAME="copy">copy</A></H2>
<P>The copy function takes two
parameters: a file to copy from and a file to copy to. Either
argument may be a string, a FileHandle reference or a FileHandle
glob. Obviously, if the first argument is a filehandle of some
sort, it will be read from, and if it is a file <EM>name</EM> it will
be opened for reading. Likewise, the second argument will be
written to (and created if need be). If the first argument is
the name of a directory, this function simply calls copydir.</P>
<P>An optional third parameter can be used to specify the buffer
size used for copying. This is the number of bytes from the
first file, that wil be held in memory at any given time, before
being written to the second file. The default buffer size depends
upon the file, but will generally be the whole file (up to 2Mb), or
1k for filehandles that do not reference files (eg. sockets).</P>
<P>You may use the syntax <CODE>use File::Copy "cp"</CODE> to get at the
``cp'' alias for this function. The syntax is <EM>exactly</EM> the same.</P>
<P>Return value:</P>
<P>Returns 1 on success, 0 on failure. $! will be set if an error was
encountered.</P>
<P>
<H2><A NAME="copydir">copydir</A></H2>
<P>copydir takes two directory names. If the second directory does
not exist, it will be created. If it does exist, a directory will
be created in it to copy to. Copydir copies every file and directory
from the source directory (first parameter) to the destination
directory (second parameter). The structure of the source directory
will be preserved, and warnings will be issued if a particular file
or directory cannot be accessed or created.</P>
<P>Return value:</P>
<P>copydir returns true on success and false on failure, though failure
to copy a single file or directory from the source tree may still
result in ``success''. The return value simply indicates whether or not
<EM>anything</EM> was done.</P>
<P>
<HR>
<H1><A NAME="see also">SEE ALSO</A></H1>
<P><A HREF="../../../site/lib/File/Tools.html">the File::Tools manpage</A></P>
<P>
<HR>
<H1><A NAME="author">AUTHOR</A></H1>
<P>File::Copy was written by Aaron Sherman <<A HREF="mailto:ajs@ajs.com">ajs@ajs.com</A>> in 1995.</P>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> File::Copy - Copy files or filehandles</P></STRONG>
</TD></TR>
</TABLE>
</BODY>
</HTML>