(question was originally posted on discuss-list)

Richard,  from looking at the code snippets you posted, I believe that
both of your problems are with statements like this:


if ($in{email_bundle} == 1) {
    my $Tprice = 26.95*$in{period};
}  else {
    my $Tprice = 13.95*$in{period};
}

You say you defined $Tprice globally at the top of the script.  Well,
using "my" in the two blocks of the 'if' statement masks the global
definition of that variable.  The values you assign there are lost once
the global $Tprice comes back into scope outside of the 'if' blocks.

Removes the "my" qualifiers and the price should show up fine in the
resulting HTML.

Dan


On Thu, 2002-01-17 at 14:50, POWERHOUSE wrote:
> I downloaded 2.47 Yesterday, and spent like 11 hours from 10 mins after they 
>uploaded it, to about 5 this morning trying to get it to work.
> 
> Can someone tell me what I've done wrong here...
> 
> Here is what I've added...
> 
> to the top in use vars qw(  I added    $merchID $price $Tprice $domprice
> 
> Ok. Now in 
> 
> sub verify_order {
> I added a line to put a variable in the html code to show that price at the verify 
>order. Here is what I added and where...
> # this was already in there, under this is what I added
> 
>  my $problems;
>  foreach my $type (qw(owner billing tech)) {
>      foreach my $field (qw(phone fax)) {
>   my $number = $in{"${type}_$field"};
>   next if ($number eq undef);
>   
>   if ($number !~ /^\+\d{1,3}\.\d{1,12}(x\d{1,4})?$/){
>       # tell the registrant about the bad phone number
>       $problems .= "<BR>$type $field $number - ERROR - Format must be 
>+1.4165551212\n";
>   }
>      }
>  }
>  throw Exception "Register", "Error in data: $problems" if $problems;
> 
>  # If email bundle is not selected, remove the email address
>  delete $in{f_email} unless $in{email_bundle};
> 
> # Here is what I added...
> 
> if ($in{email_bundle} == 1) {
> my $Tprice = 26.95*$in{period};
> }  else {
> my $Tprice = 13.95*$in{period};
> }
> # I added $Tprice to the var at the top. It's just to show a price in the html, that 
>is it.
> 
> # Here is where one of my problems lay... The last part of this subroutine...
> 
>         print_form(template=>"$path_templates/verify_order.html",
>                    data =>{
>                        domain => $in{domain},
>                        Tprice => $REG_SYSTEM{Tprice}, # Here is what I've added. I 
>have tried every variation of it, but it won't show the value in the html.
>                        custom_tech_contact => $REG_SYSTEM{custom_tech_contact},
>          custom_nameservers => $REG_SYSTEM{custom_nameservers},
>                        affiliate_id => $in{affiliate_id},
>                        %in,
>                        tech_country => CODE_2_Country($in{tech_country}),
>                        billing_country => CODE_2_Country($in{billing_country}),
>                        owner_country => CODE_2_Country($in{owner_country}),
>                        %owner, %billing, %tech,
>                        crypted_in => $XML_Client->crypt_string(Dumper(\%in)),
>                    },
>                    );
>     }
> }
> 
> That is one problem. I don't want to confuse anyone, so I'll make another different 
>discussion of my other problem.
> 
> Can someone tell me please what I've done wrong here.
> 
> Thank you in advance for any answers you help me with!
> Richard Jones.


Reply via email to