sub mysub { my $result; fill the code to get $result ok if ($soap) # $soap is true if this function is called from a webservice { $result=SOAP::Data...($result)....; } return $result; }