restrict CreditCard, CreditCardGateway; filter CreditCard, \&clean_credit_card; my CreditCard $credit_card = $cgi->param("credit_card"); print $credit_card; # ALLOWED (filters card) my CreditCardGateway $gateway; open ($gateway, "| cc_card_gateway") or die "failed to open gateway: $!"; print $gateway $credit_card; # ALLOWED (prints full # details) # very very naive cleaning function sub clean_credit_card { my ($restricted) = @_; $restricted = s/.{12}/./; # replace 12 digits with .s return $restricted; }