It's a Scala gotcha, unfortunately.
Anything you put in the "matching" part of a pattern matching expression
should be side-effect free. (Side effects are things like printing to
screen, writing to files, changing a database, changing global state, etc.)
Because of the way the compiler optimizes pattern matching expressions, it
can't guarantee that they'll only be run once.
Your second approach is the right one. Put all side-effecting expressions in
the body of the pattern match.
--j
On Sun, Oct 19, 2008 at 2:31 AM, Tim Perrett <[EMAIL PROTECTED]> wrote:
>
> Thats strange..... changing the code to:
>
> LiftRules.addDispatchBefore {
> case r @ RequestState("paypal":: "ipn" :: Nil, "", PostRequest)
> => () => {
> PaypalIPN(r)
> Full(XmlResponse(<complete />))
> }
> }
>
> and then it only gets called once. Very strange - why does it do that?
>
> Cheers
>
> Tim
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---