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 => );
$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 )
$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);
$s->update_and_log( table => tablename, idfield => idfield, object => object, id => id, existing => \%hash, update => \%hash);
my %hash = $s->in_to_hash($identifier,[$noblanks]);
$s->log($ref,$ref_id,$msg);
$s->xsave_pdf($pdf_name,$fname,$args);
$s->save_pdf($pdf_name,$fname,$args);
$s->xpdf($pdf_name,$fname,$args);
$s->pdf($pdf_name,$fname,$args);
$s->alert($message,$croak);
$s->send_error($msg);
$s->confirm($msg);
$s->notify($msg);
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.
my $x12 = $s->format_x12($vendor_edi_document_id,\%data);
my $data = $s->edi_post($ref,$url,$data);
my $data = $s->edi_post($ref,$url);
my $truefalse = $s->verify_date($date,$mindays,$maxdays);
Make sure a date is in a given range of days from today.
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.
my $truefalse = $s->verify_email($email);
my $truefalse = $s->verify_regex($regex);
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.
my $html = $s->html_orderby($key,[desc || asc],$params);
my $html = $s->html_font($text,$size);
my $html = $s->html_a($url,$name,[$class]);
my $html = $s->html_submit($name,[$class]);
my $html = $s->html_radio($key,$value,[$checked],[$desc],[$id]);
my $html = $s->html_checkbox($key,$value,[$checked],[$desc],[$id]);
my $html = $s->html_password($key,$value,[$size]);
my $html = $s->html_upload($key,[$size],[$class],[$id]);
my $html = $s->html_input_email($key,$value,[$size]);
my $html = $s->html_input_number($key,$value,[$size]);
my $html = $s->html_input($key,$value,[$size]);
my $html = $s->html_input($key,$value,[$cols || 40],[$row || 3],[$class]);
my $html $s->html_hidden($key,$value,[$desc],[$id]);
my $html = $s->html_thtd($th,$td);
my $html = $s->html_thead(@list);
my $html = $s->html_select_basic(\@list,$key,[$existing],[$showblank]);
my $html = $s->html_select(\@arrayhash,$key,$idkey,$idname,[$existing],[$showblank]);
my $html = $s->html_tbody(\@arrayhash,@cols);
my $html = $s->address_display(\%hash,$wrap);
my $string = $s->format_text($string);
Converts newlines to <br>, tabs and 8 spaces to 4 nbsp;. Also does an escape.
my $string = $s->format_accounting($string);
takes things like 1234 and returns 1,234, and -1234 and returns (1,234)
my $string = $s->format_number($string);
Adds commas to numbers. 1234 becomes 1,234.
my $string = $s->format_time($string);
Takes a timestamp and returns HH:MM:SS
my $string = $s->format_ts($string);
Takes a timestamp and returns MM/DD/YYYY HH:MM
$s->translate_date(\$date);
Takes 102202 and returns 10/22/02
my $string = $s->format_date($string);
Given YYYY-MM-DD (or a timestamp with YYYY-MM-DD HH...) and returns MM/DD/YYYY.
my $string = $s->format_phone($number);
Returns 123-123-1234 if $number is 10 digits.
my $string = $s->format_boolean($value);
Returns Yes for true value, No for false value, and '' for empty value.
my $string = $s->format_percent($number);
Given 0.123, returns 12.3%.
my @array = $s->csv_to_array($text,[$onerow]);
my $string = $s->action_html($object,$function,$title,$params,[$class || 'action']);
To install Apache::SdnFw, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::SdnFw
CPAN shell
perl -MCPAN -e shell install Apache::SdnFw
For more information on module installation, please visit the detailed CPAN module installation guide.