[16672] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4084 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 21 18:07:10 2000

Date: Mon, 21 Aug 2000 15:05:39 -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: <966895538-v9-i4084@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 21 Aug 2000     Volume: 9 Number: 4084

Today's topics:
    Re: A puzzle: Can't find the syntax error in this regex (Marcel Grunauer)
    Re: A puzzle: Can't find the syntax error in this regex <latsharj@my-deja.com>
    Re: A puzzle: Can't find the syntax error in this regex (Abigail)
        ActivePerl 616 bombing wirh Dr Watson on NT <gjchap99@my-deja.com>
    Re: ActivePerl 616 bombing wirh Dr Watson on NT <jeffrey.l.susanj@boeing.com>
    Re: Are BEGIN and END blocks user callable? nobull@mail.com
        Assistance needed updating a script blindemann@my-deja.com
    Re: Checking if variables exist <gellyfish@gellyfish.com>
        cmd.exe on Perl for NT 4 djberg96@my-deja.com
        Configure problem <OfficerS@aries.tucson.saic.com>
    Re: Configure problem <OfficerS@aries.tucson.saic.com>
    Re: DBI has me stumped... maybe OO problem? (Eric Bohlman)
    Re: Difference between a .cgi file and a .pl file? <jim@usjet.net>
    Re: Difference between a .cgi file and a .pl file? (brian d foy)
    Re: exists() before 5.6 for sub's <lr@hpl.hp.com>
    Re: exists() before 5.6 for sub's <jerrad@networkengines.com>
        find printers in win2000 richard_rader@my-deja.com
    Re: gethostbyaddr <lr@hpl.hp.com>
    Re: Getting rid of extra spaces and returns <aqumsieh@hyperchip.com>
    Re: grepping for multiple fields <gellyfish@gellyfish.com>
    Re: Hash List Comparing <lr@hpl.hp.com>
    Re: hey, i need help, im trying to get what email = fro <tina@streetmail.com>
    Re: how to generate unreadable from readable perl code (Anno Siegel)
    Re: how to generate unreadable from readable perl code (Abigail)
    Re: how to generate unreadable from readable perl code (Craig Berry)
        Install MailTools on ActiveState perl 5.6 !!! <eeshagh@earthlink.net>
    Re: Install MailTools on ActiveState perl 5.6 !!! <no@return.com>
        Membership management nicros@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 21 Aug 2000 18:17:03 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: A puzzle: Can't find the syntax error in this regex?!?
Message-Id: <slrn8q2sdp.7jb.marcel@gandalf.local>

On Mon, 21 Aug 2000 12:50:00 -0500, Burton Kent
<burton@remove_this.lucent.com> wrote:

>
>I'm stumped.  What am I doing wrong, as this won't compile?


Perl doesn't have an "elif", but an "elsif".

You might want to consider using '-w' (or 'use warnings' in 5.6), and
'use strict'. It wouldn't have helped you with this, but it's generally
a good idea (for a broad set of values for 'generally').


-- 
Marcel Gr\"unauer - Codewerk plc . . . . . . . . . . . <http://www.codewerk.com>
Perl Consulting, Programming, Training, Code review . . .  <marcel@codewerk.com>
mod_perl, XML solutions - email for consultancy availability
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();


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

Date: Mon, 21 Aug 2000 18:24:05 GMT
From: Dick Latshaw <latsharj@my-deja.com>
Subject: Re: A puzzle: Can't find the syntax error in this regex?!?
Message-Id: <8nrs3c$vfr$1@nnrp1.deja.com>

In article <39A16BC8.7D9740A5@remove_this.lucent.com>,
  Burton Kent <burton@remove_this.lucent.com> wrote:
>
> I'm stumped.  What am I doing wrong, as this won't compile?
> #!/opt/exptools/bin/perl
#!/opt/exptools/bin/perl -w
use strict;

