[8080] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1699 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 22 00:08:17 1998

Date: Wed, 21 Jan 98 21:00:25 -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, 21 Jan 1998     Volume: 8 Number: 1699

Today's topics:
    Re: Calling C from Perl (Martien Verbruggen)
    Re: CGI.pm question (Kelly Hirano)
    Re: crypt() vs. htpasswd - what's the diff? <scottj@mthcsc.wfu.edu>
    Re: crypt() vs. htpasswd - what's the diff? (brian d foy)
        Cwd pragma/realpath conflict? <csheldon@cruzio.com>
    Re: FAQ too big (Was: Re: PERL forking) <rjk@coos.dartmouth.edu>
    Re: Freidl's book mystery (Vladimir Sovetov)
    Re: Freidl's book mystery (Vladimir Sovetov)
    Re: Freidl's book mystery <joseph@5sigma.com>
    Re: Getting the first two chars of a string - URGENT! (Michael Budash)
    Re: Getting the first two chars of a string - URGENT! (brian d foy)
    Re: grabbing email adresses from webpages (Hasan Diwan)
        How to load local vars from Configfile ? <u01808@unix.dlh.de>
    Re: How to load local vars from Configfile ? (brian d foy)
    Re: How to load local vars from Configfile ? (Martien Verbruggen)
    Re: living and free software (was: Re: source into bina <rjk@coos.dartmouth.edu>
        Multi. Data Base Entries Simotaniously <gnew@southernvirginia.edu>
    Re: Multi. Data Base Entries Simotaniously (brian d foy)
    Re: Multi. Data Base Entries Simotaniously <gnew@southernvirginia.edu>
    Re: Multi. Data Base Entries Simotaniously (brian d foy)
    Re: Outlook 97 and perl scripts <jay_harlow@email.msn.com>
    Re: PERL+ODBC vs Delphi for webwork (Netizen)
        Please help me!! (SHAILKUMAR)
        Problem installing perl on AIX 4.2 nickl@telebusiness.co.nz
    Re: Reg Expression, can it be improved? <*@qz.to>
    Re: Reg Expression, can it be improved? (brian d foy)
    Re: source into binary code <chris@geospiza.com>
    Re: source into binary code (Martien Verbruggen)
    Re: sysread vs <> (Hasan Diwan)
    Re: Trouble with a regex (brian d foy)
    Re: Trouble with a regex <joegottman@nospam.worldnet.att.net>
    Re: Trouble with a regex (brian d foy)
    Re: Why warn? (WAS: Re: Critique My Code! (Please)) (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 22 Jan 1998 04:00:49 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
To: tack@ican.net
Subject: Re: Calling C from Perl
Message-Id: <6a6g9h$6pi$2@comdyn.comdyn.com.au>

[Posted and Mailed]

In article <34C69C16.E0D501D7@ican.net>,
	Tack <tack@ican.net> writes:

> I have (or will have, rather) a perl interpreter in my C program.

[snip]

> Can anyone point me in the right direction and give me a few tips?
> I am very new to perl.  Please forward all replies to tack@ican.net

perldoc perlembed

Read the section with the title: 'Adding a Perl interpreter to your C 
program'. It has explanations, examples and everything.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd.       | again. Then quit; there's no use being
NSW, Australia                      | a damn fool about it.


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

Date: 21 Jan 1998 17:38:03 -0800
From: hirano@Xenon.Stanford.EDU (Kelly Hirano)
Subject: Re: CGI.pm question
Message-Id: <6a67tr$cmv@Xenon.Stanford.EDU>

In article <34C676B2.BA354741@virgin.net>,
Andrew Spiers  <andrew.spiers@virgin.net> wrote:
>I am trying to do a script that displays radio_group and then when the
>user presses the submit button it will display a results page. I cannot
>get this to happen - what happens is that it displays the results page
>below the radio_group. Can someone give me an idea on the way to achieve
>this - just a pointer.

you essentially need to have two parts to your cgi -- one for printing the
form to be filled out, and one for the results. the way you are doing it now,
the form is printed out on the top, and if there are results, they are
appended to the bottom. do something like:

if (param())
{
	### print results here
}

else ### just print the form
{
	### print radio group
}

hope that helps!

kelly

-- 
Kelly William Hirano	                    Stanford Athletics:
hirano@cs.stanford.edu	                 http://www.gostanford.com/
hirano@alumni.stanford.org      (WE) BEAT CAL (AGAIN)! 100th BIG GAME: 21-20
-- 
Kelly William Hirano	                    Stanford Athletics:
hirano@cs.stanford.edu	                 http://www.gostanford.com/
hirano@alumni.stanford.org      (WE) BEAT CAL (AGAIN)! 100th BIG GAME: 21-20


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

Date: Wed, 21 Jan 1998 21:21:35 -0500
From: Kevin Scott <scottj@mthcsc.wfu.edu>
Subject: Re: crypt() vs. htpasswd - what's the diff?
Message-Id: <34C6AD2F.B3CD476E@mthcsc.wfu.edu>

The little program below does approximately the same thing that htpasswd
does.  It seems to work fine for me.  Good luck.

******  Kevin Scott
********  Department of Mathematics & Computer Science
********  Wake Forest University
*******  scottj@mthcsc.wfu.edu

-Cut--------------------------------------------------------------
#!/usr/bin/perl

# Quick knock off of Apache htpasswd.
# 
# Usage: ptpasswd [-c] pwdfile username
#
# Kevin Scott, January, 1998

# Array for mapping a number from 0-63 to a base64 encoded digit.
@ito64 = ( 'A','B','C','D','E','F','G','H',
           'I','J','K','L','M','N','O','P',
	   'Q','R','S','T','U','V','W','X',
	   'Y','Z','a','b','c','d','e','f',
	   'g','h','i','j','k','l','m','n',
	   'o','p','q','r','s','t','u','v',
	   'w','x','y','z','0','1','2','3',
	   '4','5','6','7','8','9','+','/' 
);

if ($ARGV[0] eq "-c") {
	$filename = $ARGV[1] || die "You must specify a filename.\n";
	open(OUT,">$filename");
	$username = $ARGV[2] || die "You must specify a username.\n";
} else {
	$filename = $ARGV[0] || die "You must specify a filename.\n";
	open(OUT,">>$filename");
	$username = $ARGV[1] || die "You must specify a username.\n";
}

# This doesn't hide the password as it is typed!!
print "Enter a password: ";
chop($password = <STDIN>); 

# Generate random two digit salt over the base64 alphabet.
srand(time|$$);
$salt = $ito64[rand(63)] . $ito64[rand(63)];

# Call crypt to generate the password.
$encpwd = crypt($password,$salt);

# Write it to the file.
print OUT "$username:$encpwd\n";

-Cut--------------------------------------------------------------


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

Date: Wed, 21 Jan 1998 22:59:40 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: crypt() vs. htpasswd - what's the diff?
Message-Id: <comdog-ya02408000R2101982259400001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34C6AD2F.B3CD476E@mthcsc.wfu.edu>, scottj@mthcsc.wfu.edu posted:

>The little program below does approximately the same thing that htpasswd
>does.  It seems to work fine for me.  Good luck.

one of the got-cha's is having duplicate usernames in your user
database.  i'm not sure how different servers handle this, but it
you prefer not to get your hands dirty with that work (some of us
like dirty hands though :), one might look into HTTPD::UserAdmin
which is quite versatile.

also, since the htpasswd source comes with Apache like servers,
one could do a straight port.  it's quite simple actually, and the
code isn't that long.  however, i find it's easier to just compile
htpasswd.c and use that rather than reinvent the mistakes of its
author [ugh - been there done that] :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

Date: Wed, 21 Jan 1998 19:59:45 -0800
From: Chuck Sheldon <csheldon@cruzio.com>
Subject: Cwd pragma/realpath conflict?
Message-Id: <34C6C429.5616@cruzio.com>

Hi,
  Have you seen the symptoms generated by the following script?
  If so, please clue me in to what causes it.
  I have only run the script under Solaris on a Sun system.
Thanks!
Chuck Sheldon

#!/usr/local/bin/perl -w
# cwd_bug? - Demonstrate bug when CWD pragma & realpath are both used.
# IMPORTANCE:  Trouble use readlink status ($!) if Cwd pragma is used.
# REQUIREMENT: Create link named "templink" before running this script.
# TO DEMO IT:  Run with and without the line "use Cwd;" commented out.
# RESULT: Readlink status ($!) is 0 withOUT "use Cwd", nonzero with it.
#-----------------------------------------------------------------------
# WITH    Cwd, withOUT link
# readlink status:  'No such file or dir' -templink: no such link found.
# 
# WITH    Cwd, WITH    link
# readlink status:  'No such file or dir' -templink -> 'junk'  *BAD*!
# 
# withOUT Cwd, withOUT link
# readlink status:  'No such file or dir' -templink: no such link found.
# 
# withOUT Cwd, WITH    link
# readlink status:  '                   ' -templink -> 'junk'  *GOOD*!
########################################################################
use Cwd;            ##### Comment out this line to eliminate the "bug".
$linkvalue = readlink "templink";
print "readlink status:  '$!' - ";
if ($linkvalue)
    {print "templink -> '$linkvalue'\n";}
else
    {print "templink: no such link found.\n";}
########################################################################


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

Date: Wed, 21 Jan 1998 23:33:49 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: FAQ too big (Was: Re: PERL forking)
Message-Id: <34C6CC2D.766E4291@coos.dartmouth.edu>

Bart Lateur wrote:
> 
> Hmmm... What I think is lacking, is an overview of everything that is
> covered in the FAQ. A TOC, a list with ALL the questions and where the
> answers can be found.
> 
> Not everybody uses Unix, where you can use grep to look it up for you...
> On a PC, you have to (manually) open and search through 9 documents.

Unless, of course, you have some kind of language that does practical
extraction and reporting.

Say, a Practical Extraction and Report Language.

perl -ne 'print if /topic/'

Chipmunk


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

Date: 22 Jan 1998 03:08:22 GMT
From: sova@kpbank.ru (Vladimir Sovetov)
Subject: Re: Freidl's book mystery
Message-Id: <6a6d76$60a$1@home.kpbank.ru>

Gabor (gabor@vinyl.quickweb.com) wrote:
: In comp.lang.perl.misc, Vladimir Sovetov <sova@kpbank.ru> wrote :
: #   Please, is anyone here kind enough to explain to me what Mr. Friedl is
: #  trying to make me understand when he spend thousands of words
: #  on C /* ... */ comments problem (pp. 168-173)?  
: #    Why all the fuss? It seems that regex as obvious as m{/\*(.*?)\*/}
: #  could make the trick. What the sense in lenghty discussion and
: #  the monster like this  m{/\*([^*]|\*+[^/*])*\*+/} as a result.
: #    After all my -Dr check 

: Try

: main()
: {
:     /*
:     printf("DEBUG Level */ %d\n",debug);
:     */
    Well, nice example, but Friedl's m{/\*([^*]|\*+[^/*])*\*+/} is
   of no help too in this case.
    So you just want to be naughty:-))) I suppose.

: }
--
Vladimir Sovetov 


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

Date: 22 Jan 1998 03:40:54 GMT
From: sova@kpbank.ru (Vladimir Sovetov)
Subject: Re: Freidl's book mystery
Message-Id: <6a6f46$60a$2@home.kpbank.ru>

Eli the Bearded (*@qz.to) wrote:

: > %cat test.pl
: > !/usr/local/bin/perl -w -Dr
: > 
: >    $it = '/***** This *is* / */ hhhh() /* my comment /**/';
: > 
: >   print "$it\n";
: >         print "()=:$1:\n" if $it =~ m{/\*(.*?)\*/};
: >         print "()=:$1:\n" if $it =~ m{/\*(([^*]|\*+[^/*])*)\*/};

: That is a different regular expression. You left off the final "+".
    Well, I did it intentionaly, but in fact I must admit that was wrong
  with my efficency test anyway. I erroneously believed that pure volume of
  debugging output is directly connected to speed of RE. I was wrong
  while you prove to be right. 
    The time utility is on Mr.Friedl side.
      0.0u 0.2s 0:01.25 20.8% 0+0k 66+1io 0pf+0w
	   ^^^
	    that's for my regex

      0.0u 0.0s 0:00.47 27.6% 0+0k 0+0io 0pf+0w
	   ^^^
	    and that's for Friedl's

    Now I see that the only cure for me is a re-reading of chapter 5. 
  Thank you for making it obvious.
--
Vladimir Sovetov 


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

Date: Wed, 21 Jan 1998 20:56:19 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
To: Vladimir Sovetov <sova@kpbank.ru>
Subject: Re: Freidl's book mystery
Message-Id: <34C6C2AB.13D4E6ED@5sigma.com>

m{/\*(.*?)\*/} is correct.  However, it wasn't that simple before
the advent of *?.  There are a couple of points being made.  (1)
it is very difficult to express certain "non-greedy" constructs
with greedy regular expressions, and (2) which one is more efficient
is not necessarily obvious.

	-joseph

Vladimir Sovetov wrote:
> 
>   Please, is anyone here kind enough to explain to me what Mr. Friedl is
>  trying to make me understand when he spend thousands of words
>  on C /* ... */ comments problem (pp. 168-173)?
>    Why all the fuss? It seems that regex as obvious as m{/\*(.*?)\*/}
>  could make the trick. What the sense in lenghty discussion and
>  the monster like this  m{/\*([^*]|\*+[^/*])*\*+/} as a result.


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

Date: Wed, 21 Jan 1998 19:28:29 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Getting the first two chars of a string - URGENT!
Message-Id: <mbudash-2101981928290001@d126.pm3.sonic.net>

In article <34BF285E.7E7E@nortel.ca>, Ben Holness <bholness@nortel.ca> wrote:

>> Hi all,
>> 
>> If anyone knows how to return the first two chars of a string, please
>> could you let me know as soon as possible.
>> 
>> The situation is as follows:
>> 
>> I have a variable ($temp) which holds a string similar to "4R65" or
>> "Q6E2" etc.
>> 
>> I would like to be able to get just the first two chars of the string,
>> ie "4R" or "Q6" (as in the examples above).
>> 
>> Does anyone know how to do this?
>> 

one way:

$out = substr($in, 0, ($no_of_chars_to_leave - length($in)));

hth

-- 
Michael Budash, Owner * Michael Budash Consulting
mbudash@sonic.net * http://www.sonic.net/~mbudash
707-255-5371 * 707-258-7800 x7736


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

Date: Wed, 21 Jan 1998 23:34:38 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Getting the first two chars of a string - URGENT!
Message-Id: <comdog-ya02408000R2101982334380001@news.panix.com>
Keywords: from just another new york perl hacker

In article <mbudash-2101981928290001@d126.pm3.sonic.net>, mbudash@sonic.net (Michael Budash) posted:

>In article <34BF285E.7E7E@nortel.ca>, Ben Holness <bholness@nortel.ca> wrote:
>

>>> I would like to be able to get just the first two chars of the string,
>>> ie "4R" or "Q6" (as in the examples above).

>$out = substr($in, 0, ($no_of_chars_to_leave - length($in)));

i'm not sure about the rational for the expression in the 
LENGTH part above, but if you want just the first two characters
one needn't do so much work:

   print 'just another ' . substr('NY.pm', 0, 2) . ' perl hacker';

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

Date: 21 Jan 1998 21:05:12 -0500
From: hdiwan@shell.clark.net (Hasan Diwan)
Subject: Re: grabbing email adresses from webpages
Message-Id: <6a69go$3v1@shell.clark.net>

Load the pages, search them for the @ and the TLD or something. Refer to
'man perlre' for exact syntax, and have the results output to a file or
whatever.

Pascal Hos <paashaas@rice.edu> writes:

>I'm not familiar at all with perl, so I would like to know if it is
>possible to collect the email addresses of webpages. Say one uses a
>spider search and a webpage containing url's is displayed. How could one
>obtain all the email addresses without actually opening the url's
>themselves

>Pascal
>-- 
>-----------------------------------------------------------
>Pascal Hos                    |        paashaas@rice.edu
>1746 Banks                    |        office:
>Houston, TX 77098             |        Cox 207
>(713) 523-2318                |        (713) 527-8750 x3626
>-----------------------------------------------------------
-- 
Hasan Diwan
University of California at Berkeley
Department of Electrical Engineering/Computer Science
hasandiwan@writeme.com


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

Date: Wed, 21 Jan 1998 18:40:39 +0100
From: Bernd Zeissler <u01808@unix.dlh.de>
Subject: How to load local vars from Configfile ?
Message-Id: <34C63317.4976@unix.dlh.de>

Hi 

I want to split a bigger program into the program itself and and large
configuration file. But I don't like to have all the variables in the
configfile global.
Is there any way to get "my" variables out of a configfile?

Now it looks like this but it don't works.
-------------------------------------------
File: Configfile
my $pathtoreader = "/home/reader";
-------------------------------------------

File: Program
do 'Configfile';
-------------------------------------------

Thanks in advance for any suggestion

B.Zeissler


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

Date: Wed, 21 Jan 1998 23:24:08 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: How to load local vars from Configfile ?
Message-Id: <comdog-ya02408000R2101982324080001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34C63317.4976@unix.dlh.de>, Bernd Zeissler <u01808@unix.dlh.de> posted:

>I want to split a bigger program into the program itself and and large
>configuration file. But I don't like to have all the variables in the
>configfile global.
>Is there any way to get "my" variables out of a configfile?
>
>Now it looks like this but it don't works.
>-------------------------------------------
>File: Configfile
>my $pathtoreader = "/home/reader";
>-------------------------------------------
>
>File: Program
>do 'Configfile';


rather than have perl code in a config file, i use a set-up
similar to the conf files found with the NCSA like server:

   #Directive is some thingy set to Value
   Directive Value

providing an abstract interface to that file so that one can 
create a configuration object that holds the directives and their
values.

   my $config = new MyConfig $filename;

then access the values through the interface

   my $thingy = $config->directive_name

or simply use the $config instance directly

   some_function($config->directive_name);


[in anticipation of Tom P.'s response...]
i've been thinking about whether i should ask the Suits to let
me release this, but i don't know how it fits into the Config
set-up that i've seen on CPAN.  if anyone is interested i'll
post more stuff about it :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

Date: 22 Jan 1998 04:04:32 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How to load local vars from Configfile ?
Message-Id: <6a6ggg$6pi$3@comdyn.comdyn.com.au>

In article <34C63317.4976@unix.dlh.de>,
	Bernd Zeissler <u01808@unix.dlh.de> writes:
> Hi 
> 
> I want to split a bigger program into the program itself and and large
> configuration file. But I don't like to have all the variables in the
> configfile global.
> Is there any way to get "my" variables out of a configfile?
> 
> Now it looks like this but it don't works.
> -------------------------------------------
> File: Configfile
> my $pathtoreader = "/home/reader";
> -------------------------------------------
> 
> File: Program
> do 'Configfile';

You don't really want to process config files this way. Write a
routine that can read a config file, and sets variables appropriately,
or use one of the modules from CPAN that were written especially for
this:

http://www.perl.com/CPAN/modules/00modlist.long.html

see section 12: 

12) Option, Argument, Parameter and Configuration File Processing

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd.       | inexactitude.
NSW, Australia                      | 


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

Date: Wed, 21 Jan 1998 21:56:28 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: living and free software (was: Re: source into binary code)
Message-Id: <34C6B55D.6C516DFE@coos.dartmouth.edu>

John Stanley wrote:
> 
> In article <54soqhhhde.fsf@gunnar.aladdin.net>,
> Piers Cawley  <pdcawley@bofh.org.uk> wrote:
> >> >It is natural and normal to harbor contempt for those who cause
> >> >trouble and are generally harmful to society.
> >>
> >> Please support that statement with proof or retract it. It is a long
> >> way from "I won't give you my code for free" to causing trouble for
> >> society.
> >
> >Hmm... 'It is natural to harbour contempt for those who cause trouble
> >and are generally harmful to society'.
> 
> Repeating the statement is not providing support.

Duh.

This is one of the best examples you've provided so far of just how
poorly developed are your skills of debate.

It is completely obvious that Piers was not repeating the statement in
order to support it.  The fact that you made this remark seems to
indicate that you purposely misinterpret people's comments simply so you
can refute them easily.  In fact, he wasn't even repeating the statement;
he wa quoting it.  A very important difference.

How do I know Piers was not trying to support the statement by repeating
it?  Because the very next sentence is:

> >Yeah, I can go with that.

In other words, he was repeating the statement in order to emphasize it,
and as an introduction to the rest of the paragraph.

Chipmunk


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

Date: Wed, 21 Jan 1998 22:02:12 -0500
From: "Gary C. New" <gnew@southernvirginia.edu>
Subject: Multi. Data Base Entries Simotaniously
Message-Id: <34C6B6B4.2243@southernvirginia.edu>

When multipule users try adding info. to a data base via a perl script
simotaniously, will the perl script be able to handle it?

Email me...


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

Date: Wed, 21 Jan 1998 23:04:05 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Multi. Data Base Entries Simotaniously
Message-Id: <comdog-ya02408000R2101982304050001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34C6B6B4.2243@southernvirginia.edu>, gnew@southernvirginia.edu posted:

>When multipule users try adding info. to a data base via a perl script
>simotaniously, will the perl script be able to handle it?

some databases can handle this intrinisically, others do not.  know
your database product and code accordingly.  see the FAQs on file
locking and simultaneous access.  if there is a problem, it
won't be due to Perl, but rather what you told perl to do :)

it's not a perl issue - it's a general programming issue.  for issues
with your database product see its documentation.

good luck :)

>Email me...

private consultations aren't free...

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

Date: Wed, 21 Jan 1998 23:35:18 -0500
From: "Gary C. New" <gnew@southernvirginia.edu>
To: brian d foy <comdog@computerdog.com>
Subject: Re: Multi. Data Base Entries Simotaniously
Message-Id: <34C6CC86.1730@southernvirginia.edu>

brian d foy wrote:
> 
> In article <34C6B6B4.2243@southernvirginia.edu>, gnew@southernvirginia.edu posted:
> 
> >When multipule users try adding info. to a data base via a perl script
> >simotaniously, will the perl script be able to handle it?
> 
> some databases can handle this intrinisically, others do not.  know
> your database product and code accordingly.  see the FAQs on file
> locking and simultaneous access.  if there is a problem, it
> won't be due to Perl, but rather what you told perl to do :)
> 
> it's not a perl issue - it's a general programming issue.  for issues
> with your database product see its documentation.
> 
> good luck :)
> 
> >Email me...
> 
> private consultations aren't free...
> 
> --
> brian d foy                                  <comdog@computerdog.com>
> CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
> Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>

What if I were to use just a text file type data base?


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

Date: Thu, 22 Jan 1998 00:00:20 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Multi. Data Base Entries Simotaniously
Message-Id: <comdog-ya02408000R2201980000200001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34C6CC86.1730@southernvirginia.edu>, gnew@southernvirginia.edu posted:

>brian d foy wrote:

 
>> some databases can handle this intrinisically, others do not.  know
>> your database product and code accordingly.  see the FAQs on file
>> locking and simultaneous access. 
>
>What if I were to use just a text file type data base?

see the FAQs on file locking and simultaneous access.

you might also pay attention to previous posts about this topic.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

Date: Wed, 21 Jan 1998 20:28:18 -0600
From: "Jay B. Harlow [MVP - Outlook]" <jay_harlow@email.msn.com>
Subject: Re: Outlook 97 and perl scripts
Message-Id: <eDkvD4tJ9GA.302@uppssnewspub04.moswest.msn.net>

Tony,
  See Scott's comments, plus add the following:

The MAPI.Session object is part of CDO (formally Active Messaging). You can
download Active Messaging 1.1 with a help file of documentation & samples
from
<http://www.microsoft.com/syspro/technet/boes/bo/mailexch/exch/tools/appfarm
/default.htm>.

Outlook has its own object model that is documented in the VBAOUTL.HLP file
found on your Office/Outlook 97 CD-ROM under \ValuPack\MoreHelp. The Outlook
Object model is very intrinsic of Outlook, it has objects with methods &
properties that correspond directly to the various Items in Outlook
(Contacts, Tasks, Appointments... The Outlook Object Model is out of process
& Outlook itself is built upon what MAPI can do for you.

Both of these help files contain VBA samples...

I would recommend use CDO (Active Messaging) if you simple want to
manipulate folders, mail & post items.

I would recommend using Outlook object model if you want to manipulate
Contacts, Appointments, Tasks & other Outlook specific items...

Hope this helps
Jay

Tony Arnold wrote in message <34C5CB50.B0BE5D5F@mcc.ac.uk>...
>I believe it ought to be possible to process mail folders etc., in
>Outlook 97 from a perl script. Has anyone done this? If so, I would
>appreciate seeing an example of the techinique.
>
>Tony Arnold, University of Manchester, UK.
>




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

Date: Thu, 22 Jan 1998 04:02:12 GMT
From: spamless@spamfree.org (Netizen)
Subject: Re: PERL+ODBC vs Delphi for webwork
Message-Id: <34c6bfa2.4107412@news.netutah.com>

scott@softbase.com wrote:
[big snip]
>3. Paradox is the worst database ever written, I'm convinced. 
[end big snip]
I have a Paradox data entry application that has been used for over
seven years without losing a single byte of data in an office with a
dozen concurrent users working six days a week. With lookup tables
over a million records and tables over 400 megabytes this is not how
"the worst database ever written" would work. This is just one of many
applications I've written with Paradox since 1987 for customers with
equal satisfaction, but this one handles the largest files.  These
applications vary considerably in function (from inventory control to
Cardiology reports) and the three product bugs I've found in that time
frame were quickly solved by Borland. 
I've worked with may different developement products on varying
platforms over the years and wish they all worked as good as Paradox
has.
Opinions are just that, and your's is obviously painted by a bad
experience with a product that has worked well for many other people.

***(aldo)*|@|*(mclv)*|dot|*(net)***


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

Date: 22 Jan 1998 04:36:28 GMT
From: shailkumar@aol.com (SHAILKUMAR)
Subject: Please help me!!
Message-Id: <19980122043601.XAA01698@ladder01.news.aol.com>

Hi,

I'm a novice in perl. I wrote a script which takes in student info like email,
phone
and name and the info is stored in a text file. The various fields are stored
in one
line seperated by | 

Now, what if I have to store large informations like a resume, paragraph etc.
How should I do that and then the way to extract it?

Thank you, for your attention.

- Shail Kumar


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

Date: Wed, 21 Jan 1998 22:35:45 -0600
From: nickl@telebusiness.co.nz
Subject: Problem installing perl on AIX 4.2
Message-Id: <885442901.1428946948@dejanews.com>

Hi,

I have been usinf perl 5.003.001 under AIX 4.1.3 for over 1 year now. We
have just upgraded one of our machines to AIX 4.2 and I can not build
perl.

I seem to be having an error in the toke.c file with the parameter
passing options. I have tried setting thr compilier to use the classic
and K&R options to allow old style function prototypes. This did not
help.

The error is :-  `sh  cflags libperl.a toke.o`	toke.c	CCCMD =  cc -c
-qmaxmem=8192 -qlanglvl=classic -qgenproto -D_ALL_SOURCE -w -O
"/usr/include/unistd.h", line 165.12: 1506-046 (S) Syntax error. int
sleep(void); "toke.c", line 129.13: 1506-045 (S) Undeclared identifier
toketype.

I have tried many combinitions of compilier options with no success. HELP.

Thanks in advance

Nick Langstone
Nickl@telebusiness.co.nz


-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 22 Jan 1998 04:02:35 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: Reg Expression, can it be improved?
Message-Id: <qz$9801212233@qz.little-neck.ny.us>

<rlee@spcbrass.com> wrote:
> The routine below will change all lines to lowercase EXCEPT words
> enclosed in double quotes.
> 
> #!/usr/bin/perl -wT

Why -T?

> my $rec = "";
> my $a;
> 
> $_ = "This is  a TEST  \"Sammy 1st Birthday\" and \"SUZZY\"  ABCdef019Ab";

$_ = 'This is  a TEST  "Sammy 1st Birthday" and "SUZZY"  ABCdef019Ab';

Single quotes are good.

> while (/(\"(.*?)\")/) {  $a = $_ = $';	# change the string to the
> remainder of the string  $rec .= lc $`; # append the lowercase before
> match to the new string  $rec .= $1;  # append the matched string
> unchanged. }

Ugh. What happened? Rewritten:

| while (/(\"(.*?)\")/) {
|  $a = $_ = $';	# change the string to the remainder of the string
|  $rec .= lc $`; # append the lowercase before match to the new string
|  $rec .= $1;  # append the matched string unchanged.
| }

Using $` and $' is not recommended. For small, quick scripts it is okay,
but they slow down all RE processing.

Better would be:

#!/usr/bin/perl -w

$_ = '"From" Just Another "New York" Perl Hacker ("N""Y.P""M" -- jaNYph)';

@a = split /"/;

for ($b=0 ; $b <= $#a; $b+=2) {
  $a[$b] = lc $a[$b];
}

$_ = join '"', @a;
print;

__END__

:r! perl -x %
"From" just another "New York" perl hacker ("N""Y.P""M" -- janyph)

Dealing with backslash escaped quotes is more complicated. Doing it all
in a s///e is possible but complicated. (Think \G and some zero length
captures.)

Elijah
------
there is probably a better way to loop for this


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

Date: Wed, 21 Jan 1998 23:30:25 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Reg Expression, can it be improved?
Message-Id: <comdog-ya02408000R2101982330250001@news.panix.com>
Keywords: from just another new york perl hacker

In article <qz$9801212233@qz.little-neck.ny.us>, Eli the Bearded <*@qz.to> posted:

><rlee@spcbrass.com> wrote:
>> The routine below will change all lines to lowercase EXCEPT words
>> enclosed in double quotes.
>> 
>> #!/usr/bin/perl -wT
>
>Why -T?

some of us can't help but type that.  it's a habit :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

Date: Wed, 21 Jan 1998 18:07:14 -0800
From: Chris Abajian <chris@geospiza.com>
Subject: Re: source into binary code
Message-Id: <34C6A9D2.946710BA@geospiza.com>

isn't anybody going to answer the original question?

--
+--------------------------------------+-------------------------------+
|                                      | Geospiza, L.L.C.              |
| Chris Abajian                        | 2442 NW Market St. Suite 344  |
| mailto:chris@geospiza.com            | Seattle WA, 98107             |
| http://www.geospiza.com/people/chris | (206) 283-9338                |
|                                      | http://www.geospiza.com       |
+--------------------------------------+-------------------------------+


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

Date: 22 Jan 1998 03:54:47 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: source into binary code
Message-Id: <6a6fu7$6pi$1@comdyn.comdyn.com.au>

In article <34C6A9D2.946710BA@geospiza.com>,
	Chris Abajian <chris@geospiza.com> writes:
> isn't anybody going to answer the original question?

You mean how to compile perl code into binary?

The answer's in perlfaq3

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Little girls, like butterflies, need no
Commercial Dynamics Pty. Ltd.       | excuse - Lazarus Long
NSW, Australia                      | 


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

Date: 21 Jan 1998 21:10:28 -0500
From: hdiwan@shell.clark.net (Hasan Diwan)
Subject: Re: sysread vs <>
Message-Id: <6a69qk$664@shell.clark.net>

ml@gondwanaland.com (Mike Linksvayer) writes:

>In my tests

>   my $buf;
>   open(F,"foo") || die $!;
>   my @stat = stat F;
>   sysread(F,$buf,$stat[7],length($buf));
>   close(F);

>is over ten times as fast as

>   my $buf;
>   open(F,"foo") || die $!;
>   while (<F>) { $buf .= $_; }
>   close(F);

>Is there any reason I should not use sysread to slurp up files in
>a production environment?

>--
>Mike Linksvayer   http://gondwanaland.com/ml/

I think sysread is a system call, so if you change vendors, your script
may not work as well...
-- 
Hsiang Huang
University of California at Berkeley
Department of Electrical Engineering/Computer Science
hasandiwan@writeme.com


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

Date: Wed, 21 Jan 1998 22:27:16 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Trouble with a regex
Message-Id: <comdog-ya02408000R2101982227160001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6a5h0h$t6k@newsops.execpc.com>, Mike Hammernik <mhammer@execpc.com> posted:

>I would like to obtain only the group of ip address that in the last
>field contain numbers from 01 to 30. expressions thatare like
>192\.168\.*\.[01-39] of course match 139 as well as 39. In going through
>Mastering regex book and my perl books I have been unable to find a way
>to do this. 

think about the pattern that you want to match:

   * assume the last part can have 1 to 3 digits
      a) if it has three digits, the first one is 0 
         (to fit your range)
      b) if it has two digits, the first one can be 0-3
      and the next digit can be 0-9
      c) if it has one digit, it can be 0-9

let's build up a regex that meets those requirements. 
work backwards we get:

   c)  if it has one digit, it can be 0-9, so

         [0-9]

   b) if it's two digits, it can be 0-3, so we prepend
   an optional second digit

         [0-3]?[0-9]

   a) if it has three digits, the leading one must
   be a zero to fit your range, so we prepend an
   optional leading 0

         0?[0-3]?[0-9]


putting that into a full pattern match using the nifty
eXtended feature we have


   m/
   ^                #anchor at start of string
              #escape meta-characters between \Q and \E
   \Q192.168.\E     #the first part of the IP number
   
   \d{1,3}          #one to three digits
   \.               #a literal .

   0?[0-3]?[0-9]    #001 to 039, leading zeroes optional

   $                #anchor at end of string
   /x;              #eXtended
   

or you can get fancy with the class C part following that same
logic as above (left as an exercise to the reader), since you
never know what data the l^Husers have added to your files:

   (?:                   #non-capturing parenthesis
      [0-1]?[0-9]?[0-9]
         |
      2[0-4][0-9]
         |
      25[0-5]
   )

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

Date: Wed, 21 Jan 1998 23:15:48 -0500
From: Joe Gottman <joegottman@nospam.worldnet.att.net>
Subject: Re: Trouble with a regex
Message-Id: <6a6hf4$6k8@mtinsc03.worldnet.att.net>

Mike Hammernik wrote:
> 
> I have a list of ip addresses that I'm trying to pull out the ones that
> contain a particular range in the last digits.  A list of
> 192.168.120.101
> 192.168.116.94
> 192.168.133.10
> 192.168.121.30
> etc
> 
> I would like to obtain only the group of ip address that in the last
> field contain numbers from 01 to 30. expressions thatare like
> 192\.168\.*\.[01-39] of course match 139 as well as 39. In going through
> Mastering regex book and my perl books I have been unable to find a way
> to do this. I've even gone through all my copies of postings in the hope
> I would find one that asked this question before,
> Your time and help is greatly appreciated
>

   This is a difficult regex problem, but it actually is easy if you
don't confine
yourself to regular expressions.  Try 
   if ( ($ip =~ /(\d\d$)/) and ($1 >= 1) and ($1 <= 30) )

The regular expression pulls the last 2 digits out of the ip address and
stores
them in $1. Then the two comparisons check whether the digits are
between 1 and 
thirty.

Joe Gottman
joegottman@nospam.worldnet.att.net

[Remove nospam to reply]


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

Date: Wed, 21 Jan 1998 23:57:12 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Trouble with a regex
Message-Id: <comdog-ya02408000R2101982357120001@news.panix.com>
Keywords: from just another new york perl hacker

In article <comdog-ya02408000R2101982227160001@news.panix.com>, comdog@computerdog.com (brian d foy) posted:

>In article <6a5h0h$t6k@newsops.execpc.com>, Mike Hammernik <mhammer@execpc.com> posted:
>
>>I would like to obtain only the group of ip address that in the last
>>field contain numbers from 01 to 30. expressions thatare like
>>192\.168\.*\.[01-39] of course match 139 as well as 39. In going through
>>Mastering regex book and my perl books I have been unable to find a way
>>to do this. 

[snip discussion.  see previous article]

the following regex mistakenly allows 0 to match the class D portion
of the IP #, whereas the poster wanted it between 1 and 39.

>   m/
>   ^                #anchor at start of string
>              #escape meta-characters between \Q and \E
>   \Q192.168.\E     #the first part of the IP number
>   
>   \d{1,3}          #one to three digits
>   \.               #a literal .
>
>   0?[0-3]?[0-9]    #001 to 039, leading zeroes optional
>
>   $                #anchor at end of string
>   /x;              #eXtended

the fix is not all that bad though, and is very similar to the
part in which i posted a teaser for the class C portion.  including
the possibility of leading zeroes, change 0?[0-3]?[0-9] to

   (?:              #non-capturing parenthesis
      0?[1-3][0-9]  #two digits, covering 10-39
         |             #or
      0?0?[1-9]     #one digit, covering 1-9
   )

let's see how ugly Elijah can make it with look-aheads :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

Date: Wed, 21 Jan 98 22:18:19 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Why warn? (WAS: Re: Critique My Code! (Please))
Message-Id: <34c6bc38$2$ofn$mr2ice@speaker>

In <fl_aggie-2001981736380001@aggie.coaps.fsu.edu>, on 01/20/98 at 05:36 PM,
   fl_aggie@thepentagon.com (I R A Aggie) said:
+-----
| + From where I sit,
| + "warn "foo\n";
| + is functionally equivelent to:
| + "print STDERR "foo\n";
| + So why use the former over the latter?
|
| Because it is more intuitively obvious what's going on? because it involves
| less typing? because There Is More Than One Way To Do Things?
+--->8

Because it's not functionally equivalent?  See $SIG{__WARN__} for details.

-- 
use 5.004;sub AUTOLOAD{print$_{$_.++$x{$_}}}sub new{my%x;%_=map{++$a%2?$_.++$x{
$_}:$_}split(//,pack('N*',unpack('w*',unpack('u*','M@H*HP\'2"@\C`88+SE/!EA(F!'.
"A'6\$LZV0+(3;C9QRA9NAPG2&D\\G(88:KL=A0\n4AN.5W\"\"&\\[W>;H>3S>0\@A\\N\@PB\$`")
)));bless{}}$b=(new main);map{$b->_}split(//,' Brandon S. Allbery KF8NH') # :-)



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

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

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