[10835] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4436 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 16 07:07:16 1998

Date: Wed, 16 Dec 98 04:00:22 -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, 16 Dec 1998     Volume: 8 Number: 4436

Today's topics:
    Re: 'pipe' an 8-bit file (Bart Lateur)
    Re: C structure to perl birgitt@hamburg.citde.net
    Re: Complicated sorting problem (Bart Lateur)
        How do I change current working directory ? <KONPEF@statoil.com>
    Re: How to extract emails from HTML page <ebohlman@netcom.com>
        Inconsistent behavior s/// ? <Paul.Matthijsse@wanadoo.fr>
    Re: Inconsistent behavior s/// ? <ebohlman@netcom.com>
    Re: Need some speed tips on this script.. (Bart Lateur)
    Re: Newbie help plz <ebohlman@netcom.com>
        newbie on DBM <kamran@norsar.no>
    Re: newbie on DBM <ebohlman@netcom.com>
    Re: newbie on DBM <kamran@norsar.no>
    Re: Perl & Microsoft IIS Server <gmj@netaxis.com>
    Re: PERL date/time expiration question (Bob Dubery)
    Re: Personal Web Server, Windows 95-98, Perl. <adam@simpledia.com>
    Re: previous page, perl vs asp <matt@teamamiga.org_NOSPAM>
    Re: previous page, perl vs asp <ebohlman@netcom.com>
        STDIN works too well (Kevin M. Counts)
    Re: STDIN works too well (Fluffy)
    Re: STDIN works too well (Tim Cutts)
    Re: Use of Modules was: Date validation) (Steffen Beyer)
    Re: Web Store and SQL? birgitt@my-dejanews.com
    Re: Win32:FileSecurity: Writing ACL's <lantrewi@do.isst.fhg.de>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 16 Dec 1998 10:19:36 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: 'pipe' an 8-bit file
Message-Id: <3678891b.9698162@news.skynet.be>

Bob Tate wrote:

>I am in the same place as far as coding e-mail.  I use the SENDMAIL program
>for normal e-mail functions and it is great.  I am tring now to develop a
>process by wich I can send a message with an attached file via a mailing
>list.
>
>The below code works fine in the fact that it will send a message to me and
>show the attachment.  When attempting to view the attachment however, I get
>an error trying to open it.  I have done some research on this and believe
>that I have found the problem.  The file is not being passed as binary but
>as ASCII.  I am on Solaris 2.6.  While I believe that I am close to finding
>the answer that I seek, does anyone know what step I might be missing for
>the attached file to be sent as binary?

Don't. Mail is basically an Ascii transfer protocol.

You ought to encode the binary file in (for example) base64 encoding,
and say so in your Content-Transfer-Encoding header.

At least, look at the MIME:Base64 (part of your PErl installation?) and
Mime.Lite modules.

   HTH,
   Bart.


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

Date: Wed, 16 Dec 1998 09:52:34 GMT
From: birgitt@hamburg.citde.net
Subject: Re: C structure to perl
Message-Id: <757vt1$24n$1@nnrp1.dejanews.com>

In article <755p6v$g03$1@csnews.cs.colorado.edu>,
  tchrist@mox.perl.com (Tom Christiansen) wrote:
>  [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc,
>     Kozo <kozo@pobox.sk> writes:
> :how to convert C structure to perl ?
> :is any tool ? struct2perl ?

[snip]

>
> Here's the old c2ph output.  It's still in perl4-speak.
> I never updated it to perl5 objects and classes.
>
>     % c2ph -swhod,whoent,outmp /usr/include/protocols/rwhod.h
> sub outmp'out_line                   {    0; }
> sub outmp'out_name                   {    1; }
> sub outmp'out_time                   {    2; }

[snipped away one of those real goodies from T.C. which he hands out only at
Christmas time. :-)]

Pardon a dumb question from a very new programming student, who started just
out with C and wants to go to Perl soon. I can't yet read your code and can't
yet understand enough about C. But does the above mean that I can convert
each and every program I write in C to Perl with your program ?

( I had in mind to teach myself Perl in trying to do all my C homeworks, I
get, also in Perl and didn't know if that was a stupid idea or not. If it
would work automatically with your program, it kind of beats me as a learning
tool, or may be not ... I am confused :-)...thanks for an answer in advance).

