my first part of the code:
use Encode;
use utf8;
use XML::LibXML;
use Spreadsheet::ParseExcel;
system("cls");
# Read command line arguments
#---------------------------------------------------------------------
+-------------------
my $materialmapping_file = shift;
my $data_folder = shift;
print "Material mapping generator - Version 0.0.6 - Final \nmaterialma
+pping_file:$materialmapping_file\ndata_folder:$data_folder\n";
# subroutine
sub getSQLTimeStamp {
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localt
+ime(time);
return sprintf "%4d-%02d-%02d %02d:%02d:%02d",$year+1900,$mon+1
+,$mday,$hour,$min,$sec;
}
# Main
#---------------------------------------------------------------------
+-------------------
unless (defined $materialmapping_file and defined $data_folder)
{
print "Usage: $0 <materialmapping_file> <data_folder>\n";
exit;
}
opendir ( DIR, $data_folder ) || die "Error in opening dir $data_f
+older\n";
my $materialmapping_table_xml = XML::LibXML->createDocument( "1.0"
+, "UTF-8");
my $materialmapping_table_xml_root = $materialmapping_table_xml->c
+reateElement("masterdata");
$materialmapping_table_xml_root->setAttribute('version',getSQLTime
+Stamp());
$materialmapping_table_xml->setDocumentElement($materialmapping_ta
+ble_xml_root);
print "loading...\n";
while(($filename = readdir(DIR))){
next unless $filename =~ /\.xls$/i;
print " - $filename \n";
my $parser = Spreadsheet::ParseExcel->new();
my $oBook = $parser->parse($data_folder.$filename);
next unless defined $oBook;
for(my $iSheet=0; $iSheet < $oBook->{SheetCount} ; $iS
+heet++) {
$oWkS = $oBook->{Worksheet}[$iSheet];
.........................................................
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|