>
> my $ELEMENT_REGEX = "[A-z][A-z0-9-]*";
>
> my %lc_elements;
> my %lc_attributes;
>
> sub add_links {
>         my $text = shift;
>
>         $text =~ s#<([BU])> ?($ELEMENT_REGEX) ?</\1>#
>                 my $thing = lc($2);
>                 if ($lc_attributes{$thing}) {
>                         $thing = "_" . $lc_attributes{$thing} . "_";
>                 }
>                 elif ( $lc_elements{$thing} ) {

elsif ( $lc_elements{$thing} ) {


>                         $thing = "_" . $lc_elements{$thing} . "_";
>                 }
>                 else {
>                         $thing = $2;
>                 }
>                 $thing;
>           #egs;
>         $text =~ s#\b($ELEMENT_REGEX)\b#
>                 my $thing = lc($1);
>                 if ($lc_elements{$thing}) {
>                         $thing = "\_$lc_elements{$thing}\_";
>                 }
>                 elif ($lc_attributes{$thing}) {

elsif ($lc_attributes{$thing}) {

>                         $thing = "\_" . $lc_attributes
{$thing} . "\_";;
>                 }
>                 else {
>                         $thing = $1;
>                 }
>                 $thing;
>           #egs;
>         return $text;
> }
>

--
Regards,
Dick


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 21 Aug 2000 21:03:44 GMT
From: abigail@foad.org (Abigail)
Subject: Re: A puzzle: Can't find the syntax error in this regex?!?
Message-Id: <slrn8q3686.tj3.abigail@alexandra.foad.org>

Marcel Grunauer (marcel@codewerk.com) wrote on MMDXLVII September
MCMXCIII in <URL:news:slrn8q2sdp.7jb.marcel@gandalf.local>:
?? On Mon, 21 Aug 2000 12:50:00 -0500, Burton Kent
?? <burton@remove_this.lucent.com> wrote:
?? 
?? >
?? >I'm stumped.  What am I doing wrong, as this won't compile?
?? 
?? 
?? Perl doesn't have an "elif", but an "elsif".
?? 
?? You might want to consider using '-w' (or 'use warnings' in 5.6), and
?? 'use strict'. It wouldn't have helped you with this, but it's generally
?? a good idea (for a broad set of values for 'generally').


And even more important, compile errors will generate an error message,
regardless whether you have -w, use strict or use warnings.

If one wants help from this group, don't let the people in this group do
the extra work of finding out what the error message is. I for one didn't
look at the program as the error message was missing. Burton now got lucky
that Marcel looked at it anyway - next time, he might not be so lucky.



Abigail
-- 
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))


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

Date: Mon, 21 Aug 2000 18:54:19 GMT
From: Jack Altradmon <gjchap99@my-deja.com>
Subject: ActivePerl 616 bombing wirh Dr Watson on NT
Message-Id: <8nrtsh$1o9$1@nnrp1.deja.com>

Just installed ActivePerl 5.6.0.616 on WinNT 4.0 (wks) with SP4. When
trying to run ANY script which previously worked under 522, I get Dr
Watson coming up with error :

"Exception : access violation (0xc0000005), address : 0x01cb30bc"

anybody successfully installed and running this version..?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 21 Aug 2000 20:11:37 GMT
From: "Jeff Susanj" <jeffrey.l.susanj@boeing.com>
Subject: Re: ActivePerl 616 bombing wirh Dr Watson on NT
Message-Id: <Fzns3D.H88@news.boeing.com>


Jack Altradmon wrote in message <8nrtsh$1o9$1@nnrp1.deja.com>...
>Just installed ActivePerl 5.6.0.616 on WinNT 4.0 (wks) with SP4. When
>trying to run ANY script which previously worked under 522, I get Dr
>Watson coming up with error :
>
>"Exception : access violation (0xc0000005), address : 0x01cb30bc"
>
>anybody successfully installed and running this version..?
>
>


This is similar to a problem we had when the user didn't uninstall an
earlier version of Perl.  We deinstalled all versions of Perl and
reinstalled build 616 and it worked fine.


Jeff S.





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

