new
my $s = Apache::SdnFw::lib::Core->new(
in => incoming parameters
env => hash of incoming data
content_type => [required]
cookies => cookie values
uri => [required] - tells us what we are going to do in process
args => raw args from $r->args
remote_addr =>
);
process
$s->process();
We should be sending back the following
$s->{r} => (
file_path => if we want to send back a file handle
filename => to force the name of the file going back
content => raw string data to dump back upstream
error => error string to display or log
return_code => to just send back a raw return code
set_cookie => [
array of cookies to send back
],
redirect => redirect to this url
)
tt
$s->tt($fname,$args,[$string])
$fname can be a path to a file, or a string reference, $args is a hash ref with values of information that is passed to template toolkit. $string can be a reference to a string variable, or to an array ref, in which case the results are pushed into that array. If $string is not defined, then the results are appended to $s->{content}.
$s->tt('object/template.tt', { s => $s, hash => \%hash });
$s->tt('object/template.tt', { s => $s, list => \@list },\$output);
$s->tt(\$template, { s => $s },\@output);
update_and_log
$s->update_and_log(
table => tablename,
idfield => idfield,
object => object,
id => id,
existing => \%hash,
update => \%hash);
in_to_hash
my %hash = $s->in_to_hash($identifier,[$noblanks]);
log
$s->log($ref,$ref_id,$msg);
xsave_pdf
$s->xsave_pdf($pdf_name,$fname,$args);
save_pdf
$s->save_pdf($pdf_name,$fname,$args);
xpdf
$s->xpdf($pdf_name,$fname,$args);
$s->pdf($pdf_name,$fname,$args);
alert
$s->alert($message,$croak);
send_error
$s->send_error($msg);
confirm
$s->confirm($msg);
notify
$s->notify($msg);
build_x12
my %hash = $s->build_x12($doctype,\%vendor,\%data);
This function looks for a perl parser file for the specific vendor for the specific $doctype (850, 855, 856, 810, etc) and returns a hash which can then be fed into format_x12.
format_x12
my $x12 = $s->format_x12($vendor_edi_document_id,\%data);
edi_post
my $data = $s->edi_post($ref,$url,$data);
edi_get
my $data = $s->edi_post($ref,$url);
verify_date
my $truefalse = $s->verify_date($date,$mindays,$maxdays);
Make sure a date is in a given range of days from today.
verify_zipcode
my $truefalse = $s->verify_zipcode(\$zip,[\$state],[\$city],[\$country]);
Check the zipcode database for the given zipcode. If optional references are included in call and zipcode is valid, these scalar references are populated with the database information.
verify_email
my $truefalse = $s->verify_email($email);
verify_regex
my $truefalse = $s->verify_regex($regex);
verify_phone
my $truefalse = $s->verify_phone(\$number,[\$other]);
Checks that $number is only numbers and it 10 digits. Changes input scalar reference to clean it up. If $other scalar reference is provided, and nothing is in $number, then function returns true which is somewhat of a bypass for non 10 digit phone verification.
html_orderby
my $html = $s->html_orderby($key,[desc || asc],$params);
html_font
my $html = $s->html_font($text,$size);
html_a
my $html = $s->html_a($url,$name,[$class]);
html_submit
my $html = $s->html_submit($name,[$class]);
html_radio
my $html = $s->html_radio($key,$value,[$checked],[$desc],[$id]);
html_checkbox
my $html = $s->html_checkbox($key,$value,[$checked],[$desc],[$id]);
html_password
my $html = $s->html_password($key,$value,[$size]);
html_upload
my $html = $s->html_upload($key,[$size],[$class],[$id]);
html_input_email
my $html = $s->html_input_email($key,$value,[$size]);
html_input_number
my $html = $s->html_input_number($key,$value,[$size]);
html_input
my $html = $s->html_input($key,$value,[$size]);
html_textarea
my $html = $s->html_input($key,$value,[$cols || 40],[$row || 3],[$class]);
html_hidden
my $html $s->html_hidden($key,$value,[$desc],[$id]);
html_thtd
my $html = $s->html_thtd($th,$td);
html_thead
my $html = $s->html_thead(@list);
html_select_basic
my $html = $s->html_select_basic(\@list,$key,[$existing],[$showblank]);
html_select
my $html = $s->html_select(\@arrayhash,$key,$idkey,$idname,[$existing],[$showblank]);
html_tbody
my $html = $s->html_tbody(\@arrayhash,@cols);
address_display
my $html = $s->address_display(\%hash,$wrap);
format_text
my $string = $s->format_text($string);
Converts newlines to <br>, tabs and 8 spaces to 4 nbsp;. Also does an escape.
format_accounting
my $string = $s->format_accounting($string);
takes things like 1234 and returns 1,234, and -1234 and returns (1,234)
format_number
my $string = $s->format_number($string);
Adds commas to numbers. 1234 becomes 1,234.
format_time
my $string = $s->format_time($string);
Takes a timestamp and returns HH:MM:SS
format_ts
my $string = $s->format_ts($string);
Takes a timestamp and returns MM/DD/YYYY HH:MM
translate_date
$s->translate_date(\$date);
Takes 102202 and returns 10/22/02
format_date
my $string = $s->format_date($string);
Given YYYY-MM-DD (or a timestamp with YYYY-MM-DD HH...) and returns MM/DD/YYYY.
format_phone
my $string = $s->format_phone($number);
Returns 123-123-1234 if $number is 10 digits.
format_boolean
my $string = $s->format_boolean($value);
Returns Yes for true value, No for false value, and '' for empty value.
format_percent
my $string = $s->format_percent($number);
Given 0.123, returns 12.3%.
csv_to_array
my @array = $s->csv_to_array($text,[$onerow]);
action_html
my $string = $s->action_html($object,$function,$title,$params,[$class || 'action']);