birgitt


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 16 Dec 1998 11:00:27 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Complicated sorting problem
Message-Id: <36779115.11738790@news.skynet.be>

Uri Guttman wrote:

>some work well with
>ST and others with OM (orciam manouever which is not mentioned as much
>as ST but is very useful too).

You've mentioned this OM several times in the last few days. I've never
heard of this before. (sp: Orciam, Orcian, or Orcish)

What is it? Is it (for example) the conversion of numbers to right
justified strings?

I must say that you do loose the original data this way. Or you have to
put them in a hash, and reference through the hash,, just like Larry
Rossler did in his post on dec 13
(<MPG.10de1d51f12e3aab989957@nntp.hpl.hp.com>). That doesn't look
"fast".
	Bart.


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

Date: Wed, 16 Dec 1998 12:44:06 +0100
From: Peter Forsbom <KONPEF@statoil.com>
Subject: How do I change current working directory ?
Message-Id: <36779D06.A00A286F@statoil.com>

I want to change the current working directory so when my perl program
is done my pwd is diffrent from when I started the program.

Peter Forsbom




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

Date: Wed, 16 Dec 1998 09:31:38 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: How to extract emails from HTML page
Message-Id: <ebohlmanF41x4q.Ht3@netcom.com>

Philip Class <philip.class@popcorn-studio.ch> wrote:
: To be honest - The main purpose for collecting emails is a commercial one.
: Contancting potential customers in a discrete way (inculding our own personal
: address data as sender and offering a 'REMOVE ME' feature) is not what I call
: usual cheap spam. That's my opinion, ...and that's why I didn't hesitate

Try this thought experiment.  Imagine that you're sending unsolicited 
mail as you describe.  By itself, it doesn't really have all that much 
impact on any user; it takes them only a second or to to delete it or 
remove themselves from your list.

Now imagine one other company doing the same thing.  By itself, it's 
still trivial.  Combine it with what you're doing and it's still trivial, 
even though people will in general grumble twice as loud.

Now try to think of all the companies out there, and try to think of any 
factors that would prevent them from all making the decision you did.  I 
have a hard time thinking of any.  Now imagine what your mailbox would 
look like if even 5% of those companies made the same decision you did.  
I can, and it ain't pretty.

The biggest problem with UCE is that it doesn't scale well, and it seems 
like nothing short of a strict prohibition on it will keep it from trying 
to scale up.  The danger is that it will eat up the whole mail system 
before it realizes it can't scale.




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

Date: Tue, 15 Dec 1998 18:21:58 +0100
From: "Paul Matthijsse" <Paul.Matthijsse@wanadoo.fr>
Subject: Inconsistent behavior s/// ?
Message-Id: <7565of$dg7$1@platane.wanadoo.fr>

Maybe someone can help me with the following problem concerning the search
and replace command s///.

I want to change the order of (Dutch) words in a text that is read from
disk.

