[18686] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 854 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 8 11:05:44 2001

Date: Tue, 8 May 2001 08:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <989334307-v10-i854@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 8 May 2001     Volume: 10 Number: 854

Today's topics:
        ANNOUNCE: File::Rsync 0.17 <leakin@dfw.nostrum.com>
        ANNOUNCE: Inline 0.34 <ingy@ActiveState.com>
        ANNOUNCE: Open Perl IDE 0.9.8 <jguentherodt@users.sourceforge.net>
    Re: Date check on files (Mark Jason Dominus)
    Re: Disguising Perl scripts <dodger@necrosoft.net>
    Re: file manipulations <giles.pepper@brunel.ac.uk>
    Re: Get back errors from calling command line? (Mark Jason Dominus)
        How can you tell which modules are loaded? <lmoran@wtsg.com>
    Re: latest stable version of Perl (Randal L. Schwartz)
    Re: Prices for work? <dodger@necrosoft.net>
        R: random numbers <diab.lito@usa.net>
    Re: Removing attributes <hamel@hotmail.com>
    Re: Script to automatically generate email to Webmaster <thunderbear@bigfoot.com>
    Re: sessions and closures (Mark Jason Dominus)
    Re: sessions and closures (Mark Jason Dominus)
    Re: sessions and closures (Greg Bacon)
    Re: Sort String (Randal L. Schwartz)
    Re: Sort String <thunderbear@bigfoot.com>
        Stripping out VBA Comments <notmyrealemail@example.com>
    Re: Stripping out VBA Comments (Greg Bacon)
    Re: Win32::ODBC hangs unless I run with "-d" <tmvatcher@Xbigfoot.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 8 May 2001 02:55:22 GMT
From: Lee Eakin <leakin@dfw.nostrum.com>
Subject: ANNOUNCE: File::Rsync 0.17
Message-Id: <tfftulusetg8e@corp.supernews.com>

I've been lacks in getting updates out lately.  I have skipped a couple of
versions here on CPAN (the missing versions are on www.japh.net).  This
version includes a couple of user-contributed improvements.  Proper credit
may be found in the README (below) , and the Changelog.

File::Rsync is an OO-style module to wrap the rsync(1) program.  The rsync
program is somewhat similar to mirror.pl.  It has the advantage of only
transferring the differences between files.  See http://rsync.samba.org/ for
details on rsync and the transfer algorithm.  I needed a clean standard method
of calling rsync and checking for errors.  Hopefully other will find it useful
as well.

Here is the REAME for 0.17:

File-Rsync - A wrapper module for rsync(1) http://rsync.samba.org/rsync/

*******************************************************************************
Copyright (c) 2000 Lee Eakin.  All rights reserved.
   This program is free software; you can redistribute it and/or modify
   it under the same terms as Perl itself.
*******************************************************************************

Perl-style options may be passed as a hash reference.  Thanks to Greg Ward
for the suggestion.  There is a limited test suite as well.

You may now specify your own output functions.  Your custom function is called
for each line of output.  The line is the first argument to the function.  The
second argument is either 'err' or 'out' so the same function may be used for
both and can determine where the line came from.  Thanks to Boris Goldowsky
for the suggestion.

James Mello pointed out that if no destination is given, rsync prints a list
of files that would be processed.  To that end, a list function has been added.

Since I have gotten various reports (and some good improvements) from people
using this module, and no real problems, I will be bumping the version number
to 1.0 soon unless someone finds problems.  As always, suggestions for
improvement are always greatly appreciated.

See the Changelog for details of all changes.

QUICK START GUIDE:

   Install rsync if you haven't already.

   Build/test/install File::Rsync

      perl Makefile.PL
      make
      make test
      make install
   
   Once installed you can use 'perldoc File::Rsync' to get the rest of the
   documentation.  Or if you'd prefer to examine the docs before installation
   try 'perldoc -F Rsync.pm'.

This module is an attempt to efficiently handle the possibly numerous arguments
to the rsync command, and it's error conditions and messages.




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

Date: Tue, 08 May 2001 03:15:00 GMT
From: Brian Ingerson <ingy@ActiveState.com>
Subject: ANNOUNCE: Inline 0.34
Message-Id: <tfftu7aak8je87@corp.supernews.com>

INTRODUCTION:

Inline.pm - Write Perl subroutines in other programming languages.

Inline lets you write Perl subroutines in other programming languages
like C.
You don't need to compile anything. All the details are handled
transparently
so you can just run your Perl script like normal.

Example:

     use Inline C => <<'END';
     SV* JAxH(char* x) {
         return newSVpvf ("Just Another %s Hacker",x);
     }
     END

     print JAxH('Inline'), "\n";

When run, this complete program prints:

     Just Another Inline Hacker

The one line version is:

     perl -le 'use Inline C=>q{SV*JAxH(char*x){return newSVpvf("Just
Another %s Hacker",x);}};print JAxH+Inline'

-------------------------------------------------------------------------------
FEATURES:

Inline version 0.34 fixes 2 minor bugs:

+ Makefile.PL got confused on $Config::Config{cc} with full pathnames
or flags
+ Makefile.PL/Makefile dependency caused a problem in one rare case.

Inline version 0.33 is a minor upgrade with the following changes:

+ Support for Inline::Struct and Inline::Filters
+ Added ENABLE and DISABLE configuration modifiers.
+ C installation is optional
+ Test harness reworked. Faster testing.
+ Fixed all reported (and some unreported) bugs.
+ Documentation enhancements.

Inline version 0.32 is a minor upgrade with the following changes:

+ Addition of UNTAINT, SAFEMODE, GLOBAL_LOAD, MAKE, and LDDLFLAGS
   configuration options.
+ Fixed all reported (and some unreported) bugs.
+ Documentation enhancements.

Inline version 0.31 is a minor upgrade with the following changes:

+ "use Inline C;" is now a synonym for "use Inline C => DATA;"
+ Default build/install directory changed from "blib_I/" to ".Inline/"
+ Build/Install directory structure simplified.
   + Short install paths.
   + Build areas in ".Inline/build/" subdirectory.
+ Added 'CC', 'CCFLAGS', 'LD', and 'LDFLAGS' config options to C.
+ More recipes in Cookbook.

Inline version 0.30 is a major upgrade from previous verions. It includes:

+ Integrated support for typemap files in C.
   + All the recognized types now come *only* from typemaps.
   + The default types come from the default typemap installed with
core Perl.
   + Typemaps are used to modify the Parse::RecDescent grammar for
parsing C.
   + This means you can easily use your existing typemaps.
+ Language support completely separated from base Inline code.
   + Beta supoort for C (Inline::C, included)
   + Alpha support for C++ (Inline::CPP, available separately)
   + Alpha support for Python (Inline::Python, available separately)
   + Support for 'embedding' Perl in C with my new programming
language, CPR.
     (Inline::CPR, available separately) This one may warp your mind :^)
   + Simple API for adding your own language support.
     + Write your own Inline::Foo
     + Write your own implementation of Inline::C, or just modify
       Inline::C::grammar.
   + Support for interpreted languages in addition to compiled ones.
+ Autodetection of new Inline language modules.
+ Much easier and more powerful configuration syntax.
   + More XS and MakeMaker features exposed for configuration (for C
and C++).
+ Flexible new syntax for specifying source code.
   + Use DATA section for AutoLoader, Inline, and POD simultaneously.
+ Support for using Inline 'with' other modules.
   + "use Inline with 'Event';" lets Event.pm pass config info to Inline.pm.
   + Event.pm 0.80 has built in support for Inline.pm 0.30 and higher.
     + Write Event callbacks in C with extreme ease.
+ More documentation
   + perldoc Inline
   + perldoc Inline-FAQ
   + perldoc Inline-API
   + perldoc Inline::C
   + perldoc Inline::C-Cookbook
+ Better error messages and easier debugging.
+ Mailing list: inline@perl.org

Other features of Inline.pm include:

= Automatically compiles your source code and caches the shared object.
= Automatically DynaLoads the shared object and binds it to Perl.
= Recompiles only when the C code changes.
= Changing the Perl code will not cause a recompile of the C code.
= Support for writing extension modules, suitable for distributing to
the CPAN.
= Support for generating and binding Inline subs at run time. <bind()>
= Works on all Unix and MS Windows configurations.

-------------------------------------------------------------------------------
INSTALLATION:

This module requires the Digest::MD5 and Parse::RecDescent modules. It also
requires the appropriate C compiler. (Where appropriate means the one
referred
to in your Config.pm)

To install Inline do this:

perl Makefile.PL
make
make test
make install

On ActivePerl for MSWin32, use nmake instead of make. Or just use:
     ppm install Inline

For convenience, Inline::C is packaged with Inline, and will be
automatically
installed as well.

-------------------------------------------------------------------------------
INFORMATION:

= For more information on Inline, see 'perldoc Inline' and 'perldoc
Inline-FAQ'
= For information about Inline::, see 'perldoc Inline::C' and
   'perldoc Inline::C-Cookbook'
= For information on writing your own Inline extension see 'perldoc
Inline-API'
= For information about the Perl5 internal C API, see 'perldoc perlapi' or
   try http://www.perldoc.com/perl5.6/pod/perlapi.html
= The Fall 2000 edition of The Perl Journal has an article about Inline

The Inline.pm mailing list is inline@perl.org. Send email to
inline-subscribe@perl.org to subscribe.

Please send questions and comments to "Brian Ingerson" <INGY@cpan.org>

Copyright (c) 2001, Brian Ingerson. All Rights Reserved.




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

Date: Mon, 7 May 2001 22:43:20 +0200
From: "Jürgen Güntherodt" <jguentherodt@users.sourceforge.net>
Subject: ANNOUNCE: Open Perl IDE 0.9.8
Message-Id: <tffu021dmkj999@corp.supernews.com>

Hi,

I have just finished a new release of Open Perl IDE, an integrated
development environment for writing and debugging perl scripts under
Windows.

This program formerly known as "Visual Perl IDE" has been renamed because of
trademark reasons. The "Open" in the name stands for OpenSource.

It is written in Delphi 5 Object Pascal and Perl, here are the main
features:

-Perl Syntax Coloring
-Visual Debugging
-Integrated Help System
-Customizable Environment

Visit http://open-perl-ide.sourceforge.net for screenshots, documentation
and, of course, downloads !


Regards,

Jürgen Güntherodt






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

Date: Tue, 08 May 2001 13:46:52 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Date check on files
Message-Id: <3af7f8c5.ab1$d1@news.op.net>

In article <9d8d1r$ihr$1@news1.xs4all.nl>,
jeroen v.d. Wijden <jeroen.vander.wijde@cleartrac.nl> wrote:
>I'm a complete newbie to Perl. I want to create a way to check files for
>dates, if one file is more recently edited or changed I want the older file
>to be
>overwritten by the other. Is there a way to do this in Perl??

The '-M' operator tells you how much time has passed since a file was
last changed.

        $time_since_last_change = -M $file;

Other folks in the thread suggested using stat(), which will work, but
I think -M is simpler.

Here are some recipes:

        if (-M $file1 > -M $file2) {
          # more time has passed since $file1 was changed
          # replace $file1 with $file2
        }

        ($old,$new) = sort {-M $b <=> -M $a} $file1, $file2;
        # now replace $old with $new

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Tue, 08 May 2001 14:12:19 GMT
From: "Dodger" <dodger@necrosoft.net>
Subject: Re: Disguising Perl scripts
Message-Id: <79TJ6.54897$B22.14057024@news1.rdc2.pa.home.com>

Why disguise?

Use a C wrapper that runs the script setuid root. Make the script itself not
world readable, writable, executable, or anything. Of course, if the script
runs in normal space, set the uid to the user first thing, or, if in
CGIspace, to nobody.

--
Dodger
www.dodger.org
www.necrosoft.net
www.gothic-classifieds.com




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

Date: Tue, 8 May 2001 15:40:07 +0100
From: "gdp" <giles.pepper@brunel.ac.uk>
Subject: Re: file manipulations
Message-Id: <9d904j$lin$1@mimas.brunel.ac.uk>

thanks for the suggestions...will work on it


"gdp" <giles.pepper@brunel.ac.uk> wrote in message
news:9d881t$cfu$1@mimas.brunel.ac.uk...
> Hi....
>
> I have a directory (linux) with a hundred or so files.  Some of these
> filenames contain spaces which I want to remove.  Can anyone give me a
clue
> as to how I would use a perl script to go through the directory and check
> and rename if neccessary the file.  I have used a bit of perl for other
> things but have not had experience of this sort of thing.  Any help
> appreciated.
> Regards
>
> GDP
>
>




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

Date: Tue, 08 May 2001 13:49:26 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Get back errors from calling command line?
Message-Id: <3af7f966.abb$47@news.op.net>

In article <gqIJ6.1302$B13.169795@news.pacbell.net>,
Krusty <danparker276@yahoo.com> wrote:
>my script goes like
>$cmd = "plink -ssh me@255.0.0.0 dir"; #orwhat ever
>open (FH, "$cmd |");
>while (<FH>){
>#never gets in here on an error message like 'can't connect to server'
>}
>
>How can I get it to display the error messages as well as the out put?

Try

        open (FH, "$cmd 2>&1 |");

A different strategy is:

        while (<FH>) {
          ...
        }
        close FH;               # this sets $?
        if ($? != 0) { 
          warn "plink did not succeed";
        }


-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Tue, 08 May 2001 11:03:29 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: How can you tell which modules are loaded?
Message-Id: <5j2gftk8p7f1g75g1up16e3r7b52vd6632@4ax.com>

--Say I sit at diff't boxes with diff't OSes but they all have Perl.  

--How can I tell which modules are loaded?



--
print "\x{263a}" 


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

Date: 08 May 2001 07:34:41 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: latest stable version of Perl
Message-Id: <m1wv7raozi.fsf@halfdome.holdit.com>

>>>>> "Brian" == Brian Cantin <dcantin@earthlink.net> writes:

Brian> Randal Schwartz recently posted a message where he said that
Brian> 5.6.1 is not shaken out enough for use on his production machines.

I'm just not an early adopter.  I wait about three months after a
release to see what's going to break out there in the real world.  If
nothing comes up in three months, I'll be cutting over to 5.6.1.  I
think we're close to that now, actually.

I *did* have some trouble compiling some of my useful modules that had
XS with one of the gammas of 5.6.1, but maybe it was something that
was fixed in final.

Brian> So, if you were to pick a Perl version that you trusted in a
Brian> production environment, which one would it be?

I've never been happy with what I saw about 5.6.0, so I'm running
5.5.3 until I decide 5.6.1 is fine.

print "Just another Perl hacker,"

-- 
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: Tue, 08 May 2001 14:16:25 GMT
From: "Dodger" <dodger@necrosoft.net>
Subject: Re: Prices for work?
Message-Id: <ZcTJ6.54907$B22.14057981@news1.rdc2.pa.home.com>

Bryan Coon <bcoon@sequenom.com> wrote in message
news:3AF77B10.6A2CF6E8@sequenom.com...
> My apologies for a bit off topic post (its still kind of a perl question
> though :))
>
> I have been asked do do some contract work for a local company, which
> involves installing a perl htaccess/htpasswd manager program and
> modifying the code to suit their needs.  Nothing major, just a few hours
> work at most.
>
> Can someone please point me to some resources that will help determine
> how much I should charge them?
>
> For example, what's the going rate on perl programmers?  I have been
> programming in perl for about 3 years, but it has always been for my
> company, never outside.  I hear crazy rumors of people paying 50k for a
> static site with less than 10 pages, which I cannot verify.  I just need
> to get a ballpark idea of what is acceptable, so I dont overcharge or
> undercharge.

I charge $80 an hour for Perl or JavaScript programming, $60 an hour for
HTML, negotiable for custom images depending on how much I like to draw the
subject or if I have to draw at all. This is refers to US currency. For the
installation portion. Id go with the $60, and for the modification portion,
the $80 rate.

--
Dodger
www.dodger.org
www.necrosoft.net
www.gothic-classifieds.com





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

Date: Tue, 8 May 2001 15:32:21 +0200
From: "Mario Rizzuti" <diab.lito@usa.net>
Subject: R: random numbers
Message-Id: <XzSJ6.8673$oa2.181117@news6.giganews.com>


Garry Williams <garry@ifr.zvolve.net> wrote in message
slrn9ff03o.2o2.garry@zfw.zvolve.net...
> On Mon, 07 May 2001 21:35:05 GMT, Bart Lateur <bart.lateur@skynet.be>
wrote:
> > sas wrote:
> >
> >> It must be a 5
> >>digit random number which will be associated with a specific name, (an
"ID"
> >>number), I want to check against a log file to be sure the number hasn't
> >>been used already and then add the number and associated name to that
log
> >>file.
> >
> > Once you get over 100000 visitors, you'll be in trouble.
>
> Actually the trouble will creep up before then.  :-)

The OP actually didn't talk about decimal numbers:-)

Mario Rizzuti




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

Date: Tue, 8 May 2001 09:39:18 -0400
From: "Philippe Hamel" <hamel@hotmail.com>
Subject: Re: Removing attributes
Message-Id: <tfftobr6v3jc53@corp.supernews.com>

Thanks.

We decided to go with basically copying the attributes I wanted to keep,
deleting the entry and recreating the entry.  Seems to work fine.

--
Philippe Hamel
Bureau :
Courriel : phamel@logisil.com
Tel : (514)866-5493 poste 419
Maison :
Courriel : philippe.hamel@apiiq.qc.ca

"Birgit Hans" <birgit@watermans-welt.de> wrote in message
news:3AF7D738.A448DC3E@watermans-welt.de...
> Hi,
>
> LDAP is a kind of database.
> Entries can only updated all-or-nothing.
> It's quite simple:
> The attribute that you want to remove must not be mandatory.
> Then get the whole entry and update it without the unwanted attribute.
>
> I think, that's the right way.
>
> Greetings
> Birgit
>
> Philippe Hamel wrote:
>
> > Hi,
> >
> > I'm trying to delete attributes from an LDAP entry using perl and
associated
> > modules.  I've figured out how to remove whole entries, but if I just
want
> > to delete attributes from an entry, how do I do that?
> >
> > Thank you!
> >
> > --
> > Philippe Hamel
> > Bureau :
> > Courriel : phamel@logisil.com
> > Maison :
> > Courriel : philippe.hamel@apiiq.qc.ca
>




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

Date: Tue, 08 May 2001 15:59:53 +0100
From: =?iso-8859-1?Q?Thorbj=F8rn?= Ravn Andersen <thunderbear@bigfoot.com>
Subject: Re: Script to automatically generate email to Webmaster when page error  occurs
Message-Id: <3AF809E9.385D2CF3@bigfoot.com>



Netyak wrote:
> 
> I want to receive an automatic email message each time a Web visitor generates a
> 404 "page not found" error.

Why don't you just look in the server log?

-- 
  Thorbjørn Ravn Andersen                "...plus...Tubular Bells!"
  http://bigfoot.com/~thunderbear


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

Date: Tue, 08 May 2001 13:32:19 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: sessions and closures
Message-Id: <3af7f562.a5c$216@news.op.net>

In article <slrn9feb2t.skv.dave@sydney.daveb.net>,
Dave Bailey <dave@sydney.daveb.net> wrote:
>The file could then be read and 
>evaluated.  In my opinion this is not significantly different from the 
>Lisp solution.  

