ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-Fork/Fork.pm
(Generate patch)

Comparing AnyEvent-Fork/Fork.pm (file contents):
Revision 1.68 by root, Sat May 21 07:01:58 2016 UTC vs.
Revision 1.74 by root, Mon Dec 11 05:34:15 2023 UTC

465use AnyEvent; 465use AnyEvent;
466use AnyEvent::Util (); 466use AnyEvent::Util ();
467 467
468use IO::FDPass; 468use IO::FDPass;
469 469
470our $VERSION = 1.3; 470our $VERSION = 1.32;
471 471
472# the early fork template process 472# the early fork template process
473our $EARLY; 473our $EARLY;
474 474
475# the empty template process 475# the empty template process
556 556
557 if ($pid eq 0) { 557 if ($pid eq 0) {
558 require AnyEvent::Fork::Serve; 558 require AnyEvent::Fork::Serve;
559 $AnyEvent::Fork::Serve::OWNER = $parent; 559 $AnyEvent::Fork::Serve::OWNER = $parent;
560 close $fh; 560 close $fh;
561 $0 = "$AnyEvent::Fork::Serve::OWNER AnyEvent::Fork/exec"; 561 $0 = "$parent AnyEvent::Fork/exec";
562 AnyEvent::Fork::Serve::serve ($slave); 562 AnyEvent::Fork::Serve::serve ($slave);
563 exit 0; 563 exit 0;
564 } elsif (!$pid) { 564 } elsif (!$pid) {
565 die "AnyEvent::Fork::Early/Template: unable to fork template process: $!"; 565 die "AnyEvent::Fork::Early/Template: unable to fork template process: $!";
566 } 566 }
624The path to the perl interpreter is divined using various methods - first 624The path to the perl interpreter is divined using various methods - first
625C<$^X> is investigated to see if the path ends with something that looks 625C<$^X> is investigated to see if the path ends with something that looks
626as if it were the perl interpreter. Failing this, the module falls back to 626as if it were the perl interpreter. Failing this, the module falls back to
627using C<$Config::Config{perlpath}>. 627using C<$Config::Config{perlpath}>.
628 628
629The path to perl can also be overriden by setting the global variable 629The path to perl can also be overridden by setting the global variable
630C<$AnyEvent::Fork::PERL> - it's value will be used for all subsequent 630C<$AnyEvent::Fork::PERL> - it's value will be used for all subsequent
631invocations. 631invocations.
632 632
633=cut 633=cut
634 634
701 $_[0][PID] 701 $_[0][PID]
702} 702}
703 703
704=item $proc = $proc->eval ($perlcode, @args) 704=item $proc = $proc->eval ($perlcode, @args)
705 705
706Evaluates the given C<$perlcode> as ... Perl code, while setting C<@_> to 706Evaluates the given C<$perlcode> as ... Perl code, while setting C<@_>
707the strings specified by C<@args>, in the "main" package. 707to the strings specified by C<@args>, in the "main" package (so you can
708access the args using C<$_[0]> and so on, but not using implicit C<shift>
709as the latter works on C<@ARGV>).
708 710
709This call is meant to do any custom initialisation that might be required 711This call is meant to do any custom initialisation that might be required
710(for example, the C<require> method uses it). It's not supposed to be used 712(for example, the C<require> method uses it). It's not supposed to be used
711to completely take over the process, use C<run> for that. 713to completely take over the process, use C<run> for that.
712 714
907 $self->_cmd (r => $func); 909 $self->_cmd (r => $func);
908} 910}
909 911
910=back 912=back
911 913
914
915=head2 CHILD PROCESS INTERFACE
916
917This module has a limited API for use in child processes.
918
919=over 4
920
921=item @args = AnyEvent::Fork::Serve::run_args
922
923This function, which only exists before the C<run> method is called,
924returns the arguments that would be passed to the run function, and clears
925them.
926
927This is mainly useful to get any file handles passed via C<send_fh>, but
928works for any arguments passed via C<< send_I<xxx> >> methods.
929
930=back
931
932
912=head2 EXPERIMENTAL METHODS 933=head2 EXPERIMENTAL METHODS
913 934
914These methods might go away completely or change behaviour, at any time. 935These methods might go away completely or change behaviour, at any time.
915 936
916=over 4 937=over 4

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines