[28748] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 10112 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 3 09:05:47 2007

Date: Wed, 3 Jan 2007 06:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 3 Jan 2007     Volume: 10 Number: 10112

Today's topics:
    Re: Build of Perl 5.8.8 is failing shinca@gmail.com
        Help Parsing A Text File <greggieFEN@gmail.com>
    Re: Help Parsing A Text File anno4000@radom.zrz.tu-berlin.de
    Re: How can i stop a module nicely? <tadmc@augustmail.com>
    Re: How can i stop a module nicely? <john@castleamber.com>
        I'm not too sure if this is a perl question..... <cdalten@gmail.com>
    Re: I'm not too sure if this is a perl question..... <john@castleamber.com>
        new CPAN modules on Wed Jan  3 2007 (Randal Schwartz)
    Re: printing long decimal numbers <DJStunks@gmail.com>
    Re: Problematic Perl code <emschwar@pobox.com>
    Re: Problematic Perl code <scobloke2@infotop.co.uk>
    Re: Problems with use locale and regexp felix.ostmann@thewar.de
        regex problem <andreap@gmx.de>
    Re: system command won't run with -T option on rallabs@adelphia.net
    Re: system command won't run with -T option on (on aioe)
    Re: system command won't run with -T option on rallabs@adelphia.net
    Re: system command won't run with -T option on <mritty@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 2 Jan 2007 22:59:29 -0800
From: shinca@gmail.com
Subject: Re: Build of Perl 5.8.8 is failing
Message-Id: <1167807569.322097.92120@h40g2000cwb.googlegroups.com>

I reviewed the INSTALL doc and it suggested to disable the Optimization
parameter in the config process.  I also had to SU to complete the make
install command.  I've gotten the Perl ported over to my environment
for the moment.  We'll see how it works.