It would be significantly different.  In Perl, you have to generate
the code as a string, which means you are likely to get yourself into
problems with the parser---and with Perl's extra-complicated parser,
you are much more likely to get into trouble.  (As a very simple
example, consider the problems that arise when people try to build up
SQL statements as strings: $dbh->prepare("select id from employee
where name = '$name'");

In Lisp, you do not generate the code as a string.  You generate it as
an S-expression and store the S-expression.  Then when you evaluate
it, you don't need to use the parser; it's just another piece of Lisp
data.  

You get a benefit on the generation side as well, because the Lisp
macro system is well-designed for such tasks, and can manipulate the
S-expressions on a structural level; this is easier to program than a
bunch of functions that assemble a program out of strings.

So yes, Lisp would have a substantial advantage over Perl here.

The Perl-only people in this thread can't see that because they aren't
familiar with Lisp.  It's easy to say "I don't think Lisp could be
better than Perl" when you are unaware of all the special features of
Lisp that are unavailable in Perl.

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Tue, 08 May 2001 13:38:41 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: sessions and closures
Message-Id: <3af7f6e1.a9a$71@news.op.net>

In article <3af7945a.863921@news.iddeo.es>,
F. Xavier Noria <fxn@isoco.com> wrote:
>One could store a hash in a request dispatcher which would know
>how to deal with the stored closures. Do you see any drawbacks in
>this schema? 

I see a big one: I don't know how to write 'a request dispatcher which
would know how to deal with the stored closures', and I don't think
anyone else does either.

How do you get the closures over the network the the dispatcher?  Perl
has no way to send a closure as a string.

OK, let's try to work around that: Use the bytecode dumper to dump out
the closure as bytecode, or use B::Deparse to generate Perl code; send
the result over the network.  This is extremely complicated and still
buggy.  

In Lisp, it's completely trivial because a Lisp program is just like
any other piece of Lisp data.  

In Perl, there's no way to find out the environment and dump it.
Even if there was, you'd have to dump a huge amount of nonsense like
$", $/, $\, $;, and so on.   In Lisp you don't need to do this.


-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Tue, 08 May 2001 14:10:16 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: sessions and closures
Message-Id: <tffvi8qpcml955@corp.supernews.com>

In article <3af7f6e1.a9a$71@news.op.net>,
    Mark Jason Dominus <mjd@plover.com> wrote:

: In Perl, there's no way to find out the environment and dump it.
: Even if there was, you'd have to dump a huge amount of nonsense like
: $", $/, $\, $;, and so on.   In Lisp you don't need to do this.

I agree with your conclusion that it would be nicer in Lisp, but
why would a serialized closure need to include $", $/, $\, $;, and
other globals?  Globals don't close.

Greg
-- 
When Galileo turned his telescope toward the heavens, and allowed Kepler to
look as well, they found no enchantment or authorization in the stars, only
geometric patterns and equations.  God, it seemed, was less of a moral
philosopher than a master mathematician.  -- Neil Postman


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

Date: 08 May 2001 06:58:46 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Sort String
Message-Id: <m166fcaqnd.fsf@halfdome.holdit.com>

>>>>> "Uri" == Uri Guttman <uri@sysarch.com> writes:

>>>>> "RLS" == Randal L Schwartz <merlyn@stonehenge.com> writes:
RLS> 97% of the uses of split /(___)/ can be replaced by a cleaner /(___)/g
RLS> instead, in my observation.  I think the trouble is that we invented
RLS> this split /(..)/ idiom before Perl5 came along, and now nobody is
RLS> looking at the much cleaner m//g.

Uri> well, the main diff is that split is supposed to be used to match
Uri> separators and eat them while returning what is in between and m/()/
Uri> just matches substrings and returns any grabbed ones. they can do
Uri> similar things but they each have strengths and weaknesses. those should
Uri> be emphasized when teaching them. since there are no delims in that
Uri> string that the OP wants sorted, then m// makes more sense. if you had
Uri> 'ab:cd' type strings then split makes more sense. maybe the docs should
Uri> contrast the two functions and show cases where one is better than the
Uri> other?

I have no problem with split /..../ to toss delimiters.  I'm talking
about split /(....)/ where people really only want the delimiters, so
they end up tossing the "non-delimiter" odd elements.  This is a usage
from back when /(....)/g didn't exist, and gets perpetuated as a bad
meme.  I mean, c'mon... Perl5's been out for a decade, rounded to the
nearest decade!

So for me, I teach:

        split /..../ when you know what you want to toss

        /(....)/g when you know what you want to keep

and never use split /(....)/.

print "Just another Perl hacker," =~ /(.{1,3})/g

-- 
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: Tue, 08 May 2001 16:01:06 +0100
From: =?iso-8859-1?Q?Thorbj=F8rn?= Ravn Andersen <thunderbear@bigfoot.com>
Subject: Re: Sort String
Message-Id: <3AF80A32.9D4BF4B@bigfoot.com>



root wrote:
> 
> Hi,
> 
> Here's a little challenge.  I want to sort an alpha string grouped by two
> characters. Example:
> 
> $original = "abracadeba"
> 
> after sort... (?)
> 
> $sorted = "abbacadera                            "
> 
> I want to do this with a minimum of code.

Can you write the code that generate the two-character strings you want
to sort?

-- 
  Thorbjørn Ravn Andersen                "...plus...Tubular Bells!"
  http://bigfoot.com/~thunderbear


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

Date: Tue, 08 May 2001 14:30:26 GMT
From: "BarryK" <notmyrealemail@example.com>
Subject: Stripping out VBA Comments
Message-Id: <6qTJ6.77568$U4.17243677@news1.rdc1.tn.home.com>

VB for Applications sticks unwanted comments in my macros. I'm trying to
strip them out. The regex in the following works fine, but the rest doesn't.
It outputs "11". Any ideas?

while (<DATA>)
{
 $_ =~ s : ^'.+$ | ^'$::gx;
 print $_ if $_ = m/^[a-zA-Z]/;
}

__DATA__
Sub z100()
'
' z100 Macro
' Macro recorded 12/06/98 by BK
'
    ActiveWindow.ActivePane.View.Zoom.Percentage = 100
End Sub





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

Date: Tue, 08 May 2001 15:02:00 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Stripping out VBA Comments
Message-Id: <tfg2j81jbfu3b@corp.supernews.com>

In article <6qTJ6.77568$U4.17243677@news1.rdc1.tn.home.com>,
    BarryK <notmyrealemail@example.com> wrote:

: VB for Applications sticks unwanted comments in my macros. I'm trying to
: strip them out. The regex in the following works fine, but the rest doesn't.
: It outputs "11". Any ideas?
: 
: while (<DATA>)
: {
:  $_ =~ s : ^'.+$ | ^'$::gx;
:  print $_ if $_ = m/^[a-zA-Z]/;
: }

The 11 is because you used = instead of =~ on the last test.  How about
this?

    % cat try
    #! /usr/local/bin/perl -w

    use strict;

    while (<DATA>) {
        print unless /^\s*'/;
    }

    __DATA__
    Sub z100()
    '
    ' z100 Macro
    ' Macro recorded 12/06/98 by BK
    '
        ActiveWindow.ActivePane.View.Zoom.Percentage = 100
    End Sub
    % ./try
    Sub z100()
        ActiveWindow.ActivePane.View.Zoom.Percentage = 100
    End Sub

Hope this helps,
Greg
-- 
And as for when the new millennium starts, which of these dates looks more
like the start of a new millennium:  01/01/00 or 01/01/01?
    -- Dan Harper


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

Date: Tue, 8 May 2001 06:46:32 -0700
From: "Toni Vatcher" <tmvatcher@Xbigfoot.com>
Subject: Re: Win32::ODBC hangs unless I run with "-d"
Message-Id: <9d8ubu$asl$1@nnrp1.phx.gblx.net>


"Philip Lees" <pjlees@ics.forthcomingevents.gr> wrote in message
news:3af78dc8.61999780@news.grnet.gr...
> On Mon, 7 May 2001 14:38:03 -0700, "Toni Vatcher"
> <tmvatcher@Xbigfoot.com> wrote:
>
> I asked about this last September in a thread with subject 'Warning
> message in Win32::ODBC module'. You can look it up if you're
> interested.

I looked at the thread.  It looks like the error you saw was occurring in
GetData.  I'm hanging in "New".   There is a call to ODBCConnect (which I'm
guessing is in ODBC.dll since I couldn't find it in ODBC.pm) and that's
what's hanging.

>
> I think this has been fixed in newer versions of Win32::ODBC.

I went to the Roth site yesterday and tried build "307".  I got the dreaded
(to me) "parse exception error" (I thought that was the right version with
ActiveState 522, but guess I was wrong).  I also tried the beta version that
they have and that still had the problem.

I guess I have a work around - always run in the debugger :-)

I appreciate your help.  Let me know if you have other suggestions.

Toni




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

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


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