Business::Payroll
use Business::Payroll; my $file = "payrollIn.xml"; my $string = ""; # If dynamically created or read from STDIN. my $payroll = Business::Payroll->new(); if ($payroll->error()) { die $payroll->errorMessage(); } my $result = $payroll->process(file => $file, string => $string); my $output = $result->generateXML(); # now you either print it or write to a file. print $output;
This is the base package for the Business::Payroll Module. It can be used programmatically per the synopsis above or with standalone xml files. There are two perl scripts included with this module to update and process the xml files. The standard procedure would be
1) Create xml file by hand or use example from this doc as a template. This is called 'raw' data. 2) 'cook' the data by running the process_payroll script. (no arguments will give help output) 3) For the next pay period you can manually copy and change the previous raw data or run update_payroll 4) Repeat step 2
NOTE: There are no requirements on file names. We use two directories of input and output files and use dates for file names. You can also put all files in one directory and name them something like input_DATE.xml output_DATE.xml.
Example:
<?xml version="1.0" encoding="ISO-8859-1"?> <payroll type="raw" version="1.0" date="20040713" period="biweekly" genSysId="20040628-20040711"> <person id="1" name="Person A" marital="single"> <country name="US" gross="1362.00" allow="2" withHold="0.00" grossYTD="13166.00" federalYTD="1071.00" method=""> <state name="MO" gross="1362.00" allow="1" withHold="5.00" method=""> </state> </country> </person> <person id="2" name="Person B" marital="single"> <country name="US" gross="541.00" allow="1" withHold="0.00" grossYTD="9899.00" federalYTD="835.00" method=""> <state name="MO" gross="541.00" allow="0" withHold="2.00" method=""> </state> </country> </person> </payroll>
Creates a new instance of the object. takes:
Returns 0 or 1 to indicate if the object is valid. The error will be available via errorMessage().
Processes the xml data specified in the file or the string. If both are specified, then the string takes precedence. Returns an instance of Business::Payroll::XML::OutData which holds the perl data structure and can be turned into XML by calling it's generateXML() method.
All data fields are accessible by specifying the object and pointing to the data member to be modified on the left-hand side of the assignment. Ex. $obj->variable($newValue); or $value = $obj->variable;
Xperience, Inc. (mailto:admin@pcxperience.com)
perl(1)
2 POD Errors
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head2'
=back without =over
To install Business::Payroll, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Business::Payroll
CPAN shell
perl -MCPAN -e shell install Business::Payroll
For more information on module installation, please visit the detailed CPAN module installation guide.