[8191] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1810 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 4 16:13:18 1998

Date: Wed, 4 Feb 98 13:01:34 -0800
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, 4 Feb 1998     Volume: 8 Number: 1810

Today's topics:
        Question: Searching files. email@business-links.co.uk
    Re: Quickie: regexp for valid e-mail addresses scott@softbase.com
    Re: Quickie: regexp for valid e-mail addresses (Chris Nandor)
        readdir not returning all files! (Mike Torrence)
    Re: readdir not returning all files! (Chip Salzenberg)
    Re: readdir not returning all files! (Mike Torrence)
    Re: recursive regex? <vladimir@cs.ualberta.ca>
    Re: recursive regex? <vladimir@cs.ualberta.ca>
    Re: replacing things i perl <sgordon@athena.lbl.gov>
    Re: searching by file creation/modification date? (Michael Wang)
    Re: searching by file creation/modification date? (Martin Vorlaender)
    Re: Timeout socket write on Win32 <jay@rgrs.com>
    Re: unix command <tan@morline.com>
    Re: Web Client Programming Question (Chip Salzenberg)
        where do i find the faq with this information <bmcmullan@channell.com>
    Re: where do i find the faq with this information (Chip Salzenberg)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 04 Feb 1998 20:17:54 GMT
From: email@business-links.co.uk
Subject: Question: Searching files.
Message-Id: <34d8c959.2467378@news.skynet.co.uk>

Hi,

I've got a file of tab delimited information in the following format:

aa   bb   cc   dd   http:\\www.website1.com
ee   ff   gg   hh   http:\\www.website1.com
ii   aa   pp   qq   http:\\www.website1.com
yy   xx   aa   zz   http:\\www.website1.com

I'd like to be able (via a form) to search for all the, for example aa
entries and return the url's (the last data in that line) as a html
list.

I can handle the forms and opening and closing the data file, but the
search loops are proving a problem. Can anyone help?

Any help much appreciated - Thanks in advance.

Richard.


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

Date: 4 Feb 1998 18:44:24 GMT
From: scott@softbase.com
Subject: Re: Quickie: regexp for valid e-mail addresses
Message-Id: <6bacu8$ba0$3@mainsrv.main.nc.us>

Bart Lateur (bart.mediamind@tornado.be) wrote:
> My question: how do mailer programs process them?

They don't use one regex. I wrote a Perl program several
years ago that used several stages of From line parsing
to parse RFC whatever e-mail addresses.

Step one is to see if it is a user@host.xxx (Full Name) address, or a
Full Name <user@host.xxx> address. Note that many people will put
parens in the GCOS field which becomes the Full Name on outgoing
messages! This means you have to parse potentially nested (Full (The
Luser) Name) GCOS fields. The <> addresses are so much easier.

Once you've decided which form the address is in, then you can pull it
apart into fullname and address fields. You can then pull the address
apart into both sides of the @.  Then, with the hostname and username,
you can do lookups in tables like lists of valid subscribers. My
software treated user@host.domain.xxx the same as user@domain.xxx.
It's dangerous, but 99% of the time the two were equivalent. 
If you're trying to deny access to everyone but those on an approved
list, you'll probably want to add this exception to keep from
handling them manually.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: Wed, 04 Feb 1998 14:11:25 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Quickie: regexp for valid e-mail addresses
Message-Id: <pudge-0402981411250001@ppp-5.ts-1.kin.idt.net>

In article <6bac3j$55o$1@nntp1.ba.best.com>, David Fetter
<dfetter@shell4.ba.best.com> wrote:

# #!/usr/bin/perl
# $_=q{M<WES=&5M('$K96-H;R`B(B!\;6%I;"!P<F5S:61E;G1`=VAI=&5H;W5S92YG
# M;W8@+7,@(DD@=VEL;"!K:6QL('EO=2$B*SMP<FEN="`B66]U(&IU<W0@=&AR
# @96%T96YE9"!T:&4@4')E<VED96YT+"!M;W)O;B%<;B(`};s|^.*$|unpack("u*",$&)|ees;

  s|^.*$|unpack("u*",$&)|ees;

  s|^.*$|print unpack("u*",$&)|ees;
         ^^^^^^

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==       New Book: MacPerl:  Programming for the Rest of Us       ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#


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

Date: Wed, 04 Feb 1998 19:05:00 GMT
From: mst@fadavis.com (Mike Torrence)
Subject: readdir not returning all files!
Message-Id: <34d8bb0d.19004806@news.idt.net>

I am currently having a problem creating an array of files in a
directory. I am not sure what the particular problem may be. I have
not had a problem with this in the past... so I'm stumped.

I've tried both of the following:

@sgml_files = grep /sgm$/, readdir INPUT_DIR;

as well as

@sgml_files = grep /\.sgm/, readdir INPUT_DIR;

Where INPUT_DIR is the directory containing the files. There are 649
files with an sgm extention in the directory, but my array only
contains 493 of them.

Any ideas, no matter how wild, would be appreciated.

--------------------------------------------------------------------------
**************************************************************************
The preceding does not necessarily reflect my employer's opinion. No one
else ever agrees with me, what would make my employer different?
--------------------------------------------------------------------------
Mike Torrence
mst at fadavis dot com
mtorrenc at iname dot com
F.A. Davis (http://www.fadavis.com)
--------------------------------------------------------------------------


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

Date: Wed, 04 Feb 1998 19:29:27 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: readdir not returning all files!
Message-Id: <6bafmd$uug$1@cyprus.atlantic.net>

According to mst@fadavis.com (Mike Torrence):
>@sgml_files = grep /sgm$/, readdir INPUT_DIR;
>
>Where INPUT_DIR is the directory containing the files. There are 649
>files with an sgm extention in the directory, but my array only
>contains 493 of them.

Capitalization?  Trailing whitespace in the files' names?
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
        "Nice shooting, Zanthar!"  "Thanks, Denise."  // MST3K
           ->  Ask me about Perl training and consulting  <-
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Wed, 04 Feb 1998 19:45:48 GMT
From: mst@fadavis.com (Mike Torrence)
Subject: Re: readdir not returning all files!
Message-Id: <34d8c53c.21613105@news.idt.net>

On Wed, 04 Feb 1998 19:29:27 GMT, chip@mail.atlantic.net (Chip
Salzenberg) wrote:

>According to mst@fadavis.com (Mike Torrence):
>>@sgml_files = grep /sgm$/, readdir INPUT_DIR;
>>
>>Where INPUT_DIR is the directory containing the files. There are 649
>>files with an sgm extention in the directory, but my array only
>>contains 493 of them.
>
>Capitalization?  Trailing whitespace in the files' names?
>-- 

Thanks, I just forgot my i...
--------------------------------------------------------------------------
**************************************************************************
The preceding does not necessarily reflect my employer's opinion. No one
else ever agrees with me, what would make my employer different?
--------------------------------------------------------------------------
Mike Torrence
mst at fadavis dot com
mtorrenc at iname dot com
F.A. Davis (http://www.fadavis.com)
--------------------------------------------------------------------------


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

Date: 04 Feb 1998 12:57:06 -0700
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
Subject: Re: recursive regex?
Message-Id: <om90rrb0tp.fsf@tees.cs.ualberta.ca>

In article <eyh67my17y9.fsf@liddell.cstr.ed.ac.uk> Richard Caley <spt@cstr.ed.ac.uk> writes:

> One o fthings I'd really like ot see would be a non-language specific
> parser generator which could spit out perl, Java, scheme and...

Don't know about the rest, but I use a patched version of byacc that
does perl. Look in cpan/by-author/id/JAKE for a further patch that
generates OO perl5 code, and has a pointer to byacc.


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

Date: 04 Feb 1998 13:00:09 -0700
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
Subject: Re: recursive regex?
Message-Id: <om7m7bb0om.fsf@tees.cs.ualberta.ca>

As I wrote in another message, byacc generates perl. However, I'd love
to see flex or some similar lexer generator patched to generate perl.
Then we'd have a complete formal language processing suite. I'm
currently using Parse::Lex (and a module Parse::YYLex I wrote that
interfaces it to byacc), but this tries all regexps sequentially
(therefore is presumably slow), and is not as flexible as flex (can't
be controlled by the parser).



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

Date: Wed, 04 Feb 1998 10:52:00 -0800
From: Shawn Gordon <sgordon@athena.lbl.gov>
To: Richard Bellavance <charlot@CAM.ORG>
Subject: Re: replacing things i perl
Message-Id: <34D8B8D0.C8CE6AB3@athena.lbl.gov>

> I do this quite often.  Here's the kind of loop I use:
> 
>     open(IN, $n) || die("Can't open $n: $!");
>     while(<IN>) {
>         s/keyword1/value_of_keyword1/g;
>         s/keyword2/value_of_keyword2/g;
>         print;
>     }
>     close(IN);
> 
In this situation, I like to use the '-p' switch. It can
save some typing...

For example, the following code:

#!/usr/bin/perl -p

s/keyword1/value1/g;
s/keyword2/value2/g;


Does the same as the above code without dealing with opening files, etc.

This is the 'sed-like' behavior of perl

shawn


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

Date: 4 Feb 1998 19:00:07 GMT
From: mwang@alhena.ibk.ml.com (Michael Wang)
Subject: Re: searching by file creation/modification date?
Message-Id: <6badrn$fdl$1@news.ml.com>

>You can find the modification date, but not the creation date. 
>Clay Irving <clay@panix.com> I think, therefore I am. I think? 

I do not think so. 
ls --help: 
 ...
      --time=WORD            show time as WORD instead of modification time:
                             atime, access, use, ctime or status
 ...

What I do not know is under at what circumstances can access time be 
earlier than modification time?


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

Date: Wed, 04 Feb 1998 20:38:54 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: searching by file creation/modification date?
Message-Id: <34d8c3ce.524144494f47414741@radiogaga.harz.de>

Jess Askey (jess@links.magenta.com) wrote:
: Im trying to create 
: a perl program that will automatically create a "Whats New" section on a
: web page, based on date stamps of all files within a tree.

Have a look at Randal Schwartz' WebTechniques column #6 at
http://www.stonehenge.com/~merlyn/WebTechniques/col06.html

(The other columns also are worth reading - thanks, Randal.)

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: 04 Feb 1998 14:25:34 -0500
From: Jay Rogers <jay@rgrs.com>
To: Worik Macky Stanton <w.stanton@auckland.ac.nz>
Subject: Re: Timeout socket write on Win32
Message-Id: <82afc7xjdd.fsf@shell2.shore.net>

Worik Macky Stanton <w.stanton@auckland.ac.nz> writes:
> Is it possible to set some sort of timeout on a write to a socket?

Net::Telnet allows you to use a time-out while connecting, reading, or
writing.  Look for it on CPAN.  Unfortunately on a win32 machine
there's no support for time-out while connecting.

The following example will connect and then try to write all data for
up to 10 seconds.  If it can't the program dies with an error message
referring to the line number of the offending print().

    $t = new Net::Telnet (Timeout => 10);
    $t->open(Host => $host,
             Port => $port);
    $t->print($block);

If you want to retry on print failure you can do something like this:

    $t->errmode("return");
    while ($i--) {
        $t->print($block)
            and last;

        die $t->errmsg
            unless $t->timed_out;

        ## Get the part that didn't print.
        $block = substr $block, $t->print_length;
        sleep 1;
    }

    die $t->errmsg
        if $i < 0;

> I do not know what this means (from the docs for IO::Socket)
> 
>     timeout([VAL])
>         Set or get the timeout value associated with this socket. If
>         called without any arguments then the current setting is
>         returned. If called with an argument the current setting is
>         changed and the previous value returned.

The timeout for IO::Socket::INET only applies to the connect.

--
Jay Rogers
jay@rgrs.com


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

Date: Wed, 4 Feb 1998 19:37:45 -0000
From: "Tan Aksoy" <tan@morline.com>
Subject: Re: unix command
Message-Id: <34d8c2f0.0@newsread1.dircon.co.uk>

You can also use the "system" command if you like.

Monte Ohrt wrote in message <34D879F4.F0D0EED9@ispi.net>...
>Kelby Valenti wrote:
>>
>> Is there any way to run a unix command from perl?  My problem is that i'm
>> trying to set up an dbmm password protection.  The only way that I know
how
>> to set the passwords is by manually typing everything in at the shell.
This
>> can be very time consuming.  I'm going to be get the variables from the
web
>> so i will have the username and password available.
>>
>>     If anyone has any suggestion please let me know,
>>         Thanks,
>>             Kelby
>
>you execute unix shell commands with back tics:
>
>print "the current date is `date`\n";
>
>There are perl scripts that dump data into dbm files as well.
>Something like this might be on www.apache.org, or at
>least point you to the place.
>
>Monte
>
>--
>Monte Ohrt            monte@ispi.net         | 99 bugs in the code, 99
bugs,
>Chief Technologist    ispi of Lincoln        | fix one bug, compile it
again,
>                      voice: +1.402.441.3295 | 101 bugs in the code...
>http://www.ispi.net   fax:   +1.402.483.5418 |




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

Date: Wed, 04 Feb 1998 19:23:52 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Web Client Programming Question
Message-Id: <6bafaq$usk$1@cyprus.atlantic.net>

According to victor@ddsgouda.com (Victor Pronk):
>I have a problem. I bought the "web client programming" book  from
>O'Reilly and now I'm working on an webclient/webserver in one script.

You have another problem:  You're in the wrong newsgroup.
You want comp.infosystems.www.authoring.cgi, down the hall
and turn left at the sound of stampeding suits.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
        "Nice shooting, Zanthar!"  "Thanks, Denise."  // MST3K
           ->  Ask me about Perl training and consulting  <-
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Wed, 04 Feb 1998 13:50:51 -0500
From: brian mc mullan <bmcmullan@channell.com>
Subject: where do i find the faq with this information
Message-Id: <34D8B88B.60E6@channell.com>

Chip Salzenberg wrote:
> 
> According to brian mc mullan <bmcmullan@channell.com>:
> >how do i execute a .pl program from within a .pl program.
> 
> *thwack*  FAQ.


where do i find the faq with this information


> --
> Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
>         "Nice shooting, Zanthar!"  "Thanks, Denise."  // MST3K
>            ->  Ask me about Perl training and consulting  <-
>     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Wed, 04 Feb 1998 19:27:44 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: where do i find the faq with this information
Message-Id: <6bafj5$utq$1@cyprus.atlantic.net>

According to brian mc mullan <bmcmullan@channell.com>:
>Chip Salzenberg wrote:
>> According to brian mc mullan <bmcmullan@channell.com>:
>> >how do i execute a .pl program from within a .pl program.
>> 
>> *thwack*  FAQ.
>
>where do i find the faq with this information

If you have Perl 5.004:   perldoc perlfaq
Otherwise:  browse around www.perl.com
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
        "Nice shooting, Zanthar!"  "Thanks, Denise."  // MST3K
           ->  Ask me about Perl training and consulting  <-
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

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

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