[22332] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4553 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 12 00:05:57 2003

Date: Tue, 11 Feb 2003 21:05:09 -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           Tue, 11 Feb 2003     Volume: 10 Number: 4553

Today's topics:
        ANNOUNCE: Chipcard::CTAPI 0.1 <wolf@code-wizards.com>
    Re: Calling multiple versions of compress in one progra <goldbb2@earthlink.net>
        Cannot use additional modules!!?? (JZ)
    Re: Cannot use additional modules!!?? <noreply@gunnar.cc>
        Config::Abstract 0.11 available <ewt@avajadi.org>
    Re: Finding multiple repititions of a pattern (with num <goldbb2@earthlink.net>
        Finding multiple repititions of a pattern (with number  (Venugopal)
    Re: Finding multiple repititions of a pattern (with num <mgjv@tradingpost.com.au>
    Re: Finding multiple repititions of a pattern (with num <bwalton@rochester.rr.com>
    Re: Fork multiple children, read from their pipes (maybe)
    Re: Fork multiple children, read from their pipes (maybe)
    Re: Impossible to do CRLF->LF on Windows/Activestate? <kirkspam@alienbill.com>
    Re: Impossible to do CRLF->LF on Windows/Activestate? (Malcolm Dew-Jones)
        Indented Text to Nested DataStructure[Tricky or Easy?] (valued customer)
    Re: Indented Text to Nested DataStructure[Tricky or Eas <goldbb2@earthlink.net>
        MHonArc v2.6.0 (Earl Hood)
    Re: newbie date comparison <Jodyman@hotmail.com>
    Re: Paging output <krahnj@acm.org>
    Re: Perl+Tk+MySQL for Win32 that *works*? <randy@theoryx5.uwinnipeg.ca>
    Re: PersistentPerl never resolves first time through <goldbb2@earthlink.net>
    Re: Request help with this script (Julia Briggs)
    Re: Security bug in CGI::Lite::escape_dangerous_chars() (Malcolm Dew-Jones)
    Re: strict and warnings <abigail@abigail.nl>
    Re: Variation on iterating through a string <dug@plusthree.com>
    Re: Variation on iterating through a string <goldbb2@earthlink.net>
        Wanted: open source documentation reviewer <nrm@remove.no.spam.kingtide.com.au>
        Warnings in modules <noreply@gunnar.cc>
    Re: Why won't my for loop work? (Anno Siegel)
    Re: Why won't my for loop work? (Karen Lofstrom)
    Re: Why won't my for loop work? <mgjv@tradingpost.com.au>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 09 Feb 2003 11:54:43 +0100
From: "Wolfgang Hommel" <wolf@code-wizards.com>
Subject: ANNOUNCE: Chipcard::CTAPI 0.1
Message-Id: <3e4974ed$1_6@news.teranews.com>

Chipcard::CTAPI enables Perl programs to communicate with chipcard
terminals based on the low-level CTAPI driver.

CTAPI is an industry standard for accessing chipcard terminals. CTAPI
drivers are available for all popular card readers. Chipcard::CTAPI is a
Perl module which allows direct access to both memory cards and processor
cards (smartcards) based on the CTAPI library. Besides the CTAPI functions
themselves, Chipcard::CTAPI provides a series of convenience methods for
easy reading and writing of memory cards.

Using CTAPI often has advantages over using the other popular card
terminal framework, PC/SC. Most noticable is that setting up the CTAPI
drivers is an easy task even for less advanced end users and that it has
no run-time overhead. PC/SC on the other hand requires more work to set up
and results in a daemon process running all the time. Thus, using CTAPI is
ideal when writing applications which can make use of chipcards but don't
focus on the communication with the card terminal too much.

Chipcard::CTAPI is well documented and comes with a couple of demo
applications.

Available from: $CPAN/authors/id/W/WH/WHOM/Chipcard-CTAPI-0.1.tar.gz

Documentation online:
http://theoryx5.uwinnipeg.ca/CPAN/data/Chipcard-CTAPI/CTAPI.html




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

Date: Tue, 11 Feb 2003 21:59:10 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Calling multiple versions of compress in one program
Message-Id: <3E49B87E.9133C11D@earthlink.net>

Bruce Barnett wrote:
> 
> I'm comparing different compression algorithms in one program.
> Example code:
> ---------------------
> #!/local/bin/perl -w
> 
> use strict;
> use Compress::Zlib qw(compress);

Here you import the compress sub from C::Zlib.

> use Compress::LZF;

Here, you don't *explicitly* import anything, but allow C::LZF export
whatever it wants to.

It, of course, tries to export it's own compress subroutine.

[snip]
> Subroutine main::compress redefined at
[snip]
> Anyway to eliminate the errors? Thanks.

Yes.  Don't import any subroutines from the Compress modules.

   #!/local/bin/perl -w
   use strict;
   use warnings;
   use Compress::Zlib ();
   use Compress::LZF  ();
   sub C1 {
      my ($arg) = @_;
      package Compress::Zlib;
      return compress( $arg, Z_BEST_COMPRESSION() );
   }
   sub C2 {
      my ($arg) = @_;
      package Compress::LZF;
      return compress( $arg );
   }
   for my $a ( "a" x 25, "abcde" x 5, join("",'a'..'y') ) {
      print join(" ", map length, $a, C1($a), C2($a)), "\n";
   }
   __END__

> I can use eval, I suppose...

Actually, no, that wouldn't help you avoid the problem.

-- 
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
 landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"


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

Date: 11 Feb 2003 15:12:23 -0800
From: ibm_97@yahoo.com (JZ)
Subject: Cannot use additional modules!!??
Message-Id: <10bc841c.0302111512.172b8bc3@posting.google.com>

Since default Perl on Solaris 8 doesn't have large file support
(right?), I compiled and installed my own Perl 5.8 as a non-root user.
installation is fine. Also I successfully installed DBI and DBD
modules under the new perl. Everything works cool.

Now I transferred entire my Perl into another Solaris 8 box, but it's
in different location. Now my simple testing script (t.pl) doesn't
work at all:

#!perl/bin/perl -w
push(@INC,"/tmp/migration/perllib-sun/");
use DBI;

The error message is :
Can't locate DBI.pm in @INC (@INC contains:
/export/home/oracle/migration/perl/lib/5.8.0/sun4-solaris
/export/home/oracle/migration/perl/lib/5.8.0
/export/home/oracle/migration/perl/lib/site_perl/5.8.0/sun4-solaris
/export/home/oracle/migration/perl/lib/site_perl/5.8.0
/export/home/oracle/migration/perl/lib/site_perl .) at ./t.pl line 2.
BEGIN failed--compilation aborted at ./t.pl line 2.

Same error with 'use lib' statement.

Here is "ls -l /tmp/migration/perllib-sun/":

drwxr-xr-x   2 oracle   dba          180 Jan 20  2003 Bundle
drwxr-xr-x   2 oracle   dba          447 Jan 20  2003 DBD
drwxr-xr-x   4 oracle   dba          990 Jan 20  2003 DBI
-r--r--r--   1 oracle   dba       207934 Dec  1 17:36 DBI.pm
-r--r--r--   1 oracle   dba        27606 Aug  6  2001 Oraperl.pm
drwxr-xr-x   2 oracle   dba          184 Jan 20  2003 Win32
drwxr-xr-x   4 oracle   dba          237 Jan 20  2003 auto
-r--r--r--   1 oracle   dba         1292 May  2  2000 oraperl.ph
-rw-r--r--   1 oracle   dba          525 Jan 20  2003 perllocal.pod


It contains DBI and DBD modules.

The thing bothers me is why @INC deesn't have the new value which I
'push' into. And it only includes the default values which were get
from original machine.

Anything wrong when I configure Perl or installation? I didn't get any
errors...


Thanks a lot!!!!


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

Date: Wed, 12 Feb 2003 02:02:55 GMT
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Cannot use additional modules!!??
Message-Id: <jXh2a.10672$LY2.632407@newsc.telia.net>

JZ wrote:
> Now my simple testing script (t.pl) doesn't work at all:
> 
> #!perl/bin/perl -w
> push(@INC,"/tmp/migration/perllib-sun/");
> use DBI;

That shouldn't work, since the second line isn't executed until runtime, 
while 'use DBI;' is done during the compilation.

> Same error with 'use lib' statement.

That should make a difference, provided that lib.pm is available in the 
Perl search path. As an experiment you could try:

     #!perl/bin/perl -w
     BEGIN { push(@INC,"/tmp/migration/perllib-sun/") }
     use DBI;

By putting the second line within a BEGIN block, it's done during 
compile time.

/ Gunnar

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Tue, 11 Feb 2003 12:00:05 +0000
From: Eddie Olsson <ewt@avajadi.org>
Subject: Config::Abstract 0.11 available
Message-Id: <3e49750d$1_3@news.teranews.com>

This module, together with the first implementation module for it,
Config::Abstract::Ini, is the first small step towards creating a
generic interface for handling config-type files.
 Its features include easy conversion between supported fileformats
(.ini and Data::Dumper format so far) as well as file-format independent
diff/patch functionality. This version introduces the diff functionality
and the next will have the patch functionality aswell.

While this is quite obviously work at the very early stages of progress,
I invite anyone interested in this type of functionality to have a look
and come with suggestions for future development. Most specifically, I'd
like to know if there are any specific fileformats that you'd want
implemented.

This is my first CPAN module (and announcement) so be gentle :)

/Avajadi
-- 
Eddie Olsson <ewt@avajadi.org>
=======================================================================
Fingerprint: 2778 87FA 6708 58C0 8261 DFEB C8FA 4591 6E36 FCCB 
Key ID: 6E36FCCB
`Those who desire  to give up  freedom in order to gain security will
not have, nor do they deserve, either one.' - Thomas Jefferson




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

Date: Tue, 11 Feb 2003 21:39:58 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Finding multiple repititions of a pattern (with number of  repititions unknown)
Message-Id: <3E49B3FE.68886F21@earthlink.net>

Venugopal wrote:
> 
> Hi,
> 
> I have a string of the form
> .....PATTERN[num1]...PATTERN[num2]....PATTERN[numN]
> 
> PATTERN is fixed, but the number of repitions N is not.
> I want to extract the variables num1,num2,...numN
> 
> How do I this in Perl?

my @nums = $data =~ /PATTERN\[(.*?)\]/g;

-- 
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
 landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"


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

Date: 11 Feb 2003 17:09:48 -0800
From: balasubv@hotmail.com (Venugopal)
Subject: Finding multiple repititions of a pattern (with number of repititions unknown)
Message-Id: <68041301.0302111709.5b9fb276@posting.google.com>

Hi,

I have a string of the form
 .....PATTERN[num1]...PATTERN[num2]....PATTERN[numN]

PATTERN is fixed, but the number of repitions N is not.
I want to extract the variables num1,num2,...numN

How do I this in Perl? 

My knowledge of regular expressions is limited to searching 
with a fixed, known number of repititions!

Thanks,
Venugopal


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

Date: Wed, 12 Feb 2003 01:45:30 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Finding multiple repititions of a pattern (with number of repititions unknown)
Message-Id: <slrnb4j9pq.se5.mgjv@verbruggen.comdyn.com.au>

On 11 Feb 2003 17:09:48 -0800,
        Venugopal <balasubv@hotmail.com> wrote:
> Hi,
> 
> I have a string of the form
> .....PATTERN[num1]...PATTERN[num2]....PATTERN[numN]

Please, don't give us data like this. Rather, give us real examples,
and/or real Perl code that creates a variable with real data. It is
rather important to know what's in those dots, and rather than us
guessing and assuming, only to find later that one of those
assumptions weas wrong, you should just provide real data. 

I'm going to assume that you literally meant:

my $foo = '.....PATTERN[num1]...PATTERN[num2]....PATTERN[numN]';
 
> PATTERN is fixed, but the number of repitions N is not.
> I want to extract the variables num1,num2,...numN
> 
> How do I this in Perl? 

Assuming that you have no occurence of PATTERN followed by an opening
bracket except for the ones in your example string:

my @vars = $foo =~ /\QPATTERN[\E(num[^]]+)]/g;

Note that this will not match "PATTERN[foo1]", or "PATTERN [num3]":
I've taken your example string quite literally, and have been
restrictive about what can match. If that isn't correct, please
provide real data.

More readably, since all the brackets make it look like line noise:

my @vars = $foo =~ m{

    \Q              # start escaping
      PATTERN[      # literal (thanks to the escaping)
    \E              # end escaping
    (               # start capturing
      num           # literal
      [^]]+         # any character, except ], as many times as possible
    )               # end capturing
    ]               # literal ]

}gx;

If the "num" bit is not actually there:

my @vars = $foo =~ /\QPATTERN[\E([^]]+)]/g;


The \Q\E make sure that any characters in "PATTERN[" are properly
escaped to be taken literally (and [ does need to be escaped). I chose
to do it that way, instead of using PATTERN\[, because no one here has
any idea of what PATTERN might contain, except you.

> My knowledge of regular expressions is limited to searching 
> with a fixed, known number of repititions!

See the perlop and perlre documentation. Look up "m/PATTERN/cgimosx"
in the section "Regexp Quote-Like Operators" of perlop, and all the
bits and pieces of the regex in perlre.

The perlop documentation explains the /g flag, which in this context
makes the operation return a list of all matches. There are examples
in the perlop documentation.

Martien
-- 
                        | 
Martien Verbruggen      | 
Trading Post Australia  | Can't say that it is, 'cause it ain't.
                        | 


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

Date: Wed, 12 Feb 2003 03:32:01 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Finding multiple repititions of a pattern (with number of repititions unknown)
Message-Id: <3E49BFCF.6090105@rochester.rr.com>

Venugopal wrote:

 ...
> I have a string of the form
> .....PATTERN[num1]...PATTERN[num2]....PATTERN[numN]
> 
> PATTERN is fixed, but the number of repitions N is not.
> I want to extract the variables num1,num2,...numN
> 
> How do I this in Perl? 
 ...


> Venugopal
> 


Here is a complete example, assuming that the ... in your above 
expression means match any three characters:


use Data::Dumper;
use re 'eval';
use warnings;
use strict;
#string to match...
my $var='12345aaaaaa123bbb123ccccccc123dddddd';
my @pat;
$pat[0]=qr/a/; #define some patterns
$pat[1]=qr/b/;
$pat[2]=qr/cc|c/;
$pat[3]=qr/dd/;
my $npatterns=@pat; #number of patterns to match
my $var1=$var; #destructive technique, save original
$var1=~s/..//; #get rid of first two characters
my @matchcount;
for my $c(0..$npatterns-1){
    $var1=~s/...(?:$pat[$c](?{$matchcount[$c]++}))*//;
}
print Dumper(\@matchcount);

HTH.
-- 
Bob Walton



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

Date: Tue, 11 Feb 2003 23:23:59 -0000
From: Jacqui or (maybe) Pete <porjes@spamcop.net>
Subject: Re: Fork multiple children, read from their pipes
Message-Id: <MPG.18b3966cba78553d9897dc@news.CIS.DFN.DE>

In article <b2brkh$p8v$1@mamenchi.zrz.TU-Berlin.DE>, anno4000
@lublin.zrz.tu-berlin.de says...
> Jacqui or (maybe) Pete  <porjes@spamcop.net> wrote in comp.lang.perl.misc:
> > I've been trying to spawn some child processes and read from their 
> > various STDOUT's via pipes.  I've read faq's, docs, & books until my 
> > eyes have crossed (maybe that's the problem).  Any clues / pointers to 
> > resources very much welcomed.
> > 
> > My current (no doubt severely duff) code is:
 ...
my ($to_parent, %files, $I, $fh);
 ...
> No, it isn't.  Please use copy/paste to transfer code into an article.
> You have some unnecessary typos below.
I did - I can't run the code at all on my PC, and I didn't see any 
errors when run at my ISP. but this is definitely exactly the code I'm 
running.
 ...
> > for ($I = 0; $I < NKIDS; $I++) {
> >     if ( open($fh,"-|"))  {
>                 ^^^
> Here is your problem.  Because the my() declaration of $fh is outside
> the loop, $fh keeps its value from one round to the next, so the
> second time through $fh contains a valid filehandle.  open()ing it again
> first closes it, then opens it with the new file (well, process).

Ah!  I didn't know that. Makes perfect sence now you point it out.

> Take the declaration of $fh out of the top my() and rewrite open() as
> "open( my $fh, '-|')".  That will resolve the issue.  While you're
> at it, move all my() declarations to the first use of the variable.
> 
> >         $files{$i} = $fh;
>                   ^
> That's an undeclared variable (case matters).  It wouldn't compile
> under strict, so it can't be your actual code.
?? 

Thanks indeed for your help.

-- 
Your site's most important visitors are completely blind, 
totally deaf, and use browsers you've never seen. 


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

Date: Tue, 11 Feb 2003 23:24:50 -0000
From: Jacqui or (maybe) Pete <porjes@spamcop.net>
Subject: Re: Fork multiple children, read from their pipes
Message-Id: <MPG.18b3969af4c756b89897dd@news.CIS.DFN.DE>

In article <x5f2a.10654$LY2.631528@newsc.telia.net>, noreply@gunnar.cc 
says...
> Jacqui or (maybe) Pete wrote:
> > I've been trying to spawn some child processes ... Any clues / pointers to 
> > resources very much welcomed.
> 
> I have found the CPAN module Parallel::ForkManager useful.
> 
I'll check it out - thanks for the pointer.
-- 
Your site's most important visitors are completely blind, 
totally deaf, and use browsers you've never seen. 


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

Date: Tue, 11 Feb 2003 23:21:49 GMT
From: Kirk Is <kirkspam@alienbill.com>
Subject: Re: Impossible to do CRLF->LF on Windows/Activestate?
Message-Id: <hAf2a.456$Y2.16852@news.tufts.edu>

Jeff Zucker <jeff@vpservices.com> wrote:

>    perl -e "binmode STDOUT;while(<>){print}"<dos.txt>unix.txt

Very nice.

Sorry for giving so many examples with stupid mistakes;
the thing was, since the underlying principle was, to me, wacky,
I couldn't anything to work, so it was hard to tell the stupid
mistakes code from the code that was running up against the 
fundamental issue.

I did look into binmode...but I thought if I ran it against 
STDIN, it would work.  When print chr(13) failed to work, 
I knew I was beat


-- 
QUOTEBLOG: http://kisrael.com   SKEPTIC MORTALITY: http://kisrael.com/mortal
Love is two crickets hopping in the same direction --W.T.Vollmann


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

Date: 11 Feb 2003 17:16:37 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Impossible to do CRLF->LF on Windows/Activestate?
Message-Id: <3e49a075@news.victoria.tc.ca>

Bob Walton (bwalton@rochester.rr.com) wrote:

: There is another, deeper question, though:  Why do you want to make 
: Unix-format or MAC-format text files on a PC?  Does not the software you 
: are using to transport files between platforms solve this problem 
: automatically for you?

How about everytime you download a unix tar ball onto a pc, perhaps to
examine its documentation.



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

Date: 11 Feb 2003 18:34:53 -0800
From: scooterm@hotmail.com (valued customer)
Subject: Indented Text to Nested DataStructure[Tricky or Easy?]
Message-Id: <1b347673.0302111834.a9ba3d3@posting.google.com>

==== Problem Input
Here is the problem, I start with something like 
THIS:

SECTION 1
    Hello World Blah blah blah.
    Hello again, Blah blah blah.

    SECTION 1.1
        Here's more blah blah blah.
        Blahdy bladhy blay bloo foo.

==== Desired Output
And I want to end up with something like
THIS:

<root>
<txt>SECTION 1</txt>   
    <sub>
    <txt>Hello World Blah blah blah.</txt>
    <txt>Hello again, Blah blah blah.</txt>
    <txt>SECTION 1.1</txt>
        <sub>
            <txt>Here's more blah blah blah.</txt>
            <txt>Blahdy bladhy blay bloo foo.</txt>
        </sub>
    </sub>
</root>

==== Details
I want a general approach that will allow me to take plain formatted
text like the problem input above and convert it to any arbitrary
nested
data structure. The output doesn't have to be XML, it can be a native
perl data structure, but the thing is I need it to be nested, such
that
proper 'open' and 'close' nesting surrounds the various text blurbs.

The only formatting in the input text will be the 'indentation'.
Indentation
is defined as four spaces per indent level (i.e., zero spaces = indent
level zero; four spaces = indent level one; eight spaces = indent
level two; ... and so forth).

What is the best way to do this? Should I use Text::Balanced? Can I
get away
with doing a simple search and replace? Do I have to use a recursive
function?

I am not a total perl novice, just someone trying to determine if this
is an easy thing that should be easy, or a hard thing that should be
possible.

Any advice greatly appreaciated!


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

Date: Tue, 11 Feb 2003 22:38:26 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Indented Text to Nested DataStructure[Tricky or Easy?]
Message-Id: <3E49C1B2.D6622CD1@earthlink.net>

valued customer wrote:
> 
> ==== Problem Input
> Here is the problem, I start with something like
> THIS:
> 
> SECTION 1
>     Hello World Blah blah blah.
>     Hello again, Blah blah blah.
> 
>     SECTION 1.1
>         Here's more blah blah blah.
>         Blahdy bladhy blay bloo foo.
> 
> ==== Desired Output
> And I want to end up with something like
> THIS:
> 
> <root>
> <txt>SECTION 1</txt>
>     <sub>
>     <txt>Hello World Blah blah blah.</txt>
>     <txt>Hello again, Blah blah blah.</txt>
>     <txt>SECTION 1.1</txt>
>         <sub>
>             <txt>Here's more blah blah blah.</txt>
>             <txt>Blahdy bladhy blay bloo foo.</txt>
>         </sub>
>     </sub>
> </root>
[snip]

Hmm...

Assuming that your data is well formed, perhaps something like the
following will do:

   #!/usr/bin/perl -w
   use strict;
   use warnings;
   my @depths = (0);
   print "<root>\n";
   while( <> ) {
      my ($ws, $txt) = m/^([ \t]*)(.*)/;
      next unless length;
      # normalize whitespace.
      $ws =~ s/( *)\t(\t*)/
         $1 .
         (" " x (8 - (length($1)&7))) .
         "        " x length($2);
      /ge;
      my $wsl = length $ws;
      while( $wsl < $depths[-1] ) {
         print " " x pop(@depths), "</sub>\n"
      }
      if( $wsl > $depths[-1] ) {
         push @depths, $wsl;
         print $ws, "<sub>\n";
      }
      print $ws, "<txt>", $txt, "</txt>\n"
         if length $txt;
   }
   while( @depths > 1 ) {
      print " " x pop(@depths), "</sub>\n"
   }
   print "<root>\n";
   __END__
[tested]

This was only tested on the sample data you gave... I hope that it works
ok on your real data.

-- 
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
 landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"


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

Date: Mon, 10 Feb 2003 05:54:45 GMT
From: ehood@earlhood.com (Earl Hood)
Subject: MHonArc v2.6.0
Message-Id: <3e497500$1_3@news.teranews.com>

MHonArc v2.6.0 has been released.  MHonArc is a Perl mail-to-HTML
converter.  MHonArc provides HTML mail archiving with index, mail
thread linking, etc; plus other capabilities including support for
MIME and powerful user customization features.

Several releases of MHonArc have been made since the
last announcement to comp.lang.perl.announce, so goto
<http://www.mhonarc.org/MHonArc/CHANGES> to view MHonArc's
change history.  New releases are always announced on the
mhonarc-users@mhonarc.org mailing list and on Freshmeat,
<http://freshmeat.net/projects/mhonarc/>.

More information about MHonArc, including availablity, is located
at <http://www.mhonarc.org/>

The MHonArc distribution has entered CPAN as

  file: $CPAN/authors/id/E/EH/EHOOD/MHonArc2.6.0.tar.gz
  size: 1865917 bytes
  md5: 206d20256aae9fe59e5d203dcce6fdec

--ewh
-- 
Earl Hood, <earl@earlhood.com>
Web: <http://www.earlhood.com/>
PGP Public Key: <http://www.earlhood.com/gpgpubkey.txt>




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

Date: Wed, 12 Feb 2003 04:56:29 GMT
From: "Jodyman" <Jodyman@hotmail.com>
Subject: Re: newbie date comparison
Message-Id: <1uk2a.12460$1q2.1194304@newsread2.prod.itd.earthlink.net>

"Andy" <post@forum.please> wrote in message ..

> How can I arithmetically compare 2 dates.

    I just had the same situation trying to validate files
that were created yesterday.  A great module to use
is Date::Calc.  You can load it on your windows box
by using ppm and entering:  install date-calc and then
quit when it's finished downloading.

    In your case use it like this:

use Date::Calc qw(Add_Delta_Days);

$delta_days = -2;  # or any number of days from current day

# set $yr with either a 2 digit or 4 digit year, $mo with current month and
$day with current day
# if you send it a 4 digit year, it will return a 4 digit year

($new_year, $new_month, $new_day) = Add_Delta_Days($yr, $mo, $day,
$delta_days);

if ($new_month < 10) { $new_month = "0$new_month"; }
if ($new_day < 10) { $new_day = "0$new_day"; }
if ($new_year < 10) { $new_year = "0$new_year"; }

#in my case, i was looking for a 2 digit year, 2 digit month, and 2 digit
day
#the module would return 2 2 3 in $new_month, $new_day and $new_year
respectively
#To compare with the fixed windows expressions of 02-02-03 for WIN98
#and 02/02/03 for WINNT I added the 0 (zero) in front of what they gave me.

#$today = "$mo-$day-$yr";        # WIN98
#$yesterday = "$new_month-$new_day-$new_year";      # WIN98
$today = "$mo/$day/$yr";        # WINNT
$yesterday = "$new_month/$new_day/$new_year";      # WINNT

Hope this helps, I was going to write a date to julian, julian back to date
sub but
it got too complicated.  Then again, why re-invent the wheel when someone
has
done it for you??

Jody




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

Date: Wed, 12 Feb 2003 05:00:08 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Paging output
Message-Id: <3E49D4A6.CCD3CC3@acm.org>

Benjamin Goldberg wrote:
> 
> Anirban Banerjee wrote:
> >
> > How do I do it inside the perl script? I mean everything, even
> > <tab><tab> ( I am using ReadLine ) should give me paged output, and
> > this should be transparent to the individual functions.
> 
> To page perl's output, you can do:
> 
>    if( -t STDOUT ) {
>       my @pagers = qw(less more pg);
>       unshift @pagers, $ENV{MORE} if exists $ENV{MORE};

Shouldn't that use $ENV{PAGER}?  That's what it is on my system.


John
-- 
use Perl;
program
fulfillment


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

Date: Tue, 11 Feb 2003 22:24:25 -0600
From: "Randy Kobes" <randy@theoryx5.uwinnipeg.ca>
Subject: Re: Perl+Tk+MySQL for Win32 that *works*?
Message-Id: <N%j2a.41457$7_.177426@news1.mts.net>

"Jim Seymour" <gort@LinxNet.com> wrote in message
 news:v4ivrhh0jurj27@corp.supernews.com...
> I thought it might be interesting to experiment with the idea of
> building some cross-platform, enterprise-style applications using
> Perl, Perl/Tk and MySQL.  So I haul out the ol' company laptop, boot
> it into Win95 OSR2 and...
>
> Install ActivePerl 5.8.0 build 805.  The experimental Perl/Tk thing
> I'd been fooling with worked.  So...
>
> "ppm install dbi" works
>
> "ppm install dbd-mysql"
>
> No such thing?  Look around, find dbd-mysqlPP.  Install that.  Find
> out I have to rename the driver (in my code) to "mysqlPP".  *sigh*
> There's a stroke of brilliance on somebody's part :(.
> Okay, I can probably work-around that issue in my code.  But the
> program fails, complaining of something to do with "strings outside"
> something-or-other.  (Sorry, didn't write it down.)

There's a ppm package of DBD-mysql for builds 8xx at
   http://theoryx5.uwinnipeg.ca/ppms/
which you can access by setting the repository within the
ppm shell to
  http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer58
After installing this, you have to add the path to your mysql dlls
(eg, C:\mysql\lib\opt\, where libmySQL.dll lives) to your PATH
environment variable. Alternatively, copy libmySQL.dll to
somewhere in your PATH, or else to the directory where the Perl
mysql.dll is (eg, C:\Perl\site\lib\auto\DBD\mysql\).

> Find out that DBD-Mysql *does* exist for 6xx builds.  Remove the 805
> build and install ActivePerl 5.6.1 build 635.  Download the
> "6xx-builds-only" DBI and DBD-Mysql zip files, unpack them and "ppm
> install blurfl.ppd" for each.  Ppm says they install.  Try my code
> again.  Perl says there's no "mysql" DBD.  Do a "ppm query." Yup,
> there all right.  Finally remove the DBD-Mysql module and try a
> straight "ppm install DBD-mysql."  Ppm says there ain't no such
> thing.

Some people have found problems in installing an 8xx build,
then uninstalling it, then installing a 6xx build - it may be that
some remnant files of the 8xx build survived the uninstall. Perhaps
try deleting the installation directory before installation.

> Very frustrating day :/
>
> <rant>
> Of all the things I've installed on various flavours of *nix over the
> years, Perl and the modules developed for it have been amongst the
> most consistent in ease of build/install.  If not *the* most reliable
> and consistent.  IIRC, out of all the builds and installs of Perl and
> Perl modules I've done over the years, I've only *once* had one
> fail.  I had been *hoping* for a similar experience with Perl on
> Windows.  Tho, given my experience with Windows over the years,
> perhaps I should've known better...
> </rant>

If you have the C compiler, building is usually more bullet-proof
than installing binaries. Have you not had bad experiences installing
rpms with dependencies?

> The question is: is there a Perl distribution for Win32 (95, 98, ME,
> NT4, 2k and XP) that *works*?  Along with Perl/Tk, DBI and DBD-MySQL
> modules that *work*?  And would I be able to count on this stuff
> being *actively* maintained/developed?  Or should I give up on the
> idea?

ActivePerl is the dominant Win32 Perl binary distribution, and it
"works" - check out the perl-win32 mailing lists at ActiveState.
The DBD-mysql ppm package for ActivePerl 8xx referenced
above I know works for many people, after getting libmySQL.dll
in the right place. And oft-used packages like these are actively
maintained.

best regards,
randy kobes





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

Date: Tue, 11 Feb 2003 22:40:59 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: PersistentPerl never resolves first time through
Message-Id: <3E49C24B.56BAC210@earthlink.net>

Todd Boss wrote:
> 
> Hello.
> 
> we're using PersistentPerl (formerly known as SpeedyCGI) to help speed
> up a large perl-based web app.  Solaris box, Iplanet webserver,
> connecting to an Oracle database via DBI::Oracle.
[snip]

I've no idea why your problem is happening, *but* I've an idea for a
sort-of workaround:

How much of your site has been adapted to use perperl?  Is it to late
for you to consider fastcgi instead?

-- 
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
 landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"


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

Date: 11 Feb 2003 17:27:24 -0800
From: julia4_me@yahoo.com (Julia Briggs)
Subject: Re: Request help with this script
Message-Id: <c48f65ef.0302111727.6a7eb584@posting.google.com>

> Whoever is giving this code away doesn't have a grasp of fundamental
> security issues.  For the most benign exploit, it is trivially
> compromised into becoming a spam gateway.
> 
> More harmful but equally trivial, a person can use this code to run
> any program he wants on your machine.
> 
> Do not use this code.  If it is up and running, remove it immediately.

EEP! Using the above mentioned changes, will it prevent what you are
speaking of here (running other programs )??


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

Date: 11 Feb 2003 15:08:09 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Security bug in CGI::Lite::escape_dangerous_chars() function
Message-Id: <3e498259@news.victoria.tc.ca>

Benjamin Goldberg (goldbb2@earthlink.net) wrote:

: If you don't like the function -- don't use it.  Use perl's builtin
: quotemeta operator instead.

My only issue with that is that the quoting necessary to make the
statement safe will depend on how it is to be used (i.e. which shell or
other program will be using the input).

It is only a coincidence that `quotemeta' (apparently) makes things safe
for common unix shells. 

E.g. Another message recently had an error trying to quote input used by
`perl` run from within perl.  This was probably caused because the
statement probably involves spawning a shell which then spawns perl and so
at least some parts of the command line would need to be quoted twice to
make it all work.

	$cmd_data = quotemeta(quotemeta($raw_data));


: Also -- consider using the -T command-line option, to enable tainting.

Be careful however, since if you use a generic quoter function then you
may fall into the trap of assuming the quoted data is now ok, and
therefore you'll untaint the result (if the quote function hasn't already) 
and the taint mode will just give you a false sense of security.

: In any case, anyone writing cgi programs really ought to read perldoc
: perlsec, and make his own decisions about what's safe.




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

Date: 12 Feb 2003 00:06:21 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: strict and warnings
Message-Id: <slrnb4j3vt.qnk.abigail@alexandra.abigail.nl>

Gunnar Hjalmarsson (noreply@gunnar.cc) wrote on MMMCDLI September
MCMXCIII in <URL:news:tWd2a.10634$LY2.631198@newsc.telia.net>:
][  
][  Fortunately, in this case, there are no warnings to remove; neither 
][  would the module give rise to any warnings if it was enabled. :)  I just 
][  mentioned it in response to your asking why not -w. After all, some CPAN 
][  modules include 'use warnings;', and one of the reasons for bringing up 
][  this subject was that I wondered if enabling warnings in the module 
][  would be considered an improvement. Obviously you think I'd better 
][  refrain from enabling it.


I'd suggest you enable them. The person running a program that would
make use of such a module could always turn the warnings off by
using the -X switch.



Abigail
-- 
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
 |perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
 |perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
 |perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;


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

Date: Tue, 11 Feb 2003 23:32:03 GMT
From: Douglas Hunter <dug@plusthree.com>
Subject: Re: Variation on iterating through a string
Message-Id: <TJf2a.11890$1q2.1143535@newsread2.prod.itd.earthlink.net>

Anno Siegel wrote:
> Ala Qumsieh  <qumsieh@cim.mcgill.ca> wrote in comp.lang.perl.misc:
> 
>>On Tue, 11 Feb 2003, Benjamin Goldberg wrote:
>>
>>
>>>Matthew Lockner wrote:
>>>
>>>>I'd like to request from the masters a slight variation on the
>>>>previous problem, of which I have occasionally found myself in need.
>>>>
>>>>A function, which takes a string as an argument, and returns a list of
>>>>the characters in that string (in order) - much like ML's explode
>>>>function.
>>>>Preferably in a "most idiomatic Perl" version, and a "Perl golf"
>>>>version.
>>>>The language being what it is, I find it hard to believe repeated
>>>>calls to substr are really the best way ("best" not necessarily being
>>>>"clearest").
>>>
>>>my @letters = split //, $string;
>>
>>Well, he *did* mention Perl Golf:
>>
>>  my @letters = $string =~ /./g;
> 
> 
> No match, golf-wise, but also worth a mention:
> 
>     my @letters = unpack '(a)*', $string;
> 
> 

Another way:

Note: I think that treating a scalar as an in-memory file this way is new to the 
core in 5.8.0.  IO::String and IO::Scalar (on the CPAN) both seem to implement 
similar behaviour for the 5.8.0 impaired.


my $string = 'she';

open( my $fh, "<:scalar", \$string ) or die $!;

while( my $c = getc( $fh ) ) {
   print $c, "\n";
}




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

Date: Tue, 11 Feb 2003 21:27:24 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Variation on iterating through a string
Message-Id: <3E49B10C.B91FBFCD@earthlink.net>

Douglas Hunter wrote:
[snip]
> Note: I think that treating a scalar as an in-memory file this way is
> new to the core in 5.8.0.  IO::String and IO::Scalar (on the CPAN)
> both seem to implement similar behaviour for the 5.8.0 impaired.
> 
> my $string = 'she';
> 
> open( my $fh, "<:scalar", \$string ) or die $!;
> 
> while( my $c = getc( $fh ) ) {
>    print $c, "\n";
> }

my $string = 'she';
open( my $fh, "<:scalar", \$string ) or die $!;
my @letters = do { local $/ = \1; <$fh> };

-- 
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
 landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"


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

Date: Wed, 12 Feb 2003 10:29:31 +1100
From: Nigel McFarlane <nrm@remove.no.spam.kingtide.com.au>
Subject: Wanted: open source documentation reviewer
Message-Id: <3E49875B.1040904@remove.no.spam.kingtide.com.au>


Folk,

I'm looking for a technology reviewer with scripting
skills to read some well-written material and comment
on it.

What's in it for you:

Learn about a new technology in a casual and easy way,
based on high quality explainations that have been
sweated over a lot. Possibly get your name up in lights.
Understand one future trend for the Web, and a trend
for GUI development in general.

Who am I:

I'm a programmer & technical writer working on a high
quality, technically thorough tutorial on Mozilla technology.
This tutorial has nothing to do with HTML, and it's not another
JavaScript tutorial either. I'm looking for someone who knows Web
stuff but has a broader perspective on scripting, hence Perl.

Looking for:

The person I'm looking for is a programmer, and has Perl
and/or C skills. The person has worked on a Web applications
but isn't necessarily a Web person.

What's required:

One evening session of reading a week for a few weeks.
Provide feedback on material read.

If interested, pleae contact me - remove 'remove.no.spam.'
from my address.

regards, Nigel McFarlane



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

Date: Wed, 12 Feb 2003 02:17:56 GMT
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Warnings in modules
Message-Id: <o9i2a.10673$LY2.632340@newsc.telia.net>

In the thread "strict and warnings", two different viewpoints were 
stated as regards the advisable in enabling warnings in a Perl module.

Tassilo v. Parseval wrote:
> In this case please remove the warnings altogether. A module isn't 
> supposed to produce unexpected output at all. It's not very helpful for 
> the user of your module, either. It'll rather confuse them.

Abigail wrote:
> The only place warnings can turned off is in bugfree code. 
> Do you produce bugfree code?
> ...
> I'd suggest you enable them. The person running a program that would 
> make use of such a module could always turn the warnings off by 
> using the -X switch.

Please guys... I'm just a beginner, and consider you to be experts. Whom 
should I trust most? ;-)

