- Strona pocz±tkowa
- Atras Anna Zanim rodzina cię wykończy i zanim ty wykończysz rodzinę [PL] [pdf]
- Mario Acevedo [Felix Gomez 02] X Rated Blood Suckers (v5.0) (pdf)
- Caitlin Ricci [Nichols Sisters 02] Give Me Fever [eXtasy] (pdf)
- Ian Rankin [Jack Harvey 01] Witch Hunt (v4.0) (pdf)
- Alan Burt Akers [Dray Prescot 21] A Fortune for Kregen (pdf)
- Anne Weale Lost Lagoon [HP 1085, MB 2787] (pdf)
- Ian Rankin [Jack Harvey 02] Bleeding Hearts (v4.0) (pdf)
- Banned Books Dawn B Sova Literature Suppressed on Sexual Grounds (pdf)
- Anna Leigh Keaton [Serve & Protect 01] Five Alarm Neighbor (pdf)
- Aubrey Ross [Alpha Colony 04] Uninhibited Fire (pdf)
- zanotowane.pl
- doc.pisz.pl
- pdf.pisz.pl
- ninue.xlx.pl
[ Pobierz całość w formacie PDF ]
should match the mode of the original filehandle. Here is a script that saves, redirects, and restores
STDOUT and STDERR:
#!/usr/bin/perl
open(SAVEOUT, ">&STDOUT");
open(SAVEERR, ">&STDERR");
open(STDOUT, ">foo.out") || die "Can t redirect stdout";
open(STDERR, ">&STDOUT") || die "Can t dup stdout";
select(STDERR); $| = 1; # make unbuffered
select(STDOUT); $| = 1; # make unbuffered
print STDOUT "stdout 1\n"; # this works for
print STDERR "stderr 1\n"; # subprocesses too
close(STDOUT);
close(STDERR);
open(STDOUT, ">&SAVEOUT");
open(STDERR, ">&SAVEERR");
print STDOUT "stdout 2\n";
print STDERR "stderr 2\n";
If you open a pipe on the command "-", i.e. either "|-" or "-|", then there is an implicit fork done,
and the return value of open is the pid of the child within the parent process, and 0 within the child
process. (Use defined($pid) to determine if the open was successful.) The filehandle behaves
normally for the parent, but i/o to that filehandle is piped from/to the STDOUT/ STDIN of the
child process. In the child process the filehandle isn t opened--i/o happens from/to the new
STDOUT or STDIN. Typically this is used like the normal piped open when you want to exercise
more control over just how the pipe command gets executed, such as when you are running setuid,
and don t want to have to scan shell commands for metacharacters. The following pairs are more
or less equivalent:
open(FOO, "|tr [a-z] [A-Z] ");
open(FOO, "|-") || exec tr , [a-z] , [A-Z] ;
open(FOO, "cat -n $file |");
open(FOO, "-|") || exec cat , -n , $file;
Explicitly closing any piped filehandle causes the parent process to wait for the child to finish, and
returns the status value in $?. Note: on any operation which may do a fork, unflushed buffers
remain unflushed in both processes, which means you may need to set $| to avoid duplicate output.
The filename that is passed to open will have leading and trailing whitespace deleted. In order to
open a file with arbitrary weird characters in it, it s necessary to protect any leading and trailing
whitespace thusly:
$file =~s#^(\s)#./$1#;
open(FOO, "
pipe(READHANDLE,WRITEHANDLE)
Opens a pair of connected pipes like the corresponding system call. Note that if you set up a loop
of piped processes, deadlock can occur unless you are very careful. In addition, note that perl s
pipes use stdio buffering, so you may need to set $| to flush your WRITEHANDLE after each
command, depending on the application. [Requires version 3.0 patchlevel 9.]
print(FILEHANDLE LIST)
print(LIST)
print FILEHANDLE LIST
print LIST
print Prints a string or a comma-separated list of strings. Returns non-zero if successful. FILEHANDLE
may be a scalar variable name, in which case the variable contains the name of the filehandle, thus
introducing one level of indirection. (NOTE: If FILEHANDLE is a variable and the next token is a
term, it may be misinterpreted as an operator unless you interpose a + or put parens around the
arguments.) If FILEHANDLE is omitted, prints by default to standard output (or to the last
selected output channel--see select()). If LIST is also omitted, prints $_ to STDOUT. To set the
default output channel to something other than STDOUT use the select operation. Note that,
because print takes a LIST, anything in the LIST is evaluated in an array context, and any
subroutine that you call will have one or more of its expressions evaluated in an array context.
Also be careful not to follow the print keyword with a left parenthesis unless you want the
corresponding right parenthesis to terminate the arguments to the print--interpose a + or put parens
around all the arguments.
printf(FILEHANDLE LIST)
printf(LIST)
printf FILEHANDLE LIST
printf LIST
Equivalent to a "print FILEHANDLE sprintf(LIST)".
read(FILEHANDLE,SCALAR,LENGTH,OFFSET)
read(FILEHANDLE,SCALAR,LENGTH)
Attempts to read LENGTH bytes of data into variable SCALAR from the specified
FILEHANDLE. Returns the number of bytes actually read, or undef if there was an error.
SCALAR will be grown or shrunk to the length actually read. An OFFSET may be specified to
place the read data at some other place than the beginning of the string. This call is actually
implemented in terms of stdio s fread call. To get a true read system call, see sysread.
seek(FILEHANDLE,POSITION,WHENCE)
Randomly positions the file pointer for FILEHANDLE, just like the fseek() call of stdio.
FILEHANDLE may be an expression whose value gives the name of the filehandle. Returns 1
upon success, 0 otherwise.
select(FILEHANDLE)
select Returns the currently selected filehandle. Sets the current default filehandle for output, if
[ Pobierz całość w formacie PDF ]