ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC.pm (file contents):
Revision 1.199 by root, Wed Dec 24 04:13:13 2008 UTC vs.
Revision 1.200 by root, Sun Jan 4 10:22:19 2009 UTC

26} 26}
27 27
28use utf8; 28use utf8;
29use strict qw(vars subs); 29use strict qw(vars subs);
30 30
31use Socket ();
31use AnyEvent (); 32use AnyEvent ();
33use AnyEvent::Util ();
32use Pod::POM (); 34use Pod::POM ();
33use File::Path (); 35use File::Path ();
34use Storable (); # finally 36use Storable (); # finally
35use Fcntl (); 37use Fcntl ();
36use JSON::XS qw(encode_json decode_json); 38use JSON::XS qw(encode_json decode_json);
67 s/</&lt;/g; 69 s/</&lt;/g;
68 70
69 $_ 71 $_
70} 72}
71 73
72sub socketpipe() {
73 socketpair my $fh1, my $fh2, &Socket::AF_UNIX, &Socket::SOCK_STREAM, &Socket::PF_UNSPEC
74 or die "cannot establish bidirectional pipe: $!\n";
75
76 ($fh1, $fh2)
77}
78
79sub background(&;&) { 74sub background(&;&) {
80 my ($bg, $cb) = @_; 75 my ($bg, $cb) = @_;
81 76
82 my ($fh_r, $fh_w) = DC::socketpipe; 77 my ($fh_r, $fh_w) = AnyEvent::Util::portable_socketpair
78 or die "unable to create background socketpair: $!";
83 79
84 my $pid = fork; 80 my $pid = fork;
85 81
86 if (defined $pid && !$pid) { 82 if (defined $pid && !$pid) {
87 local $SIG{__DIE__}; 83 local $SIG{__DIE__};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines