Я так понимаю что вызов ghostscript'а будет слудеющей строкой:
Код: Выделить всё
gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=%stdout -

Поможите кто чем может


Код: Выделить всё
gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=%stdout -
премного благодаренthefree писал(а):perldoc system и exec
Код: Выделить всё
#!/usr/bin/perl
use strict;
use IPC::Open2;
my $output = '... postscript code ....';
local $| = 1;
my($chld_out, $chld_in);
my $pid = open2($chld_out, $chld_in, "/usr/local/bin/gs -dBATCH -dNOPAUSE -dQUIET -sDEVICE=jpeg -sOutputFile=%stdout -_");
print $chld_in "$output\n" or die $!;
close $chld_in or die $!;
undef $output;
while( <$chld_out> ) { $output .= $_ }
close $chld_out or die $!;
waitpid( $pid, 0 );
print $output;
Код: Выделить всё
$ limits
Resource limits (current):
cputime infinity secs
filesize infinity kB
datasize 33554432 kB
stacksize 524288 kB
coredumpsize infinity kB
memoryuse infinity kB
memorylocked infinity kB
maxprocesses 5547
openfiles 11095
sbsize infinity bytes
vmemoryuse infinity kB
pseudo-terminals infinity
swapuse infinity kB
Код: Выделить всё
$ ulimit -a
socket buffer size (bytes, -b) unlimited
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) 33554432
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 11095
pipe size (512 bytes, -p) 1
stack size (kbytes, -s) 524288
cpu time (seconds, -t) unlimited
max user processes (-u) 5547
virtual memory (kbytes, -v) unlimited
swap size (kbytes, -w) unlimited
Код: Выделить всё
$ sysctl -a |grep pipe
kern.ipc.piperesizeallowed: 1
kern.ipc.piperesizefail: 0
kern.ipc.pipeallocfail: 0
kern.ipc.pipefragretry: 0
kern.ipc.pipekva: 933888
kern.ipc.maxpipekva: 66506752
Код: Выделить всё
$ uname -a
FreeBSD ... 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Mon Feb 6 15:26:21 EET 2012
Код: Выделить всё
write size: 1; bytes successfully before error: 65536
write size: 2; bytes successfully before error: 65536
write size: 4; bytes successfully before error: 65536
write size: 8; bytes successfully before error: 65536
write size: 16; bytes successfully before error: 65536
write size: 32; bytes successfully before error: 65536
write size: 64; bytes successfully before error: 65536
write size: 128; bytes successfully before error: 65536
write size: 256; bytes successfully before error: 65536
write size: 512; bytes successfully before error: 65536
write size: 1024; bytes successfully before error: 65536
write size: 2048; bytes successfully before error: 65536
write size: 4096; bytes successfully before error: 65536
write size: 8192; bytes successfully before error: 8192
write size: 16384; bytes successfully before error: 16384
write size: 32768; bytes successfully before error: 32768
write size: 65536; bytes successfully before error: 65536
write size: 131072; bytes successfully before error: 0
write size: 262144; bytes successfully before error: 0
Код: Выделить всё
#!/usr/bin/perl
use strict;
use IPC::Open2;
my $output = '... postscript code ....';
local $| = 1;
my($chld_out, $chld_in);
my $pid = open2($chld_out, $chld_in, "/usr/local/bin/gs -dBATCH -dNOPAUSE -dQUIET -sDEVICE=jpeg -sOutputFile=%stdout -_");
print $chld_in "$output\n" or die $!;
close $chld_in or die $!;
my @output = <$chld_out>;
close $chld_out or die $!;
waitpid( $pid, 0 );
$output = join '', @output;