[10106] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3699 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 12 08:07:23 1998

Date: Sat, 12 Sep 98 05:00:31 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 12 Sep 1998     Volume: 8 Number: 3699

Today's topics:
    Re: CGI.pm's HTML shortcuts <yu207526@yorku.ca>
    Re: Comments on my Code? (Ronald J Kimball)
    Re: Comments on my Code? (David A. Black)
        fast/minimal server load CGI script (Jerrad Pierce)
    Re: Have problem with import of global variables <alitvak@shrike.depaul.edu>
    Re: History of Perl - round 1 <eashton@bbnplanet.com>
        Newbie need help about mSQL.... jteens@my-dejanews.com
        newsgroups <"jdcaraway@mindspring.com"@mindspring.com>
        NT Error levels <dreyes@worldnet.att.net>
    Re: Objects & type checking (Tye McQueen)
    Re: Pattern substitution (Craig Berry)
    Re: Perl gurus opinion needed. (Jitze Couperus)
        read() but how? <okcivil@soback.kornet.nm.kr>
    Re: Regular expression question <dgris@rand.dimensional.com>
    Re: Regular expression question (Ronald J Kimball)
        Retrieve file from PC using LWP::UserAgent? <hendrick_uselessbit_@nortel.ca>
    Re: Search/Replace but Not under certain conditions. HO (Larry Rosler)
    Re: Search/Replace but Not under certain conditions. HO (Ilya Zakharevich)
    Re: Search/Replace but Not under certain conditions. HO (Larry Rosler)
    Re: Search/Replace but Not under certain conditions. HO (Ilya Zakharevich)
    Re: vt520 emulation. (Thomas L. Shinnick)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 12 Sep 1998 03:12:02 GMT
From: "Dmytry Khodorkovsky" <yu207526@yorku.ca>
Subject: Re: CGI.pm's HTML shortcuts
Message-Id: <01bdddfb$2937e260$457a3f82@warez.ibm.net>

Look in "Teach yourself programming CGI with Perl in a week" by Erik =
Hermann. There are full description of cgi.pm library

Jay Bartelt <bartelt@enteract.com> wrote in article =
<35f97d47.20964770@news.enteract.com>...
> I almost hate to ask this question, but...
>=20
> Somebody in my group asked me for a list of HTML shortcuts created by
> Lincoln in his CGI.pm module.  I assumed a list would be in the CGI
> doc but I don't see it.  Is there a list somewhere?  Searching CPAN
> for a piece of documentation is sometimes like separating a specific
> grain of sand from the beach
>=20
> Thanks,
>=20
> Jay
> 


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

Date: Sat, 12 Sep 1998 02:05:36 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Comments on my Code?
Message-Id: <1df7yfm.1i8sqws4396cN@bay1-463.quincy.ziplink.net>

Scratchie <upsetter@ziplink.net> wrote:

> I recently wrote a command-line mass-mailing utility. I would like to post
> the code here and invite (contructive) comments and criticism. Anyone who
> assumes that this is going to be used for spam will be roundly ignored.

Pray tell, what is it going to be used for?

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sat, 12 Sep 1998 06:50:57 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: Comments on my Code?
Message-Id: <6tdjmh$l6t$1@earth.superlink.net>

rjk@coos.dartmouth.edu (Ronald J Kimball) writes:

>Scratchie <upsetter@ziplink.net> wrote:

>> I recently wrote a command-line mass-mailing utility. I would like to post
>> the code here and invite (contructive) comments and criticism. Anyone who
>> assumes that this is going to be used for spam will be roundly ignored.

>Pray tell, what is it going to be used for?

Probably spam.  I guess now I'm going to be roundly ignored.


David Black
dblack@saturn.superlink.net


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

Date: Sat, 12 Sep 1998 07:21:31 GMT
From: belg4mit@mit.edu (Jerrad Pierce)
Subject: fast/minimal server load CGI script
Message-Id: <6td7hc$kh6$1@news.tdl.com>

firstly, I know speed and load are relatively inversely proportional...

which would be better?

a) trying the perl "compiler"

b) "precompiling" the script? (dumping the kernel or something?)

please (b)cc to me as well, thanks!


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

Date: Fri, 11 Sep 1998 23:08:07 -0500
From: "Alex Litvak" <alitvak@shrike.depaul.edu>
Subject: Re: Have problem with import of global variables
Message-Id: <35f9f30c.0@news.depaul.edu>

Guys thank you for your help.  I never thought that I can generate so many
responses.  I wonder if there is any  documentation or the book on module /
package development  that a little bit easier to digest than Camel book?
Thanks Again.

Alex Litvak





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

Date: Sat, 12 Sep 1998 08:13:54 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: History of Perl - round 1
Message-Id: <35FA2AE4.93782AF0@bbnplanet.com>

> Anyway, if you're seriously interested in researching this topic,
> these are the sorts of people you need to interview.  Don't just ask
> for ancedotes and wait for people to react; come up with some
> theories, topic theses, etc, and interview people (if your budget
> doesn't allow for F2F interviews, talk to 'em over the phone or by
> e-mail), proactively get the info you need.

Nothing personal, but I generally don't take research tips from people
who cannot construct a simple or a complex sentence.

> I know, I know, this is unsolicited Male Answer Syndrome-y comment,
> but, hey, that's how I am.

h0h0h0. Oh please, stay off the crack man.

e.


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

Date: Sat, 12 Sep 1998 11:02:23 GMT
From: jteens@my-dejanews.com
Subject: Newbie need help about mSQL....
Message-Id: <6tdkbv$61e$1@nnrp1.dejanews.com>

Hello there, I'm using Msql modules to query my database. Is there a way to
exclude specific word from my query data? If I want to search for people name
"john" I can do it by use query below: select * from MYDB where name like
'%john%' Can someone show me mSQL query to search for people name "john" but
exclude people name "johnny". Any help would be mostly appreciated. Thanks,
Jteens

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 11 Sep 1998 23:49:58 -0400
From: Daniel Caraway <"jdcaraway@mindspring.com"@mindspring.com>
Subject: newsgroups
Message-Id: <6tcrku$lhk$2@camel29.mindspring.com>

How many newsgroups deal with cgi or perl and where can I find them?


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

Date: 12 Sep 1998 03:19:45 GMT
From: "Danilo Reyes" <dreyes@worldnet.att.net>
Subject: NT Error levels
Message-Id: <6tcp8h$7tl@bgtnsc03.worldnet.att.net>

Can you please let me know how  can i implement the following error checking
using perl:
    if %errorlevel% == 0
Thanks




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

Date: 11 Sep 1998 14:47:11 -0500
From: tye@fiinix.metronet.com (Tye McQueen)
Subject: Re: Objects & type checking
Message-Id: <6tbunv$j58@fiinix.metronet.com>

) In article <m3zpc7hnge.fsf@satch.markl.com>,
) Mark Lehrer  <mark@satch.markl.com> wrote:
) |That is not what I'm saying; I'm saying that I want to use the same
) |method name with different argument types, without having to make an
) |if statement to see what type of object each argument is.

kherron@campus.mci.net (Kenneth Herron) writes:
) As others have said, this is generally done by having the method
) examine its arguments.  If you're thinking that it's bad to have to
) code this yourself instead of letting the compiler do this for you,
) remember that (a) perl isn't strongly typed, so perl wouldn't have much
) to go on, and (b) perl is interpreted, so it's all runtime anyway.

And Perl gives you much more flexibility here than C++ does. 
For example, Win32::TieRegistry's new() can be called using
any of the following types of arguments:

    new( "//Host/LMachine/System/Control/" );	# String
    new( HKEY_LOCAL_MACHINE );			# Number
    new( [qw(LMachine System Control)] );	# Ref to array of strings
    # Ref to array with number and strings, plus extra option(s):
    new( [HKEY_LOCAL_MACHINE, qw(System Control)], { Access=>KEY_READ } );
    $System->new( "Control/" );			# Object plus string
    # etc.

And no need to write a separate constructor for each different
usage to handle this like is required with C++'s overloaded methods.

Plus I provided other constructors [import(), Connect(), Open(),
Clone()] that call new() [or _new()] to make other classes of
common usage easier to write.  And I let you construct using
tied hashes.

Perl doesn't provide overloaded functions partly because Perl's
data types are too fluid but mostly because you can make your own
functions behave "overloaded" in much more flexible ways by just
writing code to check the arguments.

So stop thinking overloaded functions when you are writing Perl.
-- 
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


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

Date: 12 Sep 1998 06:31:31 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Pattern substitution
Message-Id: <6td4g3$vb$1@marina.cinenet.net>

dzuy@my-dejanews.com wrote:
: 	$url =~ s/.$//;		# Get rid of the last .

Actually, that gets rid of the last any-character-but-newline, ignoring a
possible trailing newline.  (Oh, and no-opping if there are two newlines
at the end.)  (And with appropriate caveats if $* is set.)

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: Fri, 11 Sep 1998 21:15:18 -0700
From: couperus@mindspring.removethis.com (Jitze Couperus)
Subject: Re: Perl gurus opinion needed.
Message-Id: <couperus-1109982115180001@user-38ld6kd.dialup.mindspring.com>

In article <6tbh1g$45j$1@monet.op.net>, mjd@op.net (Mark-Jason Dominus) wrote:

 . 
> 
> There two words here, with different histories, and it is only
> coincidence that they happen to be spelled the same way. 
> 
> Word 1:  Hack up with knives.  Hacking coughs.  
> Word 2:  Hackney cabs.  Hackneyed prose.  Hack writers. 
> 
> Which one is the `hack' in `computer hack'?  To me it seems clear that
> it's #1, not #2, and the OED concurs.
> 

But what about "going for a hack" as in informal riding of a horse
without having to get all dressed up and so forth. In the sense
of "doing it without much preparation" - it might have come from
that meaning?

Jitze


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

Date: 12 Sep 1998 07:21:41 GMT
From: Park <okcivil@soback.kornet.nm.kr>
Subject: read() but how?
Message-Id: <6td7e5$70p$1@news.kornet.nm.kr>

I trying much time for using read(). But. I can't.

I want get data from next.....

0123456789  <== ABC.TXT
 |___|
   |
  $abc

I tried..
open(ABC, "ABC.TXT");
read(ABC, bc, 5, 2);
print $abc;


c:\>perl test.cgi
  01234
c:\>

How can I get '12345' from data file?

Thank you.



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

Date: Sat, 12 Sep 1998 04:14:26 GMT
From: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: Re: Regular expression question
Message-Id: <6tcrnl$7o1$1@rand.dimensional.com>

In article <6tbv8e$797$1@rand.dimensional.com>
I <dgris@rand.dimensional.com> wrote:

