[6908] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 533 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 28 17:17:14 1997

Date: Wed, 28 May 97 14:00:21 -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           Wed, 28 May 1997     Volume: 8 Number: 533

Today's topics:
     Re: adduser.pl script I wrote (Chipmunk)
     Re: Any non number but not a dot... <rootbeer@teleport.com>
     Re: Any non number but not a dot... <pjoiner@nol.net>
     Applying patch for the compiler <jmscott@ainet.com>
     Associate This! <stzydek@rs6000.cmp.ilstu.edu>
     Re: binary conversions ?? (Mike Stok)
     Re: Error checking with name strings <jhi@alpha.hut.fi>
     hash or array in perl 4? <mho@array.ca>
     How old is my file??? (Buzz)
     How to extract text enclosed by... (CHAN TANG Eric-Aubert)
     How to extract text enclosed by... (CHAN TANG Eric-Aubert)
     Re: How to extract text enclosed by... (Mike Stok)
     Re: libwww GET problem (Matthew Burnham)
     Re: Linux issues with 5.004. <rra@stanford.edu>
     Re: Losing STDOUT and STDERR (Chipmunk)
     Re: Mysterious behavior with FileHandles, zero byte fil (Abigail)
     Re: Problem with crypt (Ken Shan)
     Re: Problem with crypt <oboyle@purdue.edu>
     Re: Problem with crypt <rootbeer@teleport.com>
     Re: PURE PERL .gif creating library needed; not in @#$  (Abigail)
     Re: regexp solver (Chipmunk)
     Standalone web database for Perl? (Gary Weinfurther)
     Re: Tatum O'Neil <chris@ixlabs.com>
     Re: using getopt or getopts function <david.s.patterson@boeing.com>
     Re: Using hash, appending and dbm <bannerd@cs.byu.edu>
     Where can I get Net::FTP? (Robert Chapman)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 28 May 1997 18:47:52 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: adduser.pl script I wrote
Message-Id: <5mhuko$49r$1@dartvax.dartmouth.edu>

In article <01bc6a79$061bbf00$1a0b1ccb@euler.goulburn.net.au>
"Luke Burton" <hagus@goulburn.net.au> writes:

>         if (length($username) > 8) {
>                 print "That username was too long. Try again\n";
>                 exit(0);
>         }

What if the username is too short?

Chipmunk


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

Date: Wed, 28 May 1997 12:01:41 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: christopher <christopher@wonderlandinorbit.com>
Subject: Re: Any non number but not a dot...
Message-Id: <Pine.GSO.3.96.970528115036.29234T-100000@kelly.teleport.com>

On Thu, 29 May 1997, christopher wrote:

> I just need to return true if a string is made entirely of
> numbers and dots.

    print "Nothing but numbers and dots\n" 
        if $string !~ tr/0-9.//c;

Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Wed, 28 May 1997 14:20:34 -0500
From: "Paul B. Joiner" <pjoiner@nol.net>
Subject: Re: Any non number but not a dot...
Message-Id: <338C8582.6D6A@nol.net>

christopher wrote:
> ...I just need to return true if a string is made entirely of
> numbers and dots.

Maybe this

	/^[\d\.]+$/

-- 
paul joiner
pjoiner@nol.net
http://www.nol.net/~pjoiner/


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

Date: Wed, 28 May 1997 13:41:24 -0700
From: "Joseph M. Scott" <jmscott@ainet.com>
Subject: Applying patch for the compiler
Message-Id: <338C9874.76D0@ainet.com>

I've been reading through the info on the perl compiler that Malcom
Beattie has been working on.  For the most part things look pretty
straight forward, however I'm not familiar with applying patches to
perl.  ( Never had a problem compiling it on a couple of different
systems in the past :-) )  
	I took a look in the Camel book and on page 551 Larry mentions
patches.  It points to getting a patch program from GNU.

	Has anyone done the patch on perl for the compiler ok and would they be
willing to share that info with me?

	Thanks...

	-=joseph
		jmscott@ainet.com=-


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

Date: 28 May 1997 20:21:13 GMT
From: Steven T. Zydek <stzydek@rs6000.cmp.ilstu.edu>
Subject: Associate This!
Message-Id: <5mi43p$qgu@thor.cmp.ilstu.edu>

Hello,

I just wanted to know what the most efficient way to "clean" out the
existing elements of an associative array.  Here's my dilemma:

-------------------------cut here ------------------------------------
#!/usr/local/bin/perl -w

$FriendsHeight("Greg") = "6 ft 7";
$FriendsHeight("Pete") = "7 ft 1";
$FriendsHeight("Joe") = "5 ft 3";
$FriendsHeight("Jack") = "6 ft 7";

delete ($FriendsHeight("Joe");

# Now how would I list the existing friend's height's in a way
# that I could also count how many friend's heights I have left
# in the array?
# I have tried this:

foreach (%FriendsHeight) {
    $x++;
    print "$_\n";
    }

# but this adds the name of each element (i.e. Greg, Pete, Jack...)
# as if it were a height?  Is there some sort of command that simply
# flushes out the name of the element and it's contents as ONE entry?
# Tell me what you think!

Thanks,
Steven Zydek

-- 
Networking Systems * Jul 146 * 309-438-5343 * M, T, W, T, F 8:AM - 5:PM 
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|  Expression is essential for comprehending what this is all about   |
|           *   Soon to Come: Everything Makes a Sound.   *           |
|                http://www.ilstu.edu/~stzydek/kulprit                |
*---------------------------------------------------------------------*


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

Date: 28 May 1997 20:26:29 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: binary conversions ??
Message-Id: <5mi4dl$q4t@news-central.tiac.net>

In article <338B11E4.41C6@iil.intel.com>,
Sefi Kraemer  <skraemer@iil.intel.com> wrote:
>Hi,
>
>I need to convert a hex integer into a binary integer.
>The former is proccesed and printed.
>Does perl support such a feature? Do I have to right my own convertion
>function?

Assuming that you are interested in 32 bit quantities this:

#!/usr/local/bin/perl

print &hex2bin ('0xfacedeaf'), "\n";

sub hex2bin {
  my $hexString = shift;
  my $integer = hex $hexString;

  return scalar reverse unpack 'b32', pack 'V', $integer;
}

__END__

produces 1111 1010 1100 1110 1101 1110 1010 1111 (without the spaces...)

This should give you somewhere to start,

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 28 May 1997 21:18:52 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Error checking with name strings
Message-Id: <oeehgfn794j.fsf@alpha.hut.fi>


> Some people are working on adding "approximate" matching abilities to
> Perl's regular expression engine. Until that happens, it'll be a little
> harder to do what you want. :-(

Well, meanwhile, you could give a try to a module of mine,

http://www.perl.com/CPAN/modules/by-module/String/String-Approx-2.1.tar.gz 

NOTE: it is not visible right now (Wed May 28 1900 GMT), but in about
24 hours it should have propagated all around the world.  It is
written in Perl so it is not as blindingly fast as the usual Perl
regular expression matching is but hey, trying it won't hurt.

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: Wed, 28 May 1997 18:57:46 GMT
From: Matthew Ho <mho@array.ca>
Subject: hash or array in perl 4?
Message-Id: <338C7F2A.167E@array.ca>

How can I use hash of array in perl 4?

e.g.
$name{firstname}[0]="matthew";

doesn't work in perl 4.

Is there any other way of doing this in perl 4?

Thanks,
matthew 
mho@array.ca


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

Date: 28 May 1997 19:52:03 GMT
From: shommel@gnu.uvm.edu (Buzz)
Subject: How old is my file???
Message-Id: <5mi2d3$hsl@swen.emba.uvm.edu>

Hello, can anyone tell me the easiest way to 
have perl inform me of the creation date of a file?
Let's say I have a file called "foo.bar" in my directory.
 How can I read the creation date into a variable?
I tried 'stat' but that's not what I am looking for.


If you can answer this, 
please email me at shommel@zoo.uvm.edu

Thanks!

- Scott


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

Date: 28 May 1997 19:16:02 GMT
From: chantane@JSP.UMontreal.CA (CHAN TANG Eric-Aubert)
Subject: How to extract text enclosed by...
Message-Id: <5mi09i$q9t@epervier.CC.UMontreal.CA>


How can I extract text enclosed by some strings.

Example:

$text = 'This is a (sample ( text) string)_) for example.';
$sample = &extract($text, '(', '_)');

$sample should contains: 'sample ( text) string)'.

Of course, I'm looking for a Perl solution, without calling
'sed' or 'awk'.


With 'index' and 'rindex', I can have the first and last
positions but don't know how to get the text enclosed.



Thanks in advance.
-- 
  ____________________________________________________________
   (3/1R&() Eric-Aubert Chan Tang <chantane@JSP.UMontreal.CA>
            http://www.jsp.umontreal.ca/~chantane/


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

Date: 28 May 1997 19:51:45 GMT
From: chantane@JSP.UMontreal.CA (CHAN TANG Eric-Aubert)
Subject: How to extract text enclosed by...
Message-Id: <5mi2ch$skm@epervier.CC.UMontreal.CA>

How to extract text enclosed by any strings?

Example:

$text = 'This is a (sample ( text) as )an _) example.';

# The purpose of the sub-routine 'extract' is obvious here...
$sample = &extract($text, '(', '_)');

$sample should then contain 'sample ( text) as )an '.

Of course, I'm looking for a solution without requiring calls to
'sed' or 'awk', if possible..


With 'index' and 'rindex', I can have the first and last positions
but how can I get the text enclosed?

printf $text[5];
doesn't return anything, though it contains 'i'...


Thanks for any help.

--
Eric-Aubert Chan Tang <chantane@jsp.umontreal.ca>
http://www.jsp.umontreal.ca/~chantane


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

Date: 28 May 1997 20:55:29 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: How to extract text enclosed by...
Message-Id: <5mi641$rkg@news-central.tiac.net>

In article <5mi09i$q9t@epervier.CC.UMontreal.CA>,
CHAN TANG Eric-Aubert <chantane@JSP.UMontreal.CA> wrote:
>
>How can I extract text enclosed by some strings.
>
>Example:
>
>$text = 'This is a (sample ( text) string)_) for example.';
>$sample = &extract($text, '(', '_)');
>
>$sample should contains: 'sample ( text) string)'.

You can use regexes:

#!/usr/local/bin/perl -w

$text = 'This is a (sample ( text) string)_) for example.';
$sample = &extract($text, '(', '_)');

print "sample is '$sample'\n";

sub extract {
  my ($string, $front, $back) = @_;

  return $1 if $string =~ /\Q$front\E(.*)\Q$back\E/;
  return;
}

or you can use index and rindex something like:

sub extract {
  my ($string, $front, $back) = @_;
  my $frontIndex = index $string, $front;
  my $backIndex = rindex $string, $back;

  if ($frontIndex >= 0 and $backIndex >= $frontIndex + length $front) {
    return substr $string, $frontIndex + length $front,
                  $backIndex - $frontIndex - length $front;
  }

  return;
}

(which is untested and assumes that $[ hasn't been abused ...) and as this
is perl there are many other ways to do
it.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Wed, 28 May 1997 19:06:54 GMT
From: danew@enterprise.net (Matthew Burnham)
Subject: Re: libwww GET problem
Message-Id: <338c5bf8.24585568@194.72.192.4>

"Jason A. Soloff" <jsoloff@psu.edu> wrote:

>First, sorry for the crosspost (.misc and .modules) but I think
>that it fits both.
>
>Anyway, I am using libwww 5.08 on perl 5.003 on an IRIX system
>(SGI's).  I am trying to do a basic, simple GET request to a 
>public HTTP server.  Have not been able to get any real data back,
>just error messages from the server.
>
>The only line really doing much is the request(xxx,xxx,xxx,xxx) call.
>The weird thing, and this is where I am confused is that my code
>works just fine on one system, but not on another, so the code is
>OK.
>
>The errors are bad client request, and bad response from server.
>If I just use a pure socket call, the socket will not connect from
>the machine with the problem, but WILL connect and bind on the one
>that works.
Well that's your problem then!

>I think there is a problem in the configuration for the TCP/IP 
>networking on the problem machine, but am not sure where to look
>for it.  I don't have enough access to poke around, but would
>appreciate any advice as to where to direct my sysadmin.
Does incoming work? ie. is the machine a website?


-- 
Matthew Burnham, Manager, MindWeb | danew@enterprise.net
Commercial web design and hosting, reasonable rates
UKP24/Mb/Year for DIY space | mindweb@pobox.co.uk
FTP, CGI, password protection, etc. too!
http://www.virtual-pc.com/mindweb/


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

Date: 28 May 1997 13:46:32 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Linux issues with 5.004.
Message-Id: <m3aflffhp3.fsf@windlord.Stanford.EDU>

Rachel Polanskis <rachel@virago.org.au> writes:

> I also noted some issues with Linux and perl 5.004 I tried building a
> heavily optimised version of 5.004 on a linux box, with kernel 1.2.13,
> and gcc 2.7.0 I used the following optimisations:
          ^^^^^

> -O3 -m486 -fomit-frame-pointer -fstrength-reduce -funroll-loops
                                 ^^^^^^^^^^^^^^^^^

> Although the compile went perfectly, the tests failed on all the DBM,
> SDBM, GDBM, and NDBM modules, and some of the op* ones.

If I recall correctly, there's a known bug in strength reduction for any
unpatched gcc version between 2.7.0 and 2.7.2.  That may well be the
source of your difficulties.

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>


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

Date: 28 May 1997 18:57:40 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Losing STDOUT and STDERR
Message-Id: <5mhv74$49r$2@dartvax.dartmouth.edu>

In article <19970527144701.KAA07855@ladder01.news.aol.com>
furnerner@aol.com (FURNERNER) writes:

> While performing a system call such as:
>     "system("copy", "file1", "file2", "> NUL", "2>NUL");"
> with redirection of STDOUT and STDERR, I am losing the connects of file1
> in the process.  More specifically the statement is producing a "0" byte
> file called "file2".  I do not see this occur all the time, it is a
> mystery to me at this point.  If I remove the redirection of STDOUT and
> STDERR, the command executes correctly.  My question is: Is there a bug in
> PERL in handling FileHandles?

You're trying to use FileHandles in a system call?  Whatever gave you
the idea you could do that?!
And you're using the FileHandles in a double-quoted string... 
FileHandles can't be interpolated.

I think what you want is something like this:
system("copy", "file1", "file2", "> /dev/null", "2> /dev/null");

Chipmunk


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

Date: Wed, 28 May 1997 18:35:25 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Mysterious behavior with FileHandles, zero byte files created.
Message-Id: <EAwMB1.8xu@nonexistent.com>

On 28 May 1997 13:44:53 GMT, FURNERNER (furnerner@aol.com) wrote in
comp.lang.perl.misc
<URL: news:19970528134400.JAA12684@ladder02.news.aol.com>:
++ I have been seeing some "mysterious" behavior when executing a "system"
++ call as follows:
++     -->  system("copy", "file1", "file2", ">NUL", "2>NUL");
++ I am trying to keep STDOUT and STDERR from being painted on the screen my
++ script is being executed.   By executing the command as listed above, file
++ 2 is created as a "zero" byte file.  If I remove the redirection of STDOUT
++ and STDERR, file2 gets created correctly.  The problem does not always
++ occur, which makes this problem "mysterious" to me.  Has anyone else had
++ any problems with FileHandles or with redirection of STDOUT or STDERR?


Calling system with a list of arguments bypasses shell interpretation
of characters. That includes any shell redirects, like >, >> and <.

Why not:

use File::Copy;

copy 'file1', 'file2' or die "Yippie: $!";



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'


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

Date: 28 May 1997 18:01:34 GMT
From: ken@digitas.harvard.edu (Ken Shan)
Subject: Re: Problem with crypt
Message-Id: <5mhrtu$4fr$1@news.fas.harvard.edu>

Yvonne Wang (yvonne@att.com) wrote:
> Hi,

> When I try to encrypt a text which is more than 8 chars, it seems the
> result is the same as that of first 8 chars. The following is the test
> program:

That's just how crypt works.

Should be documented in perlfunc, perhaps?

--
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
"Some people have entirely too much free time on their hands."
  - Gene Spafford (spaf)


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

Date: 28 May 1997 19:02:09 GMT
From: Todd O'Boyle <oboyle@purdue.edu>
To: yvonne@att.com
Subject: Re: Problem with crypt
Message-Id: <5mhvfh$art@ector.cs.purdue.edu>

[ courtesy copy cc'ed to yvonne@att.com and posted ]

Yvonne Wang <yvonne@att.com> contributed:
> When I try to encrypt a text which is more than 8 chars, it seems the
> result is the same as that of first 8 chars. The following is the test
> program:

[bunch of code cut]

>From the crypt(3) man page:

DESCRIPTION
     crypt() is the password encryption function.  It is based on
     a  one-way  encryption  algorithm  with  variations intended
     (among other things) to frustrate use of hardware  implemen-
     tations of a key search.

     key is the input string to encrypt, for instance,  a  user's
>>   typed  password.   Only the first eight characters are used;
     the rest are ignored.  salt is a two-character string chosen
     from  the  set [a-zA-Z0-9./]; this string is used to perturb
     the hashing algorithm in one of 4096 different  ways,  after
     which  the  input  string  is  used as the key to repeatedly
     encrypt a constant string.  The returned value points to the
     encrypted  input  string.   The  first two characters of the
     return value are the salt itself.


Notice the line with the '>>'s.  Only the first eight chars are used.

There are many encryption modules on CPAN.  Try:
http://www.perl.org/CPAN/modules/by-category/ \
       14_Authentication_Security_Encryption/

hope that helps!

cheers,
-Todd
-- 
Todd O'Boyle  		- Programmer, Perl Hacker, BMX Rider, etc. -
URL: <a href="http://www.cs.purdue.edu/homes/oboyle/"> My Homepage! </a>
PGP: finger oboyle@cs.purdue.edu
EMAIL: oboyle@purdue.edu


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

Date: Wed, 28 May 1997 12:28:10 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Yvonne Wang <yvonne@att.com>
Subject: Re: Problem with crypt
Message-Id: <Pine.GSO.3.96.970528122355.29234X-100000@kelly.teleport.com>

On Wed, 28 May 1997, Yvonne Wang wrote:

> Subject: Problem with crypt

> When I try to encrypt a text which is more than 8 chars, it seems the
> result is the same as that of first 8 chars. 

Yes, that's right. Perl's crypt() function simply calls the underlying
system's crypt(3) function. That function uses only the first eight
characters.

If you wish to do something fancy to allow longer passwords and pass
phrases, consider using an MD5 hash. If, on the other hand, you're trying
to do encryption and decryption, you want something like PGP. Modules for
working with either or both of those are available on CPAN. Hope this
helps!

    http://www.perl.org/CPAN/
    http://www.perl.com/CPAN/

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Wed, 28 May 1997 18:31:59 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: PURE PERL .gif creating library needed; not in @#$ C language or external modules.  PERL!
Message-Id: <EAwM5B.8JB@nonexistent.com>

On 28 May 1997 09:02:31 GMT, Alexander Petrosyan (paf@fbit.msk.su) wrote in
comp.lang.perl.misc,comp.lang.perl.modules
<URL: news:01bc6b44$77494550$32c8c8c8@paf>:
++ Alexander Petrosyan <paf@fbit.msk.su> ZAPISANO W STATX@
++ <01bc6b3e$ce80c060$32c8c8c8@paf>...
++ > > ++ http://www.eecs.ukans.edu/~skang/programs/ksl-count.txt counter
++ which
++ > > ++ outputs image/x-xbitmap.
++ > > ++ But I want multicolored image, which is impossible with x-xitmap
++ > > Output a PPM format then.
++ > YYEESS!  Think it's what I'm looking for. Thanks a lot, Abigail.
++ To my great regret that PPM's NOT what I need.
++ From the first sight I decided that it's like x-xbitmap and browser will
++ show it but... 

Uhm, PPM isn't like xbitmap. Isn't xbitmap a C datastructure?  PPM is
just numbers, whitespace separated, 3 numbers per pixel.  The first few
bytes of the file are the magic number, image size and the max value.
After that, just pixels, pixels, pixels...

++ Browser said "what to do with it? I don't know"...

Djee, get a better browser. I had one before the first public Netscape
binaries that could deal with all common picture formats. (Well, in
fact it could only do PPM; it just translated everything to PPM).

++ And in some counter.pl I've came across:
++ 	open(OUT,"|/opt/pbmplus/bin/ppmtogif 2>/dev/null");
++ :(

pbmplus (or netpbm) is cool. Get it.

++ But I need PURE PERL program producing multicolored image.

That's insane. Perl is written in C too.
 
But the PNG standard is free, and it doesn't use any patented
algorithmes. Feel free to write a pure perl PNG image generator.
   
PS, if you really have the urge to drop a copy of your posting in my
    mailbox (I rather not have one) please indicate that in your
    email!
  
 
Abigail
-- 
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'


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

Date: 28 May 1997 19:41:07 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: regexp solver
Message-Id: <5mi1oj$c42$1@dartvax.dartmouth.edu>

In article <5mfggf$82q@shoga.wwa.com>
scribble@shoga.wwa.com (Tushar Samant) writes:

> In article <5mf557$51v@info.abdn.ac.uk>, Kyzer <kyzer@hotmail.com> wrote:
> >I'm wondering, is there a program to solve perl regexps?
> >(That is, print out all possible matches, using * to represent 'this could
> >match anything, and I'm not going to print that all out)
> 
> I have one in late, late beta. Alas, I still need to add some more
> intelligence for the "match anything" part...

Actually, I think it would be much easier to write such a program if
you didn't use * to represent 'this could match anything...'.


$regexp = "whatever";

@chars = ("", "\000" .. "\177");

print "The following strings match /$regexp/\n";

while (1) {
    $_ = '';

    for ($i = $#str; $i >= 0; --$i) {
           $_ .= $chars[$str[$i]];
    }
    if (/$regexp/) {
           print "\t\"$_\"\n";
    }

    $str[0]++;
    $i = 0;
    while ($str[$i] > $#chars) {
           $str[$i] = 1;
           $str[++$i]++;
    }
}


Chipmunk


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

Date: Wed, 28 May 1997 16:15:33 -0400
From: gary@mich.com (Gary Weinfurther)
Subject: Standalone web database for Perl?
Message-Id: <MPG.df65c741202955a989680@news.mich.com>

A client wants a "simple" database application developed in Perl for a 
corporate intranet.  According to the client, the web server does not 
currently have a DBMS.  He wants a small, low-budget database for this 
application and it does not need to interact with any other application 
on the intranet.  Is there a Perl library that manages database records, 
similarly to a data management library for C or other languages?  Or do 
we have to purchase a large C/S RDBMS and install it on the server?

Thanks in advance!
-- 

   ...Gary (gary@mich.com)


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

Date: Wed, 28 May 1997 13:15:07 -0700
From: Chris Schoenfeld <chris@ixlabs.com>
To: Tad McClellan <tadmc@flash.net>
Subject: Re: Tatum O'Neil
Message-Id: <338C924B.3676@ixlabs.com>

Tad McClellan wrote:
> 
> Paul T. McNally (paulmc@radiks.net) wrote:
> : Does anyone know when the actress and Oscar winner Tatum O'Neil
> : was born? I'm thinking she was born close to 3-6-62, but I knew more
> : when I had this bitty crush about the time Bad News Bears came out.
> : I need to know for it may become a vital part of my home page!!
> : Very important!

Here is a perl script which will extract Tatum's birthday from the
Internet Movie Database, strip the HTML tags, and print it to the
screen:

#!/usr/local/bin/perl5 -Tw
use strict;

print fetch('http://us.imdb.com/cache/person-biography/b64686');

sub fetch{
        use LWP::UserAgent;
        my $url = shift;

        my $ua=new LWP::UserAgent;                      # New UserAgent
object
        $ua->agent('Tatum birthday grabber 0.9');       # Set agent name
property

        my $req = new HTTP::Request 'GET', $url;        # New HTTP
request object
        $req->header('Accept' => 'text/html');  # Set header property

        my $res = $ua->request($req);           # Invoke UserAgent
request method
                                                # with HTTP request
object as argument

        if($res->is_success){                   # Did it work?
                my @array = split(/\n/,$res->content);

                foreach(@array){
                        if (/on-this-day/){
                                s/<[^>]+>//g;
                                print "$_\n";      
                                }
                        }
        }else {
                "Error:" . $res->code . " " . $res->message . "\n";    
# Or print error message
                }
}

Chris Schoenfeld


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

Date: Wed, 28 May 1997 18:53:19 GMT
From: "David S. Patterson" <david.s.patterson@boeing.com>
To: "Nathan V. Patwardhan" <nvp@shore.net>
Subject: Re: using getopt or getopts function
Message-Id: <338C7F1F.59E2@boeing.com>

Nathan,

I had this problem a few weeks ago.  I was 
able to solve it by upgrading from perl 5.001
to a higher version.


Nathan V. Patwardhan wrote:
> 
> SPrashant (sprashant@aol.com) wrote:
> : I am a new user of perl and I am trying to use the library module getopt
> : in my script. I get "Bus error(core dumped)". Following script is a test
> : script that produces the above error.
> 
> What OS are you using?  What version of Perl?
> 
> : #! /usr/local/bin/perl
> 
> What's this?
> 
> #!/usr/local/bin/perl -w
> 
> : use Getopt::Std;
> : getopt('dV');
> 
> Looks ok to me.
> 
> What else are you using in your script?
> 
> --
> Nathan V. Patwardhan
> nvp@shore.net

-- 
"What could possibly go wrong?..."

     David S. Patterson, Sr. Software Engineer
     Production Illustration Systems  (206) 865-3176
     david.s.patterson@boeing.com   Mail Stop: 7J80


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

Date: Wed, 28 May 1997 12:09:03 -0600
From: Dave Banner <bannerd@cs.byu.edu>
Subject: Re: Using hash, appending and dbm
Message-Id: <338C74BF.2C85@byu.edu>

Chris Nandor wrote:
> 
> In article <5mfr84$cok$1@news10.gte.net>, jbharvey@gte.net wrote:
> 
> #        $var  .= join "#", $date,$status, $user, $sess, $time, $clid;
> #                $hash{$ip} = $var;
> #
> #But it reports this:
> #
> #        ndbm store returned -1, errno 28, key "199.180.3.29" at roto
> #line 17, <DETAIL> chunk 118.
> 
> I could be wrong, so don't shoot me, but it seems I remember a similar
> error that resulted from the value being too big.  I think for NBDM the
> maximum size of key + value can be 1K.  Perhaps that is your problem.

I was unaware of key + value size restrictions on any of the DBM
modules. Page 380 of the blue camel book shows *block* size limits but
is this the same thing?

-Dave
-hulk@byu.edu


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

Date: 28 May 1997 19:40:15 GMT
From: robc@no_spam!_igs.net (Robert Chapman)
Subject: Where can I get Net::FTP?
Message-Id: <5mi1mv$1bi2@piper.pwgsc.gc.ca>

I have checked enterprise.ic.gc.ca/pub/perl/CPAN/modules/by-module/Net and I 
did not find it.

Am I thinking correctly that this is a module like CGI.pm and I just need to 
download it, install it and learn the syntax for usage?

Any information would be appreciated.

Thanks
Rob
-- 
==============
Robert Chapman
robc@igs.net
http://www.igs.net/~robc



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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.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 533
*************************************

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