Date: 21 Aug 2000 19:17:52 +0100
From: nobull@mail.com
Subject: Re: Are BEGIN and END blocks user callable?
Message-Id: <u9vgwubhrj.fsf@wcl-l.bham.ac.uk>

Keith Arner <karner@fore.com> writes:


> 	foo::END();
> 
> ... will produce "Undefined subroutine &foo::END called at ..."
> 
> Do BEGIN and END blocks actually appear in the symbol table anywhere?  

Not in the normal way because a package can have multiple BEGIN/END blocks.

> In this example, I could simply call do_something() directly, but I would
> prefer to be able to invoke END().

I think this is misguided.  Calling do_something() is probably
better.

Apache::Registry does some weird magic with END blocks - perhaps you
should look there.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Mon, 21 Aug 2000 19:54:32 GMT
From: blindemann@my-deja.com
Subject: Assistance needed updating a script
Message-Id: <8ns1dd$66l$1@nnrp1.deja.com>

I am a rookie just trying to elaborate on a script that is already in
place using Perl5.  I want to copy  dir1/filename.x to dir2/filename.y
and delete the original filename.x in dir1.  I also want to include the
contents of filename.x in a e-mail message that is to be emailed
automatically to the person who initiated the script.  I have the
portion of the script that e-mails the user already in place, I just
need to figure out how to add the contents of the file.
Any help would be appreciated.
Thnxs
*BOB*


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 21 Aug 2000 21:56:40 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Checking if variables exist
Message-Id: <8ns528$1u1$1@orpheus.gellyfish.com>

On Thu, 17 Aug 2000 22:58:04 GMT Todd Eddy wrote:
> Like that -wT part, I have NEVER seen that on any of the online
> resources I have looked at for tutorials and stuff (about 6 or 7 sites)
> nor have I seen that in any of the 10 or so scripts I have installed.
> Thus it must not be that standard of practice.  Same goes for the rest
> of it, if all of that is working, then why mess with it?

Perhaps then it might be time to review the resources that you have used
to learn Perl and the sources of free scripts that you have installed -
these things are very much considered to be standard practice by most
mainstream Perl practitioners.  If you post code here you should expect
it to come under scrutiny and people *will* suggest improvements according
to their view of good practice,  I mean everyone's code gets criticized
here - you should take it in the spirit of education as it is meant and
benefit yourself rather than get upset and have a tantrum and annoy
everyone.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Mon, 21 Aug 2000 19:36:02 GMT
From: djberg96@my-deja.com
Subject: cmd.exe on Perl for NT 4
Message-Id: <8ns0b0$518$1@nnrp1.deja.com>

Hi all,

I can't seem to get a stinkin' console to display in Win32.  I'm
actually trying this from a perl/tk pull-down menu, but I've also tried
it in a non-tk script so that shouldn't matter (should it?).

I've tried a basic system command:
system("$SystemRoot\\system32\\cmd.exe"); # Double backslash necessary

But that only generates a shell within a shell, it doesn't actually
create a new console window.

"So try Win32::Console", you say?  I've tried:

use Win32::Console;
$CONSOLE = new Win32::Console(tried every standard handle, including no
handle).

$CONSOLE->Free;    # Tried with and without
$CONSOLE->Alloc;   # Tried with and without
$CONSOLE->Display; # Tried with and without

Now, if I don't use the 'Free' method, I will get a postive return
value from 'Display', even though it's not really displaying a new
console (it's creating a shell within the shell that automatically
comes up when you run the script).

I have also returned undef from the 'Display' method if I try to
specify a standard handle.

Any ideas anyone?  Thanks in advance for any help provided.

Regards,

Daniel Berger



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 21 Aug 2000 14:01:31 -0700
From: Sarah Officer <OfficerS@aries.tucson.saic.com>
Subject: Configure problem
Message-Id: <39A198AB.BBD8B454@aries.tucson.saic.com>

Help! Configure for perl 5.6.0 says gdbm_open is NOT FOUND on some
of my machines.

I have gdbm installed under /proj/include/gdbm.h and
/proj/lib/IRIX6.5/libgdbm.a and /proj/lib/SOLARIS5.8/libgdbm.a.  The
libraries are appropriate for the architectures listed in the
paths.  It is version -Dlocincpth=/proj/include
-Dloclibpth=/proj/lib/$MACHINE where MACHINE is set to IRIX6.5 or
SOLARIS5.8 depending on where I'm compiling.  

I put this in a script, so I'm using the same logic over and over. 
I compiled successfully on 2 solaris boxes & 1 irix box, but my 2nd
irix box fails to find gdbm_open, so doesn't create the gdbm
module.  I can run 'nm' on the library path and grep for gdbm_open,
and it is defined.

What is going on?  I have tried many times, and any help would be
appreciated.  Is there anything besides locincpth and loclibpth that
could cause gdbm not to be found?  What is the test for gdbm_open? 
I'm sure that is the clue to the source of the problem.  I don't
know how to decipher what Configure is doing.

Any help is appreciated!

Thanks,

Sarah Officer
officers@aries.tucson.saic.com


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

Date: Mon, 21 Aug 2000 14:46:20 -0700
From: Sarah Officer <OfficerS@aries.tucson.saic.com>
Subject: Re: Configure problem
Message-Id: <39A1A32C.B74D85DD@aries.tucson.saic.com>

Sarah Officer wrote:
> 
> Help! Configure for perl 5.6.0 says gdbm_open is NOT FOUND on some
> of my machines.
> 
> I have gdbm installed under /proj/include/gdbm.h and
> /proj/lib/IRIX6.5/libgdbm.a and /proj/lib/SOLARIS5.8/libgdbm.a.  The
> libraries are appropriate for the architectures listed in the
> paths.  It is version -Dlocincpth=/proj/include
> -Dloclibpth=/proj/lib/$MACHINE where MACHINE is set to IRIX6.5 or
> SOLARIS5.8 depending on where I'm compiling.

Typo.  What I meant is that I am using the -Dlocincpth and
-Dloclibpth variables to specify where to find gdbm.  After
configuring, I can grep those values in config.sh.  Then I can check
that there was no typo in the paths; the lib & include files really
do exist.  Configure is finding gdbm.h, but not gdbm_open.

> 
> I put this in a script, so I'm using the same logic over and over.
> I compiled successfully on 2 solaris boxes & 1 irix box, but my 2nd
> irix box fails to find gdbm_open, so doesn't create the gdbm
> module.  I can run 'nm' on the library path and grep for gdbm_open,
> and it is defined.
> 
> What is going on?  I have tried many times, and any help would be
> appreciated.  Is there anything besides locincpth and loclibpth that
> could cause gdbm not to be found?  What is the test for gdbm_open?
> I'm sure that is the clue to the source of the problem.  I don't
> know how to decipher what Configure is doing.
> 
> Any help is appreciated!
> 
> Thanks,
> 
> Sarah Officer
> officers@aries.tucson.saic.com


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

Date: 21 Aug 2000 18:32:56 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: DBI has me stumped... maybe OO problem?
Message-Id: <8nrsko$8sm$3@slb7.atl.mindspring.net>

Dale Emmons (dale@emmons.dontspamme.com) wrote:
: oh my god... I can't believe I'd do something this dumb.
: 
: While looking through the code for the 176th time, I noticed that I had a
: $dbh->disconnect; statement within the each day loop which was killing my db
: object.
: 
: Now I feel stupid.

Read Gerald Weinberg's _The Psychology of Computer Programming_, 
particularly the chapters on "personality factors" and "problem-solving 
ability" (but *do* eventually read the whole book, especially the sections 
on programming as a social activity).

My favorite "duh" story was from 19 years ago when I had just made some 
changes to the code for a jukebox's controller, burned it into an EPROM, 
stuck it into the controller board, turned it on, and found nothing was 
working.  After about an hour of carefully retracing my steps to try to 
find out what I had broken, I glanced to the side, noticed a CPU chip 
lying there, and then glanced at the controller board, and noticed an 
empty CPU socket...




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

Date: Mon, 21 Aug 2000 12:25:16 -0500
From: Jim Gaasedelen <jim@usjet.net>
Subject: Re: Difference between a .cgi file and a .pl file?
Message-Id: <39A165FC.56722CA6@usjet.net>

A .pl script is written in perl and windows recognizes programs by their
extension.
A .cgi script can be written in perl and usually is, but doesn't have to
be. It can
be written in a shell script. Different applications may dictate a
different name
and they must be consistent. You cannot name a script x.pl and reference
it x.cgi.
 .cgi scripts are usually used in cgi applications but are very often
written in
perl and this works just fine.

Abigail wrote:
> 
> DS (snakeman@kc.rr.com) wrote on MMDXI September MCMXCIII in
> <URL:news:vjmc5.94$L5.2310@typhoon.kc.rr.com>:
> ][ What is the diference betweeen a .pl file and a .cgi file?
> 
> The name.
> 
> ][ Can I convert a .pl to a .cgi?
> 
> Sure. Rename the file.
> 
> Abigail
> --
> perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
>          ${qq$\x5F$} = q 97265646f9 and s g..g;
>          qq e\x63\x68\x72\x20\x30\x78$&eggee;
>          {eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'


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

Date: Mon, 21 Aug 2000 17:51:59 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Difference between a .cgi file and a .pl file?
Message-Id: <brian-ya02408000R2108001751590001@news.panix.com>

In article <39A165FC.56722CA6@usjet.net>, Jim Gaasedelen <jim@usjet.net> posted:

> A .pl script is written in perl and windows recognizes programs by their
> extension.

it might be written in Perl.  windows recognizes it only if someone
(e.g. the ActiveState installer) tells it to.

> A .cgi script can be written in perl and usually is, but doesn't have to
> be. It can
> be written in a shell script. Different applications may dictate a
> different name
> and they must be consistent. 

they don't have to be consistent.  some servers might have limited
configuration abilities, but that is only some servers.

> You cannot name a script x.pl and reference
> it x.cgi.

yes you can.  URL paths do not directly translate to file names

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Mon, 21 Aug 2000 11:21:00 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: exists() before 5.6 for sub's
Message-Id: <MPG.140b12e8cb86a65398acad@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <39A15647.372FB399@networkengines.com> on Mon, 21 Aug 2000 
12:18:15 -0400, Jerrad Pierce <jerrad@networkengines.com> says...
> Does anybody know of a way to emulate:
> 	exists &foo;
> functionality in a pre 5.6 build?

      defined &foo

> Thanks!

You're welcome.
 
> PS> Please (b) cc me with any replies

What the heck, why not? 

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 21 Aug 2000 14:32:34 -0400
From: Jerrad Pierce <jerrad@networkengines.com>
Subject: Re: exists() before 5.6 for sub's
Message-Id: <39A175C2.85AEDF4B@networkengines.com>

Doh! perldoc sayse defined works... perhpas that should've simply been
crossreferenced in the dox instead of implementing exists for sub's....

Jerrad Pierce wrote:
> 
> Does anybody know of a way to emulate:
>         exists &foo;
> functionality in a pre 5.6 build?
> 
> Thanks!
> 
> PS> Please (b) cc me with any replies


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

Date: Mon, 21 Aug 2000 20:23:03 GMT
From: richard_rader@my-deja.com
Subject: find printers in win2000
Message-Id: <8ns32f$8al$1@nnrp1.deja.com>

I am trying to find an easy way to get a list of printers on a win2000
system. I am dreaming of creating a simple TK Gui to select a valid
printer, then issue a system command to "enscript". I have found
NetResource to get all printers, but i want only the ones already
installed on my machine (ie ones i can print to)

I found the Win32::API to access comdlg32, then the user can select the
printer. I can grab that printer name and go with that, but what i
really want is just a way to get those printer names myself.

I tried Enum, but i am FAR from a windows expert.

This has got to be easier than i am making it

thanks
rader


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 21 Aug 2000 11:11:09 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: gethostbyaddr
Message-Id: <MPG.140b10953845d67a98acab@nntp.hpl.hp.com>

In article <8nqtr6$s59$1@nnrp1.deja.com> on Mon, 21 Aug 2000 09:47:22 
GMT, zideon@my-deja.com <zideon@my-deja.com> says...

 ...

> I am writing a logfile script in Perl. With this script I would like to
> register a visitors domain/hostname. I use the following code to find
> out the host.
> 
> if ($ipadres =~ m!(\d+)\.(\d+)\.(\d+)\.(\d+)!) {
>    $host = (gethostbyaddr(pack('C4', $1, $2, $3, $4), 2))[0];
>    $host = "unknown" unless $host;
> } else {
>    $host = "unknown";
> }
> 
> I split the $host at '.', but I think I'll have a problem when $host
> contains the following string (it must only print "xs4all" and "demon"):
> - dial2334-2.xs4all.nl
> - dial32ssd.demon.co.uk
> - dial332.sdf.demon.co.uk
> 
> The first $host is from The Netherlands (.nl) and the second from the
> UK (.co.uk). Is this format always the same???
> ("dialxxx" . "domain" . "country...country").

No.  Several top-level domains are not country codes, and there may be 
arbitrarily many subdomain names before the top-level domain.

If you want the second field only (for reasons of your own), you can use 
code like:

     $domain = (split /\./ => $host)[1];

or:

     ($domain) = $host =~ /\.([^.]+)/;
 
> Where can I find how the '(gethostbyaddr(pack('C4', $1, $2, $3, $4), 2))
> [0]' is built.

That evaluates gethostbyaddr in list context, then extracts the first 
element of the list the function returns.  It is simpler to evaluate it 
in scalar context.

Also, you can use functions and constants from the Socket module to 
clean things up.

	use Socket;
	$host = gethostbyaddr inet_aton($ipadres), AF_INET;

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 21 Aug 2000 19:37:56 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Getting rid of extra spaces and returns
Message-Id: <7apun2iewa.fsf@merlin.hyperchip.com>


Larry Rosler <lr@hpl.hp.com> writes:

> In article <7avgwvie9u.fsf@merlin.hyperchip.com> on Mon, 21 Aug 2000 
> 01:39:06 GMT, Ala Qumsieh <aqumsieh@hyperchip.com> says...
> > 
> > Unknown <bob3434@excite.com> writes:
> > 
> > > Basically I want to be able to parse the data so that addional spaces
> > > between words are eliminated and additional returns (more than one) are
> > > eliminated.  Any suggestions would be appreciated.
> > 
> > You can use the /s modifier for tr///:
> > 
> > 	tr/\n //s;
> 
> No.  The following replaces sequences of newlines or spaces (intermixed 
> in any way) by single spaces:
> 
>       tr/\n / /s;

I think that the OP wanted to change multiple consecutive newlines into
one newline, and multiple consecutive spaces into one space. In which
case, my solution would be more appropriate.

But, he doesn't specify what to do with the sequence "\n \n". A better
solution, IMO, would be:

	s/\n\s*\n/\n/g;
or
	s/ \s* / /g;

--Ala


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

Date: 21 Aug 2000 19:59:49 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: grepping for multiple fields
Message-Id: <8nru75$11t$1@orpheus.gellyfish.com>

On Fri, 18 Aug 2000 08:58:51 -0500 Russ Jones wrote:
> 
>          My head's spinning! My mind is boggled. I'm itching like a
> man on a fuzzy tree. 
> 

Uh huh huh huh huh you're all shook up ...

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Mon, 21 Aug 2000 11:14:30 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Hash List Comparing
Message-Id: <MPG.140b11655d46ef9c98acac@nntp.hpl.hp.com>

In article <8nrld4$v1h$1@lublin.zrz.tu-berlin.de> on 21 Aug 2000 
16:29:24 -0000, Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> says...
> Uri Guttman  <uri@sysarch.com> wrote in comp.lang.perl.misc:
> 
> >use exists to test for keys in a hash. that is what it is for.
> 
> This can be parsed in two ways that both make sense.  Pity only one
> is true.

Pity that punctuation isn't used to disambiguate.  Though the case-shift 
mechanism may be broken, the '.' key works, so presumably other 
punctuation symbols, such as quotes or parentheses are available.  
(Single-quotes don't need a functioning case shift.)

:-)

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 21 Aug 2000 19:35:34 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: hey, i need help, im trying to get what email = from  www.mydomain.com/cgi-local/test.cgi?email=test@test.com
Message-Id: <8ns0a5$8s0s3$1@ID-24002.news.cis.dfn.de>

hi,
MC <mc@backwoods.org> wrote:
> better yet, use CGI.pm

yes

> -- or as I do it --

> use CGI;
> $mycgi = new CGI;
> foreach ($mycgi->param()) { $mycgihash{$_} = $mycgi->param($_) };
> print $mycgihash{email};

what happens to mutiple fields, such as
select or checkbuttons?
$mycgi->param('multipleselect') will return an
array...


tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \__,_\___/\___/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


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

Date: 21 Aug 2000 19:28:02 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: how to generate unreadable from readable perl code
Message-Id: <8nrvs2$v90$1@lublin.zrz.tu-berlin.de>

Abigail <abigail@foad.org> wrote in comp.lang.perl.misc:
>Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMDXLVII
>September MCMXCIII in <URL:news:8nrevj$uq6$1@lublin.zrz.tu-berlin.de>:
>|| Abigail <abigail@foad.org> wrote in comp.lang.perl.misc:
>|| >Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMDXLVII
>|| >September MCMXCIII in <URL:news:8nr4ud$ugb$1@lublin.zrz.tu-berlin.de>:
>|| >\\ 
>|| >\\ So you're saying there is a set of rules such that if a Perl source
>|| >\\ is written accordingly it it easy to (for instance) recognize all
>|| >\\ Perl identifiers and skip identical strings that aren't identifiers?
>|| >\\ Not to speak of other requirements, like comment parsing, recognition
>|| >\\ of quoted text, etc....
>|| >
>|| >Well, yes, I think it's trivial to program Perl in such a way that any
>|| >substring that consists of '$', '@', '%' followed by an identifier, but
>|| >not preceded by a backslash, is a variable, and that all variables are
>|| >written that way. It's also trivial to write Perl such that any occurance
>|| >of a '#' that does not start a comment is proceeded by a backslash.
>|| 
>|| Okay, fortunately for that claim $#array and $# aren't really needed.
>|| What if $# becomes interesting again?  What about $$?  Symrefs are out,
>|| you can't rename a variable that's accessed via ${ $x.$y}.
>
>$$ certainly isn't a '$' followed by an identifier. And if you have $$
>followed by letters, you can write the $$ as ${$}. Similar for all 
>punctuation symbols.

Yes, I noticed that $$ is no problem.

>                      And for $#, you can always write ${"0x23"} or
>${"\#"}.

That's why I mentioned symrefs.  You can't do that while you're strict.

>As for symrefs are out, you wouldn't be doing symrefs with 'use strict'
>anyway, now would you? Sure, you can't translate Exporter.pm this way.
>Big deal. Don't write Exporter that way then.
>
>|| Did I hear someone say "use English"?
>
>Well, it's trivial to not use English, now is it? That's what I claimed.
>Perhaps you can't code without the use of English.pm, but rest assured,
>most people can. ;-)

Uh, myself, I never used English.

Anno


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

Date: 21 Aug 2000 20:47:36 GMT
From: abigail@foad.org (Abigail)
Subject: Re: how to generate unreadable from readable perl code
Message-Id: <slrn8q359u.tj3.abigail@alexandra.foad.org>

Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMDXLVII
September MCMXCIII in <URL:news:8nrvs2$v90$1@lublin.zrz.tu-berlin.de>:
-- Abigail <abigail@foad.org> wrote in comp.lang.perl.misc:
--
-- >                      And for $#, you can always write ${"0x23"} or
-- >${"\#"}.
--
-- That's why I mentioned symrefs.  You can't do that while you're strict.

    #!/opt/perl/bin/perl -w

    *{"hash"} = *{"\#"};
    use strict;

    ...


But then, who really needs $# anyway? ;-)


Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'


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

Date: Mon, 21 Aug 2000 21:57:22 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: how to generate unreadable from readable perl code
Message-Id: <sq39e24u87v177@corp.supernews.com>

Horst Wassenberg (horst@swid.de) wrote:
: I need to provide perl code to others, but I would like to avoid that
: - the code can be understood easily

Oddly, you can achieve this by hiring either very good or very bad
programmers.

: - can be extended by others

That doesn't seem very nice, but okay.

See 'perldoc -q hide' for a brief but enlightening discussion of your
source protection options.

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Every force evolves a form."
   |              - Shriekback


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

Date: Mon, 21 Aug 2000 19:40:27 GMT
From: "Edvin Eshagh" <eeshagh@earthlink.net>
Subject: Install MailTools on ActiveState perl 5.6 !!!
Message-Id: <LAfo5.504$D4.21208@newsread1.prod.itd.earthlink.net>

I am unable to locate and install mailtools for perl 5.6 (ppm search
mailtools)
when the same command on Active Perl build 522 finds MailTools 1.12.
(I have NT 4, SP5, AcitveState Perl 5.6.)

I've attempted to download MailTools from CPAN:
http://www.perl.com/CPAN-local/modules/by-module/Mail/MailTools-1.1401.tar.g
z
and install it manually.  I extract the tar.gz and copy ..\Mail\ directory
into my
d:\perl\site\lib\

When I run a sample smtp mail.pl program, I get the following message:

    "Bad file descriptor at D:/Perl/site/lib/Mail/Mailer.pm line 267"

How do I solve this!!!
Tnx in advance






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

Date: Mon, 21 Aug 2000 15:56:24 -0500
From: "Tim" <no@return.com>
Subject: Re: Install MailTools on ActiveState perl 5.6 !!!
Message-Id: <8ns51o$anh$1@schbbs.mot.com>


> I've attempted to download MailTools from CPAN:
>
http://www.perl.com/CPAN-local/modules/by-module/Mail/MailTools-1.1401.tar.g
> z
> and install it manually.  I extract the tar.gz and copy ..\Mail\ directory
> into my
> d:\perl\site\lib\
>

I believe perl 5.6 and perl 5.005 need different versions of modules, there
was an error in the link for 5.6 packages on the ActiveState sight.Here are
the correct ppm Package libraries:


5.005: http://www.activestate.com/PPMPackages/5.005/zips/

5.6: http://www.activestate.com/ppmpackages/5.6/zips/

(Notice that MailTools.pm is not yet available for 5.6)

I hope this helps, there is a discussion thread regarding this topic on the
ActiveState sight as well.

Timothy Bendfelt




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

Date: Mon, 21 Aug 2000 20:35:56 GMT
From: nicros@my-deja.com
Subject: Membership management
Message-Id: <8ns3rb$9bl$1@nnrp1.deja.com>

I posted this earlier, I forgot to specify that this is for a linux
system (RH 6.2) running Apache...

I am looking for a free or shareware membership management package that
will be useable for a non-technical person.  It would need to control
multiple users via a simple hmtl page (this user will not have root
access), and any other features are a bonus, like any kind of tracking.

It can be either a .htaccess parser/manipulator or deal directly with a
db (mysql is my choice), and my preference (hence the post to this
group) would be a perl utility.

Before I reinvent the wheel, does anyone have any suggestions on what is
the best or most standard script/module for this? What is the most
popular, professional, etc.

Thanks!


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 4084
**************************************


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