[ic] BUG: Vend::Order::route_order() breaks tie between $::Values and $Vend::Session->{values}

Mike Heins mike at perusion.com
Mon Nov 4 14:45:46 UTC 2013

Quoting Peter (peter at pajamian.dhs.org):
> route_order() has code that saves a copy of the values hashref:
> my $value_save = { %{$::Values} };
> ...and then later attempts to restore it:
> $Vend::Interpolate::Values = $::Values = $value_save;
> The issue is that the copy overwrites the original $::Values when it's
> restored and (if my understanding is correct) ends up breaking the tie
> between $::Values and $Vend::Session->{values}.  This has an effect on
> route commit and rollback code that attempts to modify the Values space,
> if $Values is modified in the perl code set in "Route foo commit" or
> "Route foo rollback" then that modification does not get saved with the
> session.
> My workaround for this issue at present is to modify both $Values and
> $Session->{values} from inside the perl block, but I think this should
> be considered a bug and fixed properly.  I'm not entirely sure what a
> proper fix would involve, though, and I'm reluctant to touch that code
> with fear of breaking order routes in Interchange.

This was all intentional. The point was to allow individual routes to
modify $Values without affecting the state of the hash at the next
route. I would be surprised if we didn't later reconnect
$Vend::Session->{values}, but I suppose it is possible -- this is
intended to be the last part of a process of submitting an order and
the only processing left to do should be presenting a receipt (from
the original point of view, anyway).

This code has been in operation like this since 1997. If we mess with
it, we would undoubtedly have the very real potential to break any
site upgrading.

Mike Heins
Perusion -- Expert Interchange Consulting  http://www.perusion.com/
phone +1.765.253.4194 ... Ask me about jobs ...

Courage is fear holding on a minute longer.
-- General George S. Patton 

More information about the interchange-users mailing list