Sorry to be coming into this a bit late -- it's not clear to me whether your basic problem has been solved, but I just wanted to make one suggestion about your script.

Use hashes that are keyed by "os_type". As posted, you have about 4 times more lines of code than you really need, because you are using separate array/variable names for each OS. Not only does it take longer to create these unnecessary lines of code, it will also take much longer to maintain, fix, adapt, etc. Try something like this:

... my %installed; # these will be HoA my %hotfix; # where the hash keys are my %ready; # taken from @valid_os my $ninstalled = 0; foreach my $os (@valid_os) { my $path_os = $PATCHPATH . $os; opendir( DIR, $path_os ) or die "dir $path_os not found: $!"; while (my $_ = readdir(DIR)) { next if ( /^\.\.?$/ ); push( @{$installed{$os}}, $_ ); ### SEE NOTE BELOW $ninstalled++; } closedir DIR; } die "No hotfix files are installed in $PATCH_PATH\n" unless ($ninstall +ed); ... while ($db->FetchRow) { my %hotfix_record = $db->DataHash("os","swname"); push( @{$hotfix{$os}}, $hotfix_record{swname} ); } ... for my $os (@valid_os) { @{$ready{$os}} = Check_Array( @{$installed{$os}}, @{$hotfix{$os}} +); for my $hotfix ( @{$ready{$os}} ) { Add_Hotfix( $hotfix, $os ); } }
This way, when you need to add yet another OS to the list, you only need to change the one line that assigns values to the "@valid_os" array, and everything else is taken care of, without further ado.

NOTE: The code in your OP was doing a "chomp" on the string that was returned by readdir(). NO, DO NOT DO THAT. Directories are not like text files; the file name string you get from a directory via readdir() does not have a line-feed at the end. This would probably explain the error message that you reported at the beginning ("file not found").


In reply to Re: Self Extracting Cabinet Files in Perl by graff
in thread Self Extracting Cabinet Files in Perl by Ninthwave

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.