Loading ...
Sorry, an error occurred while loading the content.

RE: [PBML] Re: Archive Zip appears empty in Windows

Expand Messages
  • Tim Lewis
    Thanks Alan! From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On Behalf Of Alan Haggai Alavi Sent: Sunday, February 13, 2011 9:42 AM
    Message 1 of 9 , Feb 19, 2011
    • 0 Attachment
      Thanks Alan!



      From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On Behalf Of Alan Haggai Alavi
      Sent: Sunday, February 13, 2011 9:42 AM
      To: perl-beginner@yahoogroups.com
      Subject: [PBML] Re: Archive Zip appears empty in Windows





      Hi,

      Fixed the bug. You can checkout the latest code from the Subversion
      repository at: http://svn.ali.as/cpan/trunk/Archive-Zip/

      svn checkout http://svn.ali.as/cpan/trunk/Archive-Zip/

      Considering the case that you checked out the code to the directory
      containing the archiving script, modify the script to include:

      ...

      use lib 'Archive-Zip/lib';
      use Archive::Zip qw( :ERROR_CODES );

      ...

      Thanks for the bug report.

      Anything else, please let me know.

      Regards,
      Alan Haggai Alavi.
      --
      The difference makes the difference





      [Non-text portions of this message have been removed]
    • Tim Lewis
      I have come across a strange happening in some code. The code below is a stripped out version of my entire program, but it still does the same weird thing. If
      Message 2 of 9 , Mar 16 6:59 AM
      • 0 Attachment
        I have come across a strange happening in some code. The code below is a stripped out version of my entire program, but it still does the same weird thing. If the code below is run, it gives me the error
        String found where operator expected at testme.pl line 16, near "case "1""
        (Do you need to predeclare case?)
        syntax error at testme.pl line 15, near ") {"
        Execution of testme.pl aborted due to compilation errors.

        If I remove the very last line, the code works fine. It also works if I comment out the line that contains division: $monthOfArchiveDataInt = int($calculatedMonthCheck/12);
        The server in which the code runs is Perl 5.8.8.
        I also tested the code on Perl 5.10.1, and it works fine in that environment.
        I already have fixed the code by changing to "if" statements instead of a switch. I was just wondering if someone knows the reason for this quirk. On a similar note, I think I remember reading that switch statements are going out of style, and being replace with if/else. Is that true?


        #!/usr/local/bin/perl
        use strict;
        use Switch;

        my $deleteParameterIn = "5";
        my $currentSystemDate = "20110315";
        my ($currentCalculatedMonth,$calculatedMonthCheck,$monthOfArchiveDataInt,
        $yearOfMonths,$numberOfMonth,$archiveMonthName);
        # Get the current month as number since year 1
        $currentCalculatedMonth = (((substr($currentSystemDate,0,4)) * 12) + (substr($currentSystemDate,4,2)));
        $calculatedMonthCheck = $currentCalculatedMonth - $deleteParameterIn;
        $monthOfArchiveDataInt = int($calculatedMonthCheck/12);
        $yearOfMonths = $monthOfArchiveDataInt * 12;
        $numberOfMonth = $calculatedMonthCheck - $yearOfMonths;
        switch ($numberOfMonth) {
        case "1" { $archiveMonthName = "JAN"; }
        case "2" { $archiveMonthName="FEB"; }
        case "3" { $archiveMonthName="MAR"; }
        case "4" { $archiveMonthName="APR"; }
        case "5" { $archiveMonthName="MAY"; }
        case "6" { $archiveMonthName="JUN"; }
        case "7" { $archiveMonthName="JUL"; }
        case "8" { $archiveMonthName="AUG"; }
        case "9" { $archiveMonthName="SEP"; }
        case "10" { $archiveMonthName="OCT"; }
        case "11" { $archiveMonthName="NOV"; }
        case "12" { $archiveMonthName="DEC"; }
        }
        print "am is $archiveMonthName\n";
        # $logFile=~s//~//~~~~//g;
      • Charles K. Clarkson
        ... Why use switch() at all? my @month_names = qw/ JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC /; my $archiveMonthName = $month_names[$numberOfMonth - 1];
        Message 3 of 9 , Mar 19 8:04 AM
        • 0 Attachment
          On 3/16/2011 8:59 AM, Tim Lewis wrote:

          > I have come across a strange happening in some code. The code below is
          > a stripped out version of my entire program, but it still does the
          > same weird thing. If the code below is run, it gives me the error

          > String found where operator expected at testme.pl line 16, near "case "1""

          Why use switch() at all?

          my @month_names = qw/ JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC /;
          my $archiveMonthName = $month_names[$numberOfMonth - 1];



          Charles Clarkson
          --
          Mobile Home Investor
          Free Market Advocate
          Programmer

          I'm not really a smart person. I just play one on the Internet.

          Stephenville, TX
          http://twitter.com/CharlesClarkson
          +1 (254) 968-8328
        • Tim Lewis
          Charles, that is excellent code, and much easier than IF statements. Thanks! Tim From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On
          Message 4 of 9 , Mar 19 10:16 AM
          • 0 Attachment
            Charles, that is excellent code, and much easier than IF statements. Thanks!

            Tim





            From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On Behalf Of Charles K. Clarkson
            Sent: Saturday, March 19, 2011 11:04 AM
            To: perl-beginner@yahoogroups.com
            Subject: Re: [PBML] Strange behavior with switch statement





            On 3/16/2011 8:59 AM, Tim Lewis wrote:

            > I have come across a strange happening in some code. The code below is
            > a stripped out version of my entire program, but it still does the
            > same weird thing. If the code below is run, it gives me the error

            > String found where operator expected at testme.pl line 16, near "case "1""

            Why use switch() at all?

            my @month_names = qw/ JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC /;
            my $archiveMonthName = $month_names[$numberOfMonth - 1];

            Charles Clarkson
            --
            Mobile Home Investor
            Free Market Advocate
            Programmer

            I'm not really a smart person. I just play one on the Internet.

            Stephenville, TX
            http://twitter.com/CharlesClarkson
            +1 (254) 968-8328





            [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.