On Dec 27 2006, 3:55 pm, shi...@gmail.com wrote:
> Hello,
> I'm new to compiling Perl and would like your assistance.
>
> I am trying to install Perl 5.8.8 on my Linux 2.0.34C52_SK.
>
> [admin perl-5.8.8]$ pwd
> /home/sites/home/users/admin/perl-5.8.8/make
>
> I am getting the following error message after typing 'make' (config'd
> to install in /usr/local/:)
>
> ---snip of error build log section---
> rm -f libperl.a
> /usr/bin/ar rcu libperl.a perl.o  gv.o toke.o perly.o op.o pad.o
> regcomp.o dump.
> o util.o mg.o reentr.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o
> pp_ctl.o pp_sy
> s.o doop.o doio.o regexec.o utf8.o taint.o deb.o universal.o xsutils.o
> globals.o
>  perlio.o perlapi.o numeric.o locale.o pp_pack.o pp_sort.o
> `sh  cflags "optimize='-O2'" opmini.o`  -DPERL_EXTERNAL_GLOB opmini.c
>           CCCMD =  cc -DPERL_CORE -c -pipe -D_LARGEFILE_SOURCE
> -D_FILE_OFFSET_BI
> TS=64 -O2  -Wall
> cc -L/usr/local/lib -o miniperl \
>     miniperlmain.o opmini.o libperl.a -lnsl -ldl -lm -lcrypt -lutil -lc
> -lposix
>
> ./miniperl -w -Ilib -MExporter -e '<?>' || make minitest
> ./miniperl -Ilib configpm --heavy=lib/Config_heavy.pl lib/Config.pm
> ./miniperl -Ilib lib/lib_pm.PL
> Extracting lib.pm (with variable substitutions)
>         AutoSplitting perl library
> ./miniperl -Ilib -e 'use AutoSplit; \
> autosplit_lib_modules(@ARGV)' lib/*.pm
> ./miniperl -Ilib -e 'use AutoSplit; \
> autosplit_lib_modules(@ARGV)' lib/*/*.pm
> make lib/re.pm
> make[1]: Entering directory `/home/sites/home/users/admin/perl-5.8.8'
> make[1]: `lib/re.pm' is up to date.
> make[1]: Leaving directory `/home/sites/home/users/admin/perl-5.8.8'
> ./miniperl minimod.pl > lib/ExtUtils/Miniperl.pm
> cd lib/unicore &&  ../../miniperl -I../../lib mktables -w
> mktables: bad args to New_Prop at mktables line 342
>         main::New_Prop('Is', 'Assigned', 'Table=ARRAY(0x10214ef8)',
> 'Desc', 'All
>  assigned code points', 'Fuzzy', 0) called at mktables line 380
>         Table::New('Table', 'Is', 'Assigned', 'Desc', 'All assigned
> code points'
> , 'Fuzzy', 0) called at mktables line 735
> make: *** [uni.data] Error 255
> ---end of snip---
>
> Any assistance with further troubleshooting this issue would be much
> appreciated.



------------------------------

Date: 3 Jan 2007 01:30:47 -0800
From: "greggiefen" <greggieFEN@gmail.com>
Subject: Help Parsing A Text File
Message-Id: <1167816647.474300.8160@v33g2000cwv.googlegroups.com>

Hello,

I am new to Perl but have programmed in other languages in school.  I
am trying to parse a VERY large text file.  I initially tried to load
it all into an array but that seemed to fail due to memory constraints.

This is what i'm trying to do:#!/usr/bin/perl -w

open(OF, "output.txt");

while ($line = <OF>) {

  #If a line contains this i wanted it printed so the date will be
included
  if($line =~ /Page     1/) {
    print $line;
  }

 #I want all the records regarding Mr. Smith printed. However the
records span multiple lines
 if($line =~ /Mr Smith/) {
   print $line;

  #the lines of the peronsal records end in a line of all asterix
   while ($line =~ /[^\*]/) {
     print $line;
     #do something magical here
   }
 }

}

What I need to do is to somehow get the perl script to jump to the next
line after printing the current line in the last loop, but still stay
in the loop until it reached the line of all **.  If i could get all of
it into an array i could simply incriment the index until i reched the
line of all asterixs.



------------------------------

Date: 3 Jan 2007 09:52:24 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Help Parsing A Text File
Message-Id: <501cmoF1db6n6U1@mid.dfncis.de>

greggiefen <greggieFEN@gmail.com> wrote in comp.lang.perl.misc:
> Hello,
> 
> I am new to Perl but have programmed in other languages in school.  I
> am trying to parse a VERY large text file.  I initially tried to load
> it all into an array but that seemed to fail due to memory constraints.
> 
> This is what i'm trying to do:#!/usr/bin/perl -w
> 
> open(OF, "output.txt");
> 
> while ($line = <OF>) {
> 
>   #If a line contains this i wanted it printed so the date will be
> included
>   if($line =~ /Page     1/) {
>     print $line;
>   }

Is there a question involved?

>  #I want all the records regarding Mr. Smith printed. However the
> records span multiple lines
>  if($line =~ /Mr Smith/) {
>    print $line;
> 
>   #the lines of the peronsal records end in a line of all asterix
>    while ($line =~ /[^\*]/) {
>      print $line;
>      #do something magical here
>    }
>  }
> 
> }
> 
> What I need to do is to somehow get the perl script to jump to the next
> line after printing the current line in the last loop, but still stay
> in the loop until it reached the line of all **.  If i could get all of
> it into an array i could simply incriment the index until i reched the
> line of all asterixs.
> 

That's what the ".." operator does in scalar context.  Try

    print if /Mr Smith/ .. /^\*+$/;

Anno


------------------------------

Date: Tue, 2 Jan 2007 20:19:56 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How can i stop a module nicely?
Message-Id: <slrnepm4mc.ap7.tadmc@tadmc30.august.net>

doolittle <spam.meplease@ntlworld.com> wrote:

> I would like to exit from my perl module, 


You cannot "exit" from a module.

You can "return" from a subroutine though:

   perldoc -f return


> transferring control to the
> calling program. Can this be done directly from an arbitrary subroutine
                                                     ^^^^^^^^^
> in the module?


No. It must be from a subroutine that your calling program invokes.


> my $errror = mymodule::doSomething();
       ^^^
> if ($error) { print 'error' }
        ^^

There is an error in the error examples of your program
containing example errors.   :-)



> Is it time i learnt about fork?


Huh?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: 3 Jan 2007 03:21:59 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: How can i stop a module nicely?
Message-Id: <Xns98ACD9590126Ecastleamber@130.133.1.4>

"doolittle" <spam.meplease@ntlworld.com> wrote:
 
> Die and Croak are too drastic, as they stop perl, and I don't want to
> return an error up from doOne because it gets called from all over
> mymodule.pm, deep within the program.
> 
> Any suggestions? Is it time i learnt about fork?

Time you read

perldoc -f eval

and

http://search.cpan.org/search?query=exception&mode=all


-- 
John                Experienced Perl programmer: http://castleamber.com/

          Perl help, tutorials, and examples: http://johnbokma.com/perl/


------------------------------

Date: 2 Jan 2007 19:58:02 -0800
From: "grocery_stocker" <cdalten@gmail.com>
Subject: I'm not too sure if this is a perl question.....
Message-Id: <1167796681.884563.310830@42g2000cwt.googlegroups.com>

I have a question on the Firefox mork script found at:

http://www.jwz.org/hacks/mork.pl

##########################################################################
  # Read in the file.

##########################################################################
  open (IN, "<$file") || error ("$file: $!");
  print STDERR "$progname: reading $file...\n" if ($verbose);

  my $body = <IN>;
  close IN;

  $body =~ s/\r\n/\n/gs;    # Windows Mozilla uses \r\n
  $body =~ s/\r/\n/gs;      # Presumably Mac Mozilla is similarly dumb

  $body =~ s/\\\\/\$5C/gs;  # Sometimes backslash is quoted with a
                            #  backslash; convert to hex.
  $body =~ s/\\\)/\$29/gs;  # close-paren is quoted with a backslash;
                            #  convert to hex.
  $body =~ s/\\\n//gs;      # backslash at end of line is continuation.

I have a clear understanding of this part
$body =~ s/\r\n/\n/gs;    # Windows Mozilla uses \r\n
$body =~ s/\r/\n/gs;      # Presumably Mac Mozilla is similarly dumb

However, I don't understand this part.
$body =~ s/\\\\/\$5C/gs;  # Sometimes backslash is quoted with a
                            #  backslash; convert to hex.
$body =~ s/\\\)/\$29/gs;  # close-paren is quoted with a backslash;
                            #  convert to hex.
$body =~ s/\\\n//gs;      # backslash at end of line is continuation.

Let's see if I can break this down.
1)I really don't see when a backslash can be quoted as a backslash
(presum. in URL)
2)I see even less when there can be a close-paren with backslash.

Maybe if I understood this, I could maybe understand why it has to be
converted to hex.

Chad



------------------------------

Date: 3 Jan 2007 05:40:42 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: I'm not too sure if this is a perl question.....
Message-Id: <Xns98ACF0DE433D7castleamber@130.133.1.4>

"grocery_stocker" <cdalten@gmail.com> wrote:

> Let's see if I can break this down.
> 1)I really don't see when a backslash can be quoted as a backslash
> (presum. in URL)
> 2)I see even less when there can be a close-paren with backslash.
> 
> Maybe if I understood this, I could maybe understand why it has to be
> converted to hex.

If you read the rest of jwz's comments you should have learned fast enough 
that MORK is the biggest POS file format you'll probably every encounter 
in your life. 

Let's hope it will be dropped with Firefox 3.0 (If it hasn't been already)

-- 
John                Experienced Perl programmer: http://castleamber.com/

          Perl help, tutorials, and examples: http://johnbokma.com/perl/


------------------------------

Date: Wed, 3 Jan 2007 05:42:13 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Jan  3 2007
Message-Id: <JBA2ID.Jt1@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

AppConfig-1.64
http://search.cpan.org/~adamk/AppConfig-1.64/
Perl5 module for reading configuration files and parsing command line arguments.
----
CPAN-Inject-0.05
http://search.cpan.org/~adamk/CPAN-Inject-0.05/
Base class for injecting distributions into CPAN sources
----
CPAN-Test-Dummy-Perl5-Developer-0.01_01
http://search.cpan.org/~adamk/CPAN-Test-Dummy-Perl5-Developer-0.01_01/
CPAN Test Dummy developer sample module
----
Carp-Assert-0.19
http://search.cpan.org/~mschwern/Carp-Assert-0.19/
executable comments
----
Catalyst-Plugin-Server-0.24
http://search.cpan.org/~michiel/Catalyst-Plugin-Server-0.24/
Base Server plugin for RPC-able protocols
----
Compress-Raw-Bzip2-2.003
http://search.cpan.org/~pmqs/Compress-Raw-Bzip2-2.003/
Low-Level Interface to bzip2 compression library
----
Compress-Raw-Zlib-2.003
http://search.cpan.org/~pmqs/Compress-Raw-Zlib-2.003/
Low-Level Interface to zlib compression library
----
Compress-Zlib-2.003
http://search.cpan.org/~pmqs/Compress-Zlib-2.003/
Interface to zlib compression library
----
Config-Hierarchical-0.01
http://search.cpan.org/~nkh/Config-Hierarchical-0.01/
Hierarchical configuration container
----
Config-XPath-0.05
http://search.cpan.org/~pevans/Config-XPath-0.05/
a module for retrieving configuration data from XML files by using XPath queries
----
Data-TreeDumper-0.32
http://search.cpan.org/~nkh/Data-TreeDumper-0.32/
Improved replacement for Data::Dumper. Powerful filtering capability.
----
Debug-Mixin-0.01
http://search.cpan.org/~nkh/Debug-Mixin-0.01/
----
Devel-Cover-0.60
http://search.cpan.org/~pjcj/Devel-Cover-0.60/
Code coverage metrics for Perl
----
Error-Subclasses-0.02
http://search.cpan.org/~pevans/Error-Subclasses-0.02/
----
FCGI-Async-0.07
http://search.cpan.org/~pevans/FCGI-Async-0.07/
Module to allow use of FastCGI asynchronously
----
File-HomeDir-0.62
http://search.cpan.org/~adamk/File-HomeDir-0.62/
Find your home and other directories, on any platform
----
File-StatCache-0.04
http://search.cpan.org/~pevans/File-StatCache-0.04/
a caching wrapper around the stat() function
----
Filter-Uncomment-0.01
http://search.cpan.org/~nkh/Filter-Uncomment-0.01/
Efficiently uncomment sections of your code
----
Font-GlyphNames-0.02
http://search.cpan.org/~sprout/Font-GlyphNames-0.02/
Convert between glyph names and characters
----
Geo-Coordinates-DecimalDegrees-0.07
http://search.cpan.org/~waltman/Geo-Coordinates-DecimalDegrees-0.07/
convert between degrees/minutes/seconds and decimal degrees
----
IO-Compress-Base-2.003
http://search.cpan.org/~pmqs/IO-Compress-Base-2.003/
Base Class for IO::Compress modules
----
IO-Compress-Bzip2-2.003
http://search.cpan.org/~pmqs/IO-Compress-Bzip2-2.003/
Write bzip2 files/buffers
----
IO-Compress-Lzf-2.003
http://search.cpan.org/~pmqs/IO-Compress-Lzf-2.003/
Write lzf files/buffers
----
IO-Compress-Lzop-2.003
http://search.cpan.org/~pmqs/IO-Compress-Lzop-2.003/
Write lzop files/buffers
----
IO-Compress-Zlib-2.003
http://search.cpan.org/~pmqs/IO-Compress-Zlib-2.003/
----
IPC-PerlSSH-0.05
http://search.cpan.org/~pevans/IPC-PerlSSH-0.05/
a class for executing remote perl code over an SSH link
----
Imager-Screenshot-0.002
http://search.cpan.org/~tonyc/Imager-Screenshot-0.002/
screenshot to an Imager image
----
Konfidi-Client-1.0.2
http://search.cpan.org/~brondsem/Konfidi-Client-1.0.2/
Interact with a Konfidi TrustServer
----
Mixin-ExtraFields-Hive-0.002
http://search.cpan.org/~rjbs/Mixin-ExtraFields-Hive-0.002/
infest your objects with hives
----
Net-Address-Ethernet-1.092
http://search.cpan.org/~mthurn/Net-Address-Ethernet-1.092/
find hardware ethernet address
----
Net-Radius-Server-1.004
http://search.cpan.org/~luismunoz/Net-Radius-Server-1.004/
Framework for RADIUS Servers
----
PITA-Test-Dummy-Perl5-Build-1.02
http://search.cpan.org/~adamk/PITA-Test-Dummy-Perl5-Build-1.02/
Brian, the CPAN Test Dummy for PITA Build.PL installs
----
PITA-Test-Dummy-Perl5-Deps-1.01
http://search.cpan.org/~adamk/PITA-Test-Dummy-Perl5-Deps-1.01/
CPAN Test Dummy for PITA Makefile.PL installs
----
PITA-Test-Dummy-Perl5-MI-0.64
http://search.cpan.org/~adamk/PITA-Test-Dummy-Perl5-MI-0.64/
CPAN Test Dummy for testing Module::Install::With
----
PITA-Test-Dummy-Perl5-Make-1.03
http://search.cpan.org/~adamk/PITA-Test-Dummy-Perl5-Make-1.03/
CPAN Test Dummy for PITA Makefile.PL installs
----
PadWalker-1.3
http://search.cpan.org/~robin/PadWalker-1.3/
play with other peoples' lexical variables
----
RPC-Object-0.21
http://search.cpan.org/~jwu/RPC-Object-0.21/
A lightweight implementation for remote procedure calls
----
ShiftJIS-Regexp-1.00
http://search.cpan.org/~sadahiro/ShiftJIS-Regexp-1.00/
regular expressions in Shift-JIS
----
String-Expand-0.02
http://search.cpan.org/~pevans/String-Expand-0.02/
string utility functions for expanding variables in self-referential sets
----
SystemC-Vregs-1.430
http://search.cpan.org/~wsnyder/SystemC-Vregs-1.430/
Utility routines used by vregs
----
Text-CSV-Track-0.2
http://search.cpan.org/~jkutej/Text-CSV-Track-0.2/
module to work with .csv file that stores some value per identificator
----
Time-HiRes-Value-0.02
http://search.cpan.org/~pevans/Time-HiRes-Value-0.02/
a class representing a time value or interval in exact microseconds
----
Verilog-Pli-1.703
http://search.cpan.org/~wsnyder/Verilog-Pli-1.703/
Verilog PLI routine calls
----
WWW-Wikipedia-1.91
http://search.cpan.org/~esummers/WWW-Wikipedia-1.91/
Automated interface to the Wikipedia
----
WWW-Wikipedia-1.92
http://search.cpan.org/~bricas/WWW-Wikipedia-1.92/
Automated interface to the Wikipedia
----
pip-0.06
http://search.cpan.org/~adamk/pip-0.06/
Console application for running Perl 5 Installer (P5I) files
----
pler-0.16
http://search.cpan.org/~adamk/pler-0.16/
The DWIM Perl Debugger


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


------------------------------

Date: 2 Jan 2007 18:32:13 -0800
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: printing long decimal numbers
Message-Id: <1167791533.066798.185760@a3g2000cwd.googlegroups.com>

Mark Hobley wrote:
> How do I get Perl to display a long decimal number, without converting to
> scientific notation or rounding?
>
> print 6/45*5/44*4/43*3/42*2/41;
> 4.91095215995953e-06
>
> printf "%lf",6/45*5/44*4/43*3/42*2/41;
> 0.000005
>
> I would like the following output:
> 0.00000491095215995953

  my $result = 6/45*5/44*4/43*3/42*2/41;
  printf "%.20f\n",$result;

?

-jp



------------------------------

Date: 02 Jan 2007 16:56:26 -0700
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Problematic Perl code
Message-Id: <87fyatkmol.fsf@aragorn.emschwar>

"PerlNovice" <mfarid1@yahoo.com> writes:
> 1)I need to copy .zip files from Windows to my Unix folder and name the
> .zip files as something else, let's say, .txt. I then need
> to rename it back to .zip only when the entire file has been copied.

Why?

In any event, did you read the docs for Net::FTP?  Because in the
documentation for the get() method, which you use in your code, it
says explicitly:

       get ( REMOTE_FILE [, LOCAL_FILE [, WHERE]] )
           Get "REMOTE_FILE" from the server and store locally. "LOCAL_FILE"
           may be a filename or a filehandle. If not specified, the file will
           be stored in the current directory with the same leafname as the
           remote file.

It's not considered polite in this newsgroup to ask people to read
documentation for you if you can read it yourself.

> This is because I'll be unzipping the files later.

You can still do that if you don't rename them first, you know.

> There could be multiple .zip files in the Windows folder.

That's irrelevant to whether or not you rename them when you get them.

> 2)Once the file(s) are copied completely, a size comparison needs to be
> made between the Windows and Unix sides.

Again, in the docs for Net::FTP it says mentions the size() method.  I
leave it as an excercise for the reader to figure out how to use it,
and how to use the corresponding -s function on the local side (hint:
'perldoc -f -X')

> 3)If the sizes are the same, then I need to rename the .txt file back
> to the .zip file.

perldoc -f rename

> I would appreciate any help from anyone.

In return, I, and many others, would appreciate it if you would take a
bit of time before posting to read the relevant documentation you
already have on your hard drive before asking a bunch of people to do
it for you.

-=Eric



------------------------------

Date: Wed, 03 Jan 2007 09:43:28 +0000
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: Problematic Perl code
Message-Id: <TLOdnYHvCJhb5wbYnZ2dnUVZ8qCqnZ2d@bt.com>

PerlNovice wrote:
> I have the following Perl code:

But where? I'll assume its on your "Unix" computer and that 
"some.host.name" is your Windows computer.

> 
> -------------------------------------------------
> #!/usr/bin/perl
> use Net::FTP;
> $ftp = Net::FTP->new("some.host.name", Debug => 1)
>     or die "Cannot connect to some.host.name: $@";
> $ftp->login("anonymous",'-anonymous@')
>     or die "Cannot login ", $ftp->message;
> $ftp->cwd("/myfolder")
>     or die "Cannot change working directory ", $ftp->message;
> $ftp->binary;
> for( <*.zip> ){
>   $ftp->get($_,"tmp.$$") or die $!;
>   $ftp->rename("tmp.$$",$_) or die $!;
>   $ftp->size($_) == -s $_ or die "$_ sizes don't match";
> }
> $ftp->quit;
> -----------------------------------------------

I haven't tried the above but, from a superficial glance, it looks like 
it should work.

> 
> I need to do the following:
> 
> 1)I need to copy .zip files from Windows to my Unix folder and name the
> .zip files as something else, let's say, .txt. 

The code does that already!

> I then need
> to rename it back to .zip only when the entire file has been copied.

The code does that already!

> This is because I'll be unzipping the files later.
> There could be multiple .zip files in the Windows folder.
> 
> 2)Once the file(s) are copied completely, a size comparison needs to be
> made between the Windows and Unix sides.

The code does that already!

> 
> 3)If the sizes are the same, then I need to rename the .txt file back
> to the .zip file.

swap the order of the two lines that start $ftp->rename and $ftp->size

> I would appreciate any help from anyone.
> 

I must be missing something. You seem to be saying ...
   Here is a working solution.
   Here is the problem it solves.
   Help!

What exactly does the code do that you don't want it to do?


------------------------------

Date: 3 Jan 2007 05:59:38 -0800
From: felix.ostmann@thewar.de
Subject: Re: Problems with use locale and regexp
Message-Id: <1167832778.129080.9340@48g2000cwx.googlegroups.com>

is there any good solution at this time?

$content =~ s!^\[\[[a-z]{2}:.*.\]$!!gm; ## "\]\]" => ".\]"

Thanks for your help, what is the correct handling when i found
something like this? where is the perl-bug-tracking (or so). I never
use such a system bevor :(

On 2 Jan., 22:24, "Mumia W. (on aioe)"
<paduille.4060.mumi...@earthlink.net> wrote:
> On 01/02/2007 07:35 AM, anno4...@radom.zrz.tu-berlin.de wrote:
>
>
>
> >  <felix.ostm...@thewar.de> wrote in comp.lang.perl.misc:
> >> It is realy strange!
>
> >> first the code:
> >> #####################################
> >> #!/usr/bin/perl
>
> >> use strict;
> >> use warnings;
> >> use locale; ## WONT WORK
> >> use Encode;
>
> >> my $content = Encode::decode("iso-8859-15","[[lmo:Met\xE0j
> >> alcal\xEDtt]]\n");
>
> >> $content =~ s!^\[\[[a-z]{2}:.*\]\]$!!gm;  ## WONT WORK
> >> # $content =~ s!^\[\[[a-z]{2}:.*\]$!!gm;  ## WORK
>
> >> print $content;
> >> #####################################
>
> >> This bug? shocked me when i was parsing wikipedia-data.
>
> > You don't say what "WONT WORK" actually means.  Apparently the regex
> > match /^\[\[[a-z]{2}:.*\]\]/m never returns with your string and
> > locale in effect.  That certainly is a bug and if it's still in the
> > newest bleadperl (it still is in v5.9.4 DEVEL28658) it ought to be
> > reported.
>
> > BTW, I assume you are aware that you regex doesn't match (it shouldn't
> > loop endlessly, though).  The matching regex /^\[\[[a-z]{3}:.*\]\]/m
> > doesn't show the problem.
>
> > AnnoIt looks like a bug in the interpreter to me. Perl locks up when it sees
> the substitution operator. I wanted to create a better set of test
> cases, but I got distracted by more pressing things:
>
> #!/usr/local/bin/perl5.9.4
>
> use strict;
> use warnings;
> use locale; ## WONT WORK
> use Encode;
>
> printf "Perl %vd\n", $^V;
>
> local $\ = "\n";
> my $car = "[[taurus:vehicle\xE0^^]]\n";
> print enhex($car);
> $car = Encode::decode('iso-8859-15',$car);
> print enhex($car);
> # $car =~ s/^\[\[[a-z]{2}:.*\]\]$/substituted/gm; # LOCKS UP
> # $car =~ s/^\[\[[a-z]{2}:.*\][]]$/substituted/gm; # DOES NOT LOCK UP
> # $car =~ s/^\[\[[a-z]{2}:.*\]{2}$/substituted/gm; # LOCKS UP
> # $car =~ s/^\[\[[a-z]{6}:.*\]\]$/substituted/gm; # DOES NOT LOCK UP (MATCH)
> # $car =~ s/^\[\[[a-z]{5}:.*\]\]$/substituted/gm; # LOCKS UP
> # $car =~ s/^\[\[[a-z]{5}:.*\]\Q]\E$/substituted/gm; # LOCKS UP
> # $car =~ s/^\[\[[a-z]{5}:[^]]+\]\]$/substituted/gm; # LOCKS UP
> # $car =~ s/^..[a-z]{2}:.*\]\]$/substituted/gm; # DOES NOT LOCK UP
> $car =~ s/^\[{2}[a-z]{2}:.*\]{2}$/substituted/gm; # LOCKS UP
> print $car;
>
> sub enhex {
>      my $data = $_[0];
>      $data = unpack 'H*', $data;
>      $data =~ s/(..)/$1 /g;
>      $data;
>
> }__END__
>
> These things seem to be required to evoke the bug:
>
> The locale module must be used. The Encode module must be used to decode
> (tested only with iso-8859-15). Two instances of \] or something similar
> must appear in the regex. The regex must fail to match.
>
> It's too bad I don't have any more time for this.
>
> --
> paduille.4060.mumi...@earthlink.net
> Windows Vista and your freedom in conflict:http://www.badvista.org/



------------------------------

Date: Wed, 3 Jan 2007 14:53:08 +0100
From: "Andrea Petersen" <andreap@gmx.de>
Subject: regex problem
Message-Id: <engcg7$jtm$00$1@news.t-online.com>

Hello,

i'm new to using regex and working on the following problem for 6 hours now.
(damn)


<body>

<div>MATCH
<b>ONE</b></div>

<p> foobar </p>

<div>MATCH <b>TWO</b></div>

</body>


I want to extract the two strings between <div> and </div>. The new line in
the first div-tag drives me crazy.

Can somebody help me out with this? I'm searching for the regular expression
to match this tags.

regards,
Andrea




------------------------------

Date: 2 Jan 2007 18:47:18 -0800
From: rallabs@adelphia.net
Subject: Re: system command won't run with -T option on
Message-Id: <1167792434.907893.192710@s34g2000cwa.googlegroups.com>


Paul Lalli wrote:
> rall...@adelphia.net wrote:
> >  All the scripts I have written have been
> > successfully 'untainted' except for one that contains a  system
> > command.   I used the same procedure to untaint this script as I did
> > for all my others: I ran it through a search pattern and checked that
> > it's the proper format.  The scripts all work fine when I do this
> > except the one with the system command.  I pasted the script below.  It
> > runs successfully if the -T is removed, but when -T is present I get
> > the famous 'Internal Server Error'.  The error log says: "Insecure
> > $ENV{PATH} while running with -T switch"
>
> Right.  The error has nothing to do with the command itself.  It has to
> do with what other commands that command might run.
>
> > perlsec says I've got to supply a good path for the script to use, but
> > I don't know how to do it.  I can't figure out how to print out the
> > environment variable $ENV{PATH} anywhere.
>
> You do not need to print $ENV{PATH} anywhere, but if you wanted to, you
> would print it the same way you print anything else.  Regardless, you
> need to *set* $ENV{PATH}.  You need to set the path to be a sequence of
> directories from which you want to allow commands to be run.  So if
> your executable that you're calling via system calls the program
> "mycmd.exe", which directories should be searched for mycmd.exe?
>
> Paul Lalli

Paul:
Thanks for the advice.  I printed out $ENV{PATH} and it said
'/usr/local/bin:/usr/bin:/bin'
which doesn't have anything in it about any of my variables, but i then
tried:

$ENV{PATH}='/usr/local/bin:/usr/bin:/bin';

in the script and it seems to have done the job, because it runs now.
After 4 hrs. messing around with it I still don't understand why it
happened but I guess it's another of the very many Perl mysteries I'll
never get but I'll remember it always for when it happens again.  I
also wish I would have posted a lot earlier but my ego's weak and I
hate the criticism.  Thanks again.
Mike



------------------------------

Date: Tue, 02 Jan 2007 20:27:17 -0600
From: "Mumia W. (on aioe)" <paduille.4060.mumia.w@earthlink.net>
Subject: Re: system command won't run with -T option on
Message-Id: <enf6ca$gee$1@aioe.org>

On 01/02/2007 06:07 PM, rallabs@adelphia.net wrote:
> [...]
> I don't understand what to do about the problem if I've untainted the
> one piece of external data used.

By default, $ENV{PATH} is tainted, so any command that uses the PATH, 
such as system(), is insecure.

> perlsec says I've got to supply a good path for the script to use, but
> I don't know how to do it.  I can't figure out how to print out the
> environment variable $ENV{PATH} anywhere.
> [...]

print "PATH = $ENV{PATH}\n";
$ENV{PATH} = '/bin:/usr/bin:/usr/local/bin';
system('whatever');



-- 
paduille.4060.mumia.w@earthlink.net
Windows Vista and your freedom in conflict:
http://www.badvista.org/


------------------------------

Date: 2 Jan 2007 23:28:48 -0800
From: rallabs@adelphia.net
Subject: Re: system command won't run with -T option on
Message-Id: <1167809328.377874.172680@h40g2000cwb.googlegroups.com>


Mumia W. (on aioe) wrote:
> On 01/02/2007 06:07 PM, rallabs@adelphia.net wrote:
> > [...]
> > I don't understand what to do about the problem if I've untainted the
> > one piece of external data used.
>
> By default, $ENV{PATH} is tainted, so any command that uses the PATH,
> such as system(), is insecure.
>
> > perlsec says I've got to supply a good path for the script to use, but
> > I don't know how to do it.  I can't figure out how to print out the
> > environment variable $ENV{PATH} anywhere.
> > [...]
>
> print "PATH = $ENV{PATH}\n";
> $ENV{PATH} = '/bin:/usr/bin:/usr/local/bin';
> system('whatever');
>
>
> Mumia W.:
Thanks very much for the answer and the advice.  It's now running under
taint mode.
Mike
> --
> paduille.4060.mumia.w@earthlink.net
> Windows Vista and your freedom in conflict:
> http://www.badvista.org/



------------------------------

Date: 3 Jan 2007 03:20:30 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: system command won't run with -T option on
Message-Id: <1167823230.271522.323970@s34g2000cwa.googlegroups.com>

rallabs@adelphia.net wrote:
> Paul Lalli wrote:
> > You do not need to print $ENV{PATH} anywhere, but if you wanted to, you
> > would print it the same way you print anything else.  Regardless, you
> > need to *set* $ENV{PATH}.  You need to set the path to be a sequence of
> > directories from which you want to allow commands to be run.  So if
> > your executable that you're calling via system calls the program
> > "mycmd.exe", which directories should be searched for mycmd.exe?

> Thanks for the advice.  I printed out $ENV{PATH} and it said
> '/usr/local/bin:/usr/bin:/bin'
> which doesn't have anything in it about any of my variables,

Correct.  The "taintedness" of the PATH has nothing to do with
variables.  It has to do with the fact that the PATH, by default, comes
from the environment - that is, it comes from outside your script.  It
is tainted because it is theoretically possible for someone in the
environment to set a "bad" PATH before launching your script.  And if
they do that, you're screwed.  If your program calls 'mycmd.exe', and
the malicious user has set PATH to be "/my/really/nasty/viruses/" and
puts a very bad program named mycmd.exe in that PATH, you're in
trouble.  By defining the PATH within the script itself, you eliminate
that possibility.


> but i then tried:
>
> $ENV{PATH}='/usr/local/bin:/usr/bin:/bin';
>
> in the script and it seems to have done the job, because it runs now.
> After 4 hrs. messing around with it I still don't understand why it
> happened but I guess it's another of the very many Perl mysteries I'll
> never get

It's really not mysterious.  The -T flag simply insures that nothing
created or assigned outside of your program can influence your
program's execution.  The PATH is defined by the environment, unless
you specifically define it within your script.

Please let us know if you still don't understand.

Paul Lalli



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 10112
****************************************


home help back first fref pref prev next nref lref last post