473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

SCALAR(0x82dea94)

Hello,
I posted this before and respondents wanted more code to help decipher
it. So I'm posting again with code below.
I have a script that is run by crontab. It Opens $user_file (flat file)
and checks for accounts with current date and charges the users card if
it's 30 days old. It also sends a reminder to those who are on the 30
day free trial. Sometimes it puts this... SCALAR(0x82dea94) or
something similar at the beginning of the a line in the $user_file. The
scipt only processes 20 lines at a time (every minute) to avoid server
time out.
Thanks in advance for your help.

sub billing_engine {
$e_number = "-1";
open (USERS, "$user_file") || &billerror
("$user_file Billing Notice" );
flock(USERS, 2);
while (<USERS>)
{
$line = $_;
chomp $line;
@fields = split (/\|/, $line);

@line =$line;
foreach $jiggy(@line){
$e_number++;

if (($start eq "$e_number")..($end eq "$e_number")){
$namelist .="$fields[1]\n";
$yes_row_count++;
($dbmonth,$dbday,$dbyear) = split (/\//, $fields[$field_for_update]);
$julian_day = &jday($dbmonth,$dbday,$dbyear);
($today_month,$today_day,$today_year) = split (/\//, &get_date);
$today = &jday($today_month,$today_day,$today_year);
$updated_days_ago = ($today - $julian_day);
if($fields[$field_for_account_status] eq "Ok"){
$current_row .= "$line";
@chargerow = $current_row;

foreach $customer (@chargerow){

if ($updated_days_ago >= "30"){
$auth_count++;

&auto_send_to_authorizenet;

if($declined){
$fields[$field_for_account_status] = "Ten_Days_Left";
$new_current_row .= join('|' => @fields) . "\n";
$email_user = $fields[$field_for_email];
&declined_email;
&admin_declined_email;
$email_user = "";
}
else{ #not declined
$fields[$field_for_account_status] = "Ok";
$fields[$field_for_update] = "$current_date";
$new_current_row .= join('|' => @fields) . "\n";
$email_user = $fields[$field_for_email];
&write_log;
&account_paid_email;
&admin_account_paid_email;
$email_user = "";
}#else not declined

}# if 30 days old

#save all the ones not 30 days old yet
else{ $new_current_row .= "$line\n";}

}# foreach chargerow

$new_current_row = "$new_current_row";
}#status Ok

###########################################
else {#not Ok
$bill_row .= "$line";
@bill_row = $bill_row;

foreach $bill (@bill_row ){
#This is what we do with all the people on 30 day trial

$bill_row_count++;

################
if($fields[$field_for_account_status] eq "One_Day_Left"){
$One_bill_row_count++;
$Thirty_bill_row_count++;
$fields[$field_for_account_status] = "Delete";
$Thirty_bill_row .= join('|' => @fields) . "\n";
}
#################
elsif($fields[$field_for_account_status] eq "Two_Days_Left"){
$Thirty_bill_row_count++;
$fields[$field_for_account_status] = "One_Day_Left";
$Thirty_bill_row .= join('|' => @fields) . "\n";
$email_user = $fields[$field_for_email];
&thirty_day_email;
$email_user = "";
}
#etc to 30-day-trial

#################
elsif($fields[$field_for_account_status] eq "30-Day-Trial"){
$Thirty_bill_row_count++;
$fields[$field_for_account_status] = "TwentyNine_Days_Left";
$Thirty_bill_row .= join('|' => @fields) . "\n";
$email_user = $fields[$field_for_email];
&thirty_day_email;
$email_user = "";
}

#################
elsif($fields[$field_for_account_status] eq "Donated"){
$Thirty_bill_row_count++;
$fields[$field_for_account_status] = "Donated";
$Thirty_bill_row .= join('|' => @fields) . "\n";
$email_user = $fields[$field_for_email];
$email_user = "";
}
#################

else{
$Leftover_bill_row_count++;
$Thirty_bill_row_count++;
$fields[$field_for_account_status] = "LeftOver";
$Thirty_bill_row .= join('|' => @fields) . "\n";
}

#################

}#foreach $bill
}#else
}#@billingnumber
else{ $hold_row_count++;
$hold_row .="$line\n"; }

}#jiggy
}#while
flock(USERS, 8);
close (USERS);

open (USERS, ">$user_file") || &billerror("$user_file Billing Notice");
flock(USERS, 2);
print USERS "$hold_row";
print USERS "$new_current_row";
print USERS "$Thirty_bill_row";
flock(USERS, 8);
close (USERS);

############

}#billing engine

Jul 19 '05 #1
1 1430
Todd Anderson wrote:
I posted this before and respondents wanted more code to help
decipher it. So I'm posting again with code below.


Yes, you posted before, but not in this newsgroup. You posted in
comp.lang.perl.misc, and there is where you should post a follow-up to
your initial posting instead of starting a new thread here. Besides,
this group is defunct, and replaced since long by comp.lang.perl misc.

But before posting again in comp.lang.perl.misc, please study the
posting guidelines:
http://mail.augustmail.com/~tadmc/cl...uidelines.html

For instance, you should enable strictures and warnings and modify the
code so that it passes those checks. You should also consider to not
post that much code, but rather write a small but complete program
that illustrates your problem. (There is a good chance that by making
those preparation steps, you'll find out what the problem is, and may
not need to post about it.)

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.