in reply to Re: (Re:) $class = ref $class || $class
in thread Constructor/Factory Orthodoxy
In the below code $response->finish is not working correctly. It seems someone forgot to add code to register some action with the legacy system to the called finish method. Some client has expanded his use of the info generated and this is suddenly a noticed misfeature. As the newly hired Perl expert your assigned task is to fix the problem.
There are 27 variations of the type Packet floating around the system. _respond is called from 19 different places all but 2 of which get $request or its forerunner passed in.# Mark the calling request object as answered, use the # ID param to create and return an response packet object. # Let the old system know this is done. sub _respond { my ($self, $request, $id, $response ) = @_; my $response = $request->new; ### Hey!! $request->count( $request->count + 1 ); if ( $response->approved) { $response->requestor( $id); $response->finish( SUCCESS ); $request->answered( $id) Request_handler->reap( $request->id()); return $response; } $response->finish( FAIL); return; }
My point: Do your posited circumstances exist here?
The author who wrote the code knew. He knew that $_[1] would always be a Packet_Foreign here. He didn't care about truth or clarity so the find part of a find and fix problem now requires much more effort.
I am not a great typist so I like to avoid unnecessary typing but sacrificing information for the sake of fewer keystrokes is foolish.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (Re:)+ $class = ref $class || $class
by herveus (Prior) on Mar 03, 2003 at 12:39 UTC | |
by rir (Vicar) on Mar 03, 2003 at 21:35 UTC | |
by herveus (Prior) on Mar 04, 2003 at 12:49 UTC | |
by rir (Vicar) on Mar 04, 2003 at 22:39 UTC | |
by tye (Sage) on Mar 06, 2003 at 00:14 UTC | |
| |
by herveus (Prior) on Mar 05, 2003 at 18:49 UTC | |
| |
by dragonchild (Archbishop) on Mar 04, 2003 at 22:48 UTC |