>sub cryptogram {
>    my ($string, $compare) = @_;
 ...
>    for(split //, shift) {
                   ^^^^^
That should, of course, be 
     for(split //, $string) {

As written, it actually does work, but that
is completely accidental.

dgris
- I'm even more amazed that it worked considering the
error appears twice.
-- 
Daniel Grisinger           dgris@perrin.dimensional.com
`Bangladesh.  Because life is too short to run bad code.'
                               Jon Orwant


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

Date: Sat, 12 Sep 1998 02:05:38 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Regular expression question
Message-Id: <1df7zf2.1d2nw0816ll9moN@bay1-463.quincy.ziplink.net>

Sherry Coldsmith or Mike Christie <mikec@jump.net> wrote:

> My question is: given an array of all five letter words, and a given
> crypt word like "mlkqk", what is the best way to filter the array down
> to only those words that might match?  The only way I can see to do it
> is a long and laborious process of building one regexp after another for
> every possible case--impossibly tedious.  And it would have to be done
> again for every different length of word--I need to do this for every
> word length from 2 to 25.

Regexes have their uses.  This situation is not one of them.  How do you
determine if two words are cryptographically equivalent?  Very easy -
convert both strings to a canonical cryptographic form, and compare
them.

This script does just that.  The canonical cryptographic form is the
cryptographic form which is first alphabetically.  So, the canonical
form of 'camel' is 'abcde' and the canonical form of 'llama' is 'aabcb'.


#!/usr/local/bin/perl

my $crypto = shift;

my $dict = '/usr/dict/words';

open(DICT, $dict) or die "Can't open $dict: $!\n";

my $match = &crypto_canon($crypto);

while (<DICT>) {
  chomp;

  next if /[^a-z]/;
  next if length $match != length $_;
  next if $match ne &crypto_canon($_);

  print "$_\n";
}

sub crypto_canon {
  # assumes only lowercase letters!

  my($word) = @_;

  my $canon;
  my %letters;
  my $next = 'a';

  foreach (split //, $word) {
    if (not exists $letters{$_}) {
      $letters{$_} = $next++;
    }
    $canon .= $letters{$_};
  }
  $canon;
}

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Fri, 11 Sep 1998 14:11:17 -0400
From: Vince Hendricks <hendrick_uselessbit_@nortel.ca>
Subject: Retrieve file from PC using LWP::UserAgent?
Message-Id: <35F967C5.14AF592A@nortel.ca>

Hi,

   I have a web based form that allows a user to save a file onto the
web server's local disk as part of a large database application.  The
web server (Apache 1.3.1) is running on a Sun Ultra 10 with Solaris 2.6. 

   I am currently stumped on how exactly to retrieve files off of PCs
and/or Macs and other un*x file systems. I have been going through all
the FAQs and documentation and just can't seem to find this particular
scenario. My latest stab at the problem was to use LWP::UserAgent with
the following code, but it was unsuccessful for retrieving a file off of
a PC running Win95. Any ideas on where I can find a reference or a
module to do this? 

   Note: The following works fine when getting a file off of the same
unix file system.

Many thanks,

Vince Hendricks

---> code snippet (basically directly from LWP docs)

   # Create a user agent object
   $ua = new LWP::UserAgent;
   $ua->agent("AgentName/0.1 " . $ua->agent);

   # $filelocation is from the file entry box on the web form
   # For a unix box it is set to something like /u/joeblow/file
   # For a PC it is set to something like C:/somedir/somefile

   $filelocation = param('filelocation');
   $savelocation = "/opt/dir/public";

   my $req = HTTP::Request->new(GET => "file:$filelocation");

   # Pass request to the user agent and get a response back
   my $res = $ua->request($req);

   # Open, save, and close file
   open (SAVEFILE, ">$savelocation/save.test") || die "Could not open
save.tst $!";

   # Check the outcome of the response
   if ($res->is_success)
   {
       print SAVEFILE $res->content;
   }
   else
   {
       print "Bad luck this time\n";
   }

   close SAVEFILE;


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

Date: Fri, 11 Sep 1998 19:49:26 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Search/Replace but Not under certain conditions. HOW?
Message-Id: <MPG.10638111feb694b998984c@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <35f9cd2b.0@news.softcom.net> on Fri, 11 Sep 1998 18:23:22 -
0700, Tdl <lama@softcom.net> says...
> It's not glamorous, but you could do this:
> 
> $body =~ s|(http://\S+)|<a href="$1">$1</a>|g if !/@/;

Not exactly, because the first match is against $body, but the second 
match is against $_.

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


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

Date: 12 Sep 1998 03:16:26 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Search/Replace but Not under certain conditions. HOW?
Message-Id: <6tcp2a$6s$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Ron Bennett
<rb1000@ix.netcom.com>],
who wrote in article <6tafq8$ktu$1@news1.epix.net>:
> I've read the groups, faqs, etc and am still mystified as to how to do this:
> 
> $body =~ s|(http://\S+)|<a href="$1">$1</a>|g;
> 
> Converts all strings begining with 'http://' to actual hypertext links and 
> works fine.
> 
> BUT how do I code it so it does NOT match if the http://whatever address 
> contains any '@' characters in it??

I'm thinking about the AND RE-operator.  So far the meaning of a
positive AND is pretty clear, but the negation comes handy both in

   NOT A AND B

form (find blah outside of C strings and comments), and

   A AND NOT B

form.  So: how would you like if

  (?<>                   # And/russian-dolls operator
     (?>
        http://\S+
     )                   # Match URL delimited by spaces
     !(\@)
  )

were the solution to the above problem?  

How would *you* like the AND construction to look?

How would *you* like the AND construction to behave?  (I do not want
to disclose my ideas to not obstruct your imagination.  Moreover, the
exact semantic of negations is not clear yet.)

Ilya


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

Date: Fri, 11 Sep 1998 20:09:52 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Search/Replace but Not under certain conditions. HOW?
Message-Id: <MPG.106385dd9d9221b298984d@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <6tcm22$rm6$1@mathserv.mps.ohio-state.edu> on 12 Sep 1998 
02:25:06 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> says...
> [A complimentary Cc of this posting was sent to Larry Rosler
> <lr@hpl.hp.com>],
> who wrote in article <MPG.10633764802d6b889897a1@nntp.hpl.hp.com>:
> > In article <6tbndq$66g$1@mathserv.mps.ohio-state.edu> on 11 Sep 1998 
> > 17:42:18 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> says...
> > > Oups, one needs to backwack the @-sign:
> > > 
> > >          http://[^\s\@]+(?!\S)
> > 
> > Why?
> 
> Since the original RE had !-delimiters: 
> 
>       s!!!, 
> 
> thus *was* interpolated, thus $ and @ should be backwacked - unless
> $ is *obviously* a RE metachar.

Well, not in this particular case, because @] can't be an array name.  It 
works fine, while it wouldn't compile if the @ were followed by a letter 
(or a number, though I don't see how that could be confused with an 
array name).  

But I didn't realize one could interpolate an array into a character 
class.  It works fine, even including the contents of $" in the character 
class if the array has more than one element.  Not that I can imagine 
ever using something so inherently obfuscated. :-)

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


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

Date: 12 Sep 1998 03:40:31 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Search/Replace but Not under certain conditions. HOW?
Message-Id: <6tcqff$vp$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.106385dd9d9221b298984d@nntp.hpl.hp.com>:
> > Since the original RE had !-delimiters: 
> > 
> >       s!!!, 
> > 
> > thus *was* interpolated, thus $ and @ should be backwacked - unless
> > $ is *obviously* a RE metachar.
> 
> Well, not in this particular case, because @] can't be an array name.

  monk:~->perl -le '@] = (11..17); print $][5]'
  16

Ilya


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

Date: Sat, 12 Sep 1998 05:06:01 GMT
From: tshinnic@io.com (Thomas L. Shinnick)
Subject: Re: vt520 emulation.
Message-Id: <35f9ffbf.30367466@hiram.io.com>

On Thu, 10 Sep 1998 22:49:24 +0800, Y W Wong <ywwong_hk@hotmail.com> wrote:
[snip]
>Any other suggestions or advise of where can get the information are
>also welcome.
>Thank you very much in advance.
>Y W Wong

There are a number of text files under www.cs.utk.edu/~shuford/terminal/
that deal with vt100 and descendants.  One or more of these may show
the extended keys you speak of.
------

For all their days are full of pain, and their work is a vexation;
even at night their minds do not rest.  This is also vanity.
Ecclesiastes 2:23      	    (King Solomon knew programmers?)


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 3699
**************************************

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