# ./plugins/queue/qmail-queue
pipe(MESSAGE_READER, MESSAGE_WRITER) or fault("Could
 not create message pipe"), exit;
pipe(ENVELOPE_READER, ENVELOPE_WRITER) or fault("Could
 not create envelope pipe"), exit;
not defined $child and fault(451, "Could not fork"), exit;
close MESSAGE_READER  or fault("close msg reader fault"), exit;
close ENVELOPE_READER or fault("close envelope reader fault"), exit;

I doubt that queue/qmail-queue can use fault() if I can't,
which probably means it's just never getting called in qm-q
or somebody would have noticed by now.

Try in qmail-queue--

fault(451"blah blah"), exit;

...FATAL, undefined subroutine! Much hand gesturing and
lips moving during 99-story fall, fall ends same place, same
way.

fault() is in SMTP.pm

# ./lib/Qpsmtpd/SMTP.pm

sub dispatch {
...
return $self->fault("command '$cmd' failed unexpectedly");
...
}

sub fault {
 my $self = shift;
 my ($msg) = shift || "program fault - command not performed";
 print STDERR "$0[$$]: $msg ($!)\n";
 return $self->respond(451, "Internal error - try again later - " . $msg);
}

Several questions. First, why doesn't qmail-queue have to say "$self->"
as when used in ./lib/Qpsmtpd/SMTP.pm where sub fault() is defined?
# ./lib/Qpsmtpd/SMTP.pm
$self->fault("command '$cmd' failed unexpectedly")

and why in SMTP.pm, fault(), is shift going to produce $self when
$self was not in $self->fault("command '$cmd' failed unexpectedly")
and when else is shift going to produce $self rather than the first
argument sent in () by a caller(presuming the first arg sent was not
explicitly $self)?

When run_hooks is called, no $self is in the caller's run_hooks()
but run_hooks shift is $self. But then when in ./lib/Qpsmtpd.pm
sub run_hooks calls hooks, it explicitly puts $self in
eval { (@r) = $code->{code}->($self, $self->transaction, @_); };

but when I call my subs, they won't have $self unless I
explicitly &it($self, $transaction,$recipients).

open( fh , '>' , '/tmp/ad_hoc_root_owned_unwriteable_for_me' )
or return ( DECLINED , $self->fault( "failed to open $file $!" ) ) ;

...failed to find object method $self->fault()

open( fh , '>' , '/tmp/ad_hoc_root_owned_unwriteable_for_me' )
or return ( DECLINED , fault( "$self - failed to open $file $!" ) ) ;

...fatal undefined subroutine

open( my_fh , '>' , '/tmp/test_fault' )
or warn( keys %{$self} ) ;
return ( DECLINED ) ;

... keys %{$self} eq "_joe_ok_qp_config"

my @ar = values %{$self} ;
my @kys = keys %{$ar[1]} ;
my $s="" ;
$s = $s . " " . $_ foreach @kys ;
my @car = keys %{${$ar[1]}{'_commands'}} ;
my $sc = "" ;
$sc = $sc . " " . $_ foreach @car ;
warn( $s .  " x " . $sc ) ;
return ( DECLINED ) ;

_connection
_config
_cache
_transaction
args
_commands
_counter

quit
vrfy
data
ehlo
noop
rset
help
mail
rcpt
helo

no sub fault() found, "can't get they-uh from he-uh", but I
don't need it.

-Bob

Reply via email to