/ Gunnar

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: 11 Feb 2003 23:07:13 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Why won't my for loop work?
Message-Id: <b2bvn1$rn7$1@mamenchi.zrz.TU-Berlin.DE>

Benjamin Goldberg  <goldbb2@earthlink.net> wrote in comp.lang.perl.misc:
> Anno Siegel wrote:
> [snip]
> > print 'Just', 'Java', "\n";
> > 
> > use overload '""' => sub { shift @{ shift()} };
> > BEGIN { $, = bless [ ( ' another ', "\b\b\b\bPerl hacker,")] }
> 
> With perl5.6.1, perl only does the magic stringification once, so this
> produces:
> 
>    Just another Java another
> 
> What version of perl did you test that on?

5.8.0.  It doesn't cache $, it's stringified on each access.

> PS: If it did work.... it would be more obscure to not use the overload
> module directly, but just do what it does.
> 
> print qw/Just Java/,"\n"; BEGIN{*{"()"}=\&nil; *{'('
> .'""'} = sub{ shift @{+shift} }; ++$OVERLOAD{dummy};

My, yes.  That's all it does.  The rest is magic.

> $, = bless [q/ another /, qq/\b\b\b\bPerl hacker,/]}

 ...now if one could only get rid of the telltale "OVERLOAD".

However, I don't think a japh must be as obfuscated as possible.  I like
those that make a single point without much ado.

I think I just don't like obfuscating code deliberately.  I can obfuscate
enough code without trying to.

Anno


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

Date: Wed, 12 Feb 2003 00:45:37 -0000
From: lofstrom@lava.net (Karen Lofstrom)
Subject: Re: Why won't my for loop work?
Message-Id: <v4j69hkardq2ba@corp.supernews.com>

A short note to all concerned: of the four new-and-improved programs 
people posted or emailed me, three didn't compile on the system at work. 
Not necessarily the fault of the programs, possibly just that some 
modules aren't installed or that I don't know how to set the environment 
correctly. Frex, I had to drop the line

use warnings;

because something was not installed.

The program written by Kent worked fine, however. Thank you Kent! Chugged 
away in one shell while I used emacs in the other. Saved me a lot of time 
and trouble. 

I am even more anxious to learn Perl properly. Thanks to everyone else
for all the suggestions. I will buy a new beginner's book, look at the
docs, and have already subscribed to the beginners' mailing list-digest
from perl.org.

-- 
Karen Lofstrom                                      lofstrom@lava.net
---------------------------------------------------------------------
Inspected and found apparently free of sweet potato weevils in accor-
dance with Pt 3 of Chptr 12 of Ttl 3 of the Louisiana Revised Statutes


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

Date: Wed, 12 Feb 2003 01:10:53 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Why won't my for loop work?
Message-Id: <slrnb4j7ot.se5.mgjv@verbruggen.comdyn.com.au>

On Wed, 12 Feb 2003 00:45:37 -0000,
	Karen Lofstrom <lofstrom@lava.net> wrote:

>            Frex, I had to drop the line
> 
> use warnings;
> 
> because something was not installed.

You have a Perl older than version 5.6.0

The equivalent (more or less) is to remove that line, and to give perl
the -w flag.

If at all possible, you should probably upgrade your version.

> I am even more anxious to learn Perl properly. Thanks to everyone else
> for all the suggestions. I will buy a new beginner's book, look at the
> docs, and have already subscribed to the beginners' mailing list-digest
> from perl.org.

Good idea. You'll enjoy it. Perl is, often, a pleasure to use.

Martien
-- 
                        | 
Martien Verbruggen      | Useful Statistic: 75% of the people make up
Trading Post Australia  | 3/4 of the population.
                        | 


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

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.  

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 4553
***************************************


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