When I read in a short file (a couple of lines), the following code works
well:
    while (<INPUT>) {
        s/om te vormen een (.*) om/om een \1 te vormen om/g;

When I omit the last occurrence of 'om' in both the search and the replace
part, resulting in:
    s/om te vormen een (.*)/om een \1 te vormen/g;
things go wrong: 'om een \1' is replaced well, but the last two words ('te
vormen') are placed after the last word in the text, instead of following
the \1.

Things get more strange when I read in a somewhat larger file (say two
pages).
With both s/// constructs above the first part 'om een \1' is treated well,
but the words 'te vormen' are placed a couple of lines further on,
apparently at random in the middle of a sentence.
I tried this on Linux and Windows, with exactly the same results.
Can somebody give me a hint?

(I discovered Perl only two weeks ago, so, if necessary, please shout
gently... :-))

Thanks, Paul.

---
Paul.Matthijsse@wanadoo.fr
t +33.475.46.81.01
/* could be worse, could be raining */




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

Date: Wed, 16 Dec 1998 11:47:24 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Inconsistent behavior s/// ?
Message-Id: <ebohlmanF423F0.3pw@netcom.com>

Paul Matthijsse <Paul.Matthijsse@wanadoo.fr> wrote:
: When I read in a short file (a couple of lines), the following code works
: well:
:     while (<INPUT>) {
:         s/om te vormen een (.*) om/om een \1 te vormen om/g;

: When I omit the last occurrence of 'om' in both the search and the replace
: part, resulting in:
:     s/om te vormen een (.*)/om een \1 te vormen/g;
: things go wrong: 'om een \1' is replaced well, but the last two words ('te
: vormen') are placed after the last word in the text, instead of following
: the \1.

1) You should be using $1, not \1, in the substitution string.

2) a '.*' at the end of a pattern will match a null string, and therefore 
a '(*.)' at the end of a pattern will capture nothing.
  


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

Date: Wed, 16 Dec 1998 10:27:02 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Need some speed tips on this script..
Message-Id: <36798a93.10074178@news.skynet.be>

Larry Rosler wrote:

>> print RESULTS map "$_\n", sort keys %ips;
>
>This is decidedly un-cool.  There have been lots of discussions about 
>how to sort IP addresses, and this is *not* one of them.  See DejaNews.

Oh. Ithought you were talking about the map "$_\n".

I'd do it like this:

	($\,$,) = ("\n","\n"); 		# may even be local!
	print RESULTS sort keys %ips;

	Bart.


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

Date: Wed, 16 Dec 1998 11:16:12 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Newbie help plz
Message-Id: <ebohlmanF421z0.1vH@netcom.com>

jamesht <jamesht@idt.net> wrote:
: I think that the system(ls) call won't work because NT doesn't understand
: the ls command.

Correct.

: how's this for a solution:

: opendir(DIR, "$the_dir") || die "$!";
: while($dir = readdir(DIR)) {

This will terminate prematurely if you have a directory whose name 
consists entirely of repetitions of the character '0'.  Use:

while (defined ($dir=readdir(DIR)) {

: # do stuff to each thing in $dir.

And be sure to remember that $dir will *not* contain any path information,
so if you're going to do anything with it other than displaying it, you
need to prepend the contents of $the_dir to it (with a slash in between). 

: }
: closedir(DIR);


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

Date: Wed, 16 Dec 1998 11:44:11 +0100
From: Kamran Iranpour <kamran@norsar.no>
Subject: newbie on DBM
Message-Id: <36778EFB.494C@norsar.no>

Hi

I run the following script on a very simple DBM impl. but
nothing happens:

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

use NDBM_File;
use AnyDBM_File;
use Fcntl;

my %hash;
my ($key, $val);
tie %hash, 'AnyDBM_File', 'testdbm', O_RDWR|O_CREAT, 0644 or die "can't
tie : $!\n";
while (($key,$val) = each %hash){
    print "$key $val\n";
}


untie %hash;

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


I get zero. The *.pag and *.dir files are of zero size. What am I
doing wrong ?

Thanks

kamran


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

Date: Wed, 16 Dec 1998 11:24:06 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: newbie on DBM
Message-Id: <ebohlmanF422C6.2BM@netcom.com>

Kamran Iranpour <kamran@norsar.no> wrote:
: I run the following script on a very simple DBM impl. but
: nothing happens:

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

: use NDBM_File;
: use AnyDBM_File;
: use Fcntl;

: my %hash;
: my ($key, $val);
: tie %hash, 'AnyDBM_File', 'testdbm', O_RDWR|O_CREAT, 0644 or die "can't
: tie : $!\n";
: while (($key,$val) = each %hash){
:     print "$key $val\n";
: }


: untie %hash;

: -----------------


: I get zero. The *.pag and *.dir files are of zero size. What am I
: doing wrong ?

You've never stored anything in the hash, that's what.



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

Date: Wed, 16 Dec 1998 12:35:52 +0100
From: Kamran Iranpour <kamran@norsar.no>
Subject: Re: newbie on DBM
Message-Id: <36779B18.612@norsar.no>

Eric Bohlman wrote:
> 
> Kamran Iranpour <kamran@norsar.no> wrote:
> : I run the following script on a very simple DBM impl. but
> : nothing happens:
> 
> : --------------
> : #!/usr/local/bin/perl -w
> 
> : use NDBM_File;
> : use AnyDBM_File;
> : use Fcntl;
> 
> : my %hash;
> : my ($key, $val);
> : tie %hash, 'AnyDBM_File', 'testdbm', O_RDWR|O_CREAT, 0644 or die "can't
> : tie : $!\n";
> : while (($key,$val) = each %hash){
> :     print "$key $val\n";
> : }
> 
> : untie %hash;
> 
> : -----------------
> 
> : I get zero. The *.pag and *.dir files are of zero size. What am I
> : doing wrong ?
> 
> You've never stored anything in the hash, that's what.


Sorry for being ignorant but how do I do that. I am sitting
here with O'Reilly book and all I can find is what I wrote
above.

Thanks in advance

Kamran


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

Date: Wed, 16 Dec 1998 11:58:14 +0000
From: "Geir Magnusson Jr." <gmj@netaxis.com>
Subject: Re: Perl & Microsoft IIS Server
Message-Id: <3677A056.D42C13FF@netaxis.com>

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
johkar wrote:
<blockquote TYPE=CITE>I am a total non-programmer so please bear with me.&nbsp;
Many of the free
<br>perl scripts at places like Matt's script archive say they are geared
to
<br>a UNIX server.&nbsp; Will these work on a Windows based Microsoft server
<br>anyway?&nbsp; If not, what is the difference and can they be adapted?
At work
<br>they just switched to a Microsoft server.</blockquote>

<p><br>Yes, in genereal perl works fine with IIS &lt;shudder>.&nbsp; We
use it for a little QA database
<br>we have, using IIS, perl and SQL&nbsp;Server&nbsp;(until I get the
client-side stuff for Sybase... and
<br>then we go to Apache/Sybase on the Linux box. RedHat 5.2 is like a
box of 'Bill-be-Gone'.)
<p>Anyhow, if you have any specific questions, feel free to ask, here or
via email.
<p>geir
<pre></pre>

<pre>--&nbsp;
Geir Magnusson Jr.
gmj@netaxis.com
Perl's garbage collector abhors a naked circularity. -tc
Chase the dream, not the competition.</pre>
&nbsp;</html>



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

Date: Wed, 16 Dec 1998 11:19:42 GMT
From: elvis@theking.org (Bob Dubery)
Subject: Re: PERL date/time expiration question
Message-Id: <36779708.12130268@hermes.is.co.za>

On Tue, 08 Dec 1998 03:34:43 GMT, cgi@higherlove.com wrote:


>I want to be able to write a line to a text file with the current time
>when the program is activated (say, like in a logging script). Then
>each time the program is run, it compares the current time against the
>times listed in the text file -- if the difference is greater than 5
>minutes (ie: over 5 minutes have passed since the line was written
>into the file), the expired lines are deleted.

With time calculations it's always easier to work in seconds. Say a
line is written into your file on 29/02/2000 at 23:59:59. 5 minutes
later the date is 01/03/2000 and the the time is 00:04:59. Now the
maths is not impossible, but there are a lot of things to keep track
of (is it a leap year? how many days in the month? etc. etc). 

Perl has a function time() that returns seconds elapsed since midnight
on a specific date (jan 1 1970 for Unix systems). Use the value
returned by time and the maths is simple...

A line might be stamped at (thumbsuck) 123131389 (number of seconds
from 1/1/70 to the date and time the line was added to the file). Now
when you check that line you use time() again, subtract 123131389 from
the new returned value and if the difference is greater than 300 then
the line is more than 5 minutes old and should be deleted.

---
the e-mail address in the headers is bogus
unknot megapode@KNOTicon.co.za to mail me


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

Date: Wed, 16 Dec 1998 11:53:41 GMT
From: "Adam Michela" <adam@simpledia.com>
Subject: Re: Personal Web Server, Windows 95-98, Perl.
Message-Id: <9bNd2.28$yM3.2985@typhoon.nycap.rr.com>

Thank you for your help.

Adam Michela


ErLanGen <erlangen72@hotmail.com> wrote in message
news:757hje$nv7$1@ash.prod.itd.earthlink.net...
>Hi Adam,
>
>Yes it's possible. I have MS PWS4 and Win95b, IE4.01 sp1.
>This is a Perl related question. PWS4 supports all the bells and
>whistles offered by PerlScript. However, PWS4 will slightly cripple
>your installation if you don't have WInNT.
>
>You will need to make PerlScript your default ASP Script Engine.
>To do this you need to have the following Registry Fix:
>
>================snip====================
>REGEDIT4
>
>[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\W3SVC\ASP]
>
>[HKEY_LOCAL_MACHINE\System\CurrentControlSet\_
>Services\W3SVC\ASP\LanguageEngines]
>
>[HKEY_LOCAL_MACHINE\System\CurrentControlSet\_
>Services\W3SVC\ASP\LanguageEngines\PerlScript]
>"Write"="$Response->write(|);"
>"WriteBlock"="$Response->writeblock(|);"
>====================snip=====================
>
>As a minimum, this Registry fix will allow you to view all the
>Perl HTML help with your Web Server. Set up web sharing
>in your Perl folder and you will be surprised to see how nicely
>all the samples will run.
>    HTH, Mark
>
>Adam Michela wrote in message ...
>>Anyone know if it is possible to set up personal web server with perl on a
>>windows95, or 98 system, I see alot of references about it. But I see
>>nothing telling you how.
>>
>>Any help would be appreciated, thank you.
>>
>>Adam Michela
>>
>>
>>
>
>
>




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

Date: Wed, 16 Dec 1998 09:44:05 +0000
From: Matt Sergeant <matt@teamamiga.org_NOSPAM>
Subject: Re: previous page, perl vs asp
Message-Id: <367780E5.1E4FDEF9@teamamiga.org_NOSPAM>

Dan Albertsson wrote:
> 
> I have seen on different shopping websites, written in ASP, that if you
> update a page (for instance your shopping cart) and then press your
> browsers Back button, the browser does not show how the page look like
> before you updated it.
> 
> Is that possible to do with cgi-scripts written in Perl. Because otherwise
> it messes up my shopping application when visitors starts to move back in
> history (goes to previous webpages my cgi-script has produced). Is it
> possible to perhaps instruct the browser not to remember the page that was
> shown before or realy replace it with the new one so you can't go back to
> the previous one.

It's possible to do with a CGI script written in any language. ASP just
sends HTTP after all. Try adding the header "Expires", and set it to
yesterday. And make sure you send the no-cache header for proxy servers.
See the HTTP spec.

-- 
<Matt email="matt@teamamiga.org" />

| Fastnet Software Ltd              |   Perl in Active Server Pages   |
| Perl Consultancy, Web Development |   Database Design   |    XML    |
| http://come.to/fastnet            |    Information Consolidation    |


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

Date: Wed, 16 Dec 1998 10:24:27 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: previous page, perl vs asp
Message-Id: <ebohlmanF41zKr.LK9@netcom.com>

Dan Albertsson <dan.albertsson@swipnet.se> wrote:
: I have seen on different shopping websites, written in ASP, that if you
: update a page (for instance your shopping cart) and then press your
: browsers Back button, the browser does not show how the page look like
: before you updated it.

: Is that possible to do with cgi-scripts written in Perl. Because otherwise
: it messes up my shopping application when visitors starts to move back in
: history (goes to previous webpages my cgi-script has produced). Is it
: possible to perhaps instruct the browser not to remember the page that was
: shown before or realy replace it with the new one so you can't go back to
: the previous one.

Nope, it's not possible.  You need to go back to the definition of your 
problem rather than the definition of one possible solution.  Your 
problem is "resubmission of intermediate-stage forms messes up my 
script."  A good first-level approximation of a solution is "rewrite my 
script so resubmission of intermediate-stage forms doesn's mess it up."  
Further refining, you find yourself asking a question: "how can my script 
identify a resubmission of an intermediate-stage form so it can reject or 
ignore it?"  One possible answer is "assign a sequence number to each 
intermediate-stage form, and reject any submissions with an already-used 
sequence number."  At this point, how to do that will depend on what 
techniques you're using to maintain state between forms.



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

Date: Wed, 16 Dec 1998 08:35:05 GMT
From: digicat@tampabay.rr.com (Kevin M. Counts)
Subject: STDIN works too well
Message-Id: <ZgKd2.1805$L22.2653613@newse3.tampabay.rr.com>

Well, that wacky header is only a foreshadow to my question:

I have a script called abc.pl:

#!/usr/bin/perl 
while ( $a = <STDIN> )
{
	print "$a";
}

If I call it w/ this command line:
echo "hello" | abc.pl

It ouputs: 
hello

But if I call it by itself: abc.pl

It waits for me to enter input... the question is
how do I configure it only to get data if someone
pipes it through?

I've been checking the perlop io section but I can
synthesize a solution at this point :(

Thanks for any help!

Kevin Counts
digicat@mindspring.com


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

Date: 16 Dec 1998 09:11:18 GMT
From: meowing@banet.net (Fluffy)
Subject: Re: STDIN works too well
Message-Id: <757tfh$anc@meow.invalid>

Kevin M. Counts <digicat@tampabay.rr.com> wrote:
> I have a script called abc.pl:

{chomp thingy that reads STDIN}

> If I call it w/ this command line:
> echo "hello" | abc.pl
> It ouputs: 
> hello
> But if I call it by itself: abc.pl
> It waits for me to enter input...

Well, yeah.  That's what standard I/O does.  It's almost, like,
standard, or something like that.

> the question is how do I configure it only to get data if someone
> pipes it through?

Look in the perlfunc pod, under the -X section.  The -p and -t
ones ought to give you what you need.  Browse through the rest of
that section while you're in there; lots of little annoyances can be
solved with some sort of - function.
-- 
"FEAST!"
      --Alice


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

Date: 16 Dec 1998 10:18:00 +0000 (GMT)
From: timc@chiark.greenend.org.uk (Tim Cutts)
Subject: Re: STDIN works too well
Message-Id: <ibf*2iENn@news.chiark.greenend.org.uk>

In article <ZgKd2.1805$L22.2653613@newse3.tampabay.rr.com>,
Kevin M. Counts <digicat@tampabay.rr.com> wrote:
>Well, that wacky header is only a foreshadow to my question:
>
>I have a script called abc.pl:
>
>#!/usr/bin/perl 
>while ( $a = <STDIN> )
>{
>	print "$a";
>}
>
>If I call it w/ this command line:
>echo "hello" | abc.pl
>
>It ouputs: 
>hello
>
>But if I call it by itself: abc.pl
>
>It waits for me to enter input... the question is
>how do I configure it only to get data if someone
>pipes it through?

As far as I know, there is no way for a program to tell whether its
STDIN is a pipe or not (UNIX gurus feel free to correct me).  What you
probably want to do is perform select() on STDIN, and process the
input if the select tells  you you can:

sub IsSTDINReady {

  my ($rin) = '';
  my ($nfound, $rout);

  vec($rin, fileno(STDIN), 1) = 1;
  $nfound = select($rout=$rin, undef, undef, 1);

  return $nfound;

}

if (&IsSTDINReady > 0)
{
  print "We have some Standard input!\n";
}

See the perlfunc manpage for more details on select.  Hope this helps.


Tim.


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

Date: 16 Dec 1998 10:26:08 GMT
From: sb@engelschall.com (Steffen Beyer)
Subject: Re: Use of Modules was: Date validation)
Message-Id: <7581s0$d12$1@en1.engelschall.com>

Bill Moseley <moseley@best.com> wrote:

>>> Is there a 'common' way to validate input dates?

> In article <754ubb$85k$1@en1.engelschall.com>, sb@engelschall.com says...

>>Perl modules are you friend.

>>You might want to check out Date::Calc or Date::Manip from CPAN

> I'm developing on a Win95 machine, and the scripts will live on
> a number of different unix systems when done.  

> I added Date::Manip to my ActiveState installation -- 
> Manip.pm is 250K in size.

> Clearly, I'm new at most of this.  I'm wondering how people decide 
> when to use modules:

> Adding a 250K module to my 30K script seems like a lot of baggage
> to just verify a date.

The Date::Calc module is a lot more compact, especially since its core
is written in C - but it requires a C compiler to build, on the other
side.

(You could also make a custom PPM entry and distribute it in binary form,
though.)

You could also get the code for date validation out of a module and put
it into your script as a subroutine.

(The code is rather simple and straightforward.)

> And then there's the issue of Date::Manip not being available on the target
> machines.  How do programs gracefully deal with missing modules, if, for
> example, the script gets moved to a new machine w/o the module?

They don't deal with it gracefully, they just won't compile.

> $happy = install_CPAN_mod('Date::Manip') if missing_module('Date::Manip');

> Any wisdom from the experienced?

BEGIN
{
    eval { require Date::whatever; };
    if ($@)
    {
        use CPAN;
        # install Date::whatever (see CPAN man page how to do that)
        use Date::whatever qw(whatyouwant);
    }
    else
    {
        Date::whatever::import qw(whatyouwant);
    }
}

(This is untested, though!)

> P.S.: Are the full man pages for the CPAN modules available via the web or
> do I have to download and install to view them?

It depends (CPAN itself does not provide them).

The man pages for Date::Calc are available online at:

    http://www.engelschall.com/u/sb/download/Date-Calc/

> As always, Thanks,

You're welcome, of course.

Regards,
-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/download/    (Free Perl and C Software
    http://www.perl.com/CPAN/authors/id/STBEY/         for Download)
    New: Build'n'Play 2.1.0 (all-purpose Unix batch installation tool)


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

Date: Wed, 16 Dec 1998 09:23:27 GMT
From: birgitt@my-dejanews.com
Subject: Re: Web Store and SQL?
Message-Id: <757u6d$10g$1@nnrp1.dejanews.com>

In article <7542si$q2f$1@news1.cableinet.co.uk>,
  "Sovereign Media" <Webmaster@detour.co.uk> wrote:
> I have Selena Sol's Web Store working fine but I wanted to make the database
> an MSSQL one as it is now growing rather large (86,432 items). I realise
> that in the setup files there is one file which will hold the routines I
> need but.............
>
> Being pretty new to perl and MSSQL, i'm finding it difficult to get it to
> return the values I need. Does anyone have even a basic example of
> web_store_db_lib.pl using SQL that I could sneek a peek at?

No, but you could use another free perl-based shopping cart package where this
is not a problem. Works fine with over 500 000 records and MySQL.
See the docs in http://www.minivend.com.

birgitt


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 16 Dec 1998 11:31:33 +0100
From: Boris Lantrewitz <lantrewi@do.isst.fhg.de>
To: Casey Feskens <feskencj@plu.edu>
Subject: Re: Win32:FileSecurity: Writing ACL's
Message-Id: <36778C05.B7A38C97@do.isst.fhg.de>

Casey Feskens wrote:
> 
> Has anyone had success using Win32:FileSecurity
> to set file permissions.  I'm just getting started with this,
> using the standard scripts listed with the Win32:FileSecurity
> documentation (haven't spent a lot of time modifying them yet).
> It appears that I can append to the ACL just fine, but I can't
> seem to wipe it out and write a new one.
> 
> Any suggestions?  Does anyone have a working set of Perl
> scripts for this that they might let me take a look at?
> Also, recommendations for further documentation of this
> particular module would be helpful.  I'm still pretty new
> at this.
> 
> Thanks in advance...
> 
Dear Casey,

I don't know if this is already answered !

You have to set 

	%Permiss_Hash = ();

before You insert anything.
Don't forget to use the exact User names and to always give 

	"$ENV{'USERDOMAIN'}\\Administrator"
and
	"SYSTEM" (or is it "$ENV{'USERDOMAIN'}\\SYSTEM" ?)
and 	
	"$ENV{'USERDOMAIN'}\\$ENV{'USERNAME'}" ( in case You are not 
	                                         the Administrator. )

Full Access. 
Otherwise You may run into trouble afterwards. 
Recall that if You specify "$ENV{'USERDOMAIN'}\\Everyone" to have 
not at least READ access to a file, this file cannot be reached by 
You via Explorer anymore unless You are the Administrator. 
( As long as You are the owner of the file You may change this via 
the commandline afterwards. )

Otherwise existing Users will keep the rights they already have, 
because the new ACE (Access Control Entry) for them will be ored 

	( EXISTING_ENTRY | NEW_ENTRY ) in C Syntax

together with the already existing one.

To overwrite the ACE's for existing users, simply do the following:
Get the permissions hash, then do

for ( keys %Permiss_Hash ) {
$Permiss_Hash($_) = 0;
}

then Apply the rights as described in the documentation.
This will replace users' rights.
Hope this helps

Boris 

P.S. ( Win32::FileSecurity doesn't handle generic rights correct in 
       some cases. )
-- 
-view with fixed width font, please ------------------------------
__________________________________________________________________
            ___ ___ _ _ _ _
           |   |   |_|_|_|_|       
           |___|___|_|_|_|_|
           |   |   |_|_|_|_|     Boris Lantrewitz
           |___|___|_|_|_|_|        
           |    _   _  ___ |       
           | | |_  |_   |  |     
           | |  _|  _|  |  |  email: <mailto:lantrewi@do.isst.fhg.de>
           |_______________|  www  : <http://www.isst.fhg.de>

           Fraunhofer 
           Institut fuer
           Software- und         address: 
           Systemtechnik       Joseph-von-Fraunhofer-Strasse 20
                                        44227 Dortmund
____________________________________________________________________


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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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