[10991] in Perl-Users-Digest
Perl-Users Digest, Issue: 4591 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 8 14:07:27 1999
Date: Fri, 8 Jan 99 11:00:16 -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 Fri, 8 Jan 1999 Volume: 8 Number: 4591
Today's topics:
Re: "internal server error" (Tony Greenwood)
Crypto with PERL? cmc@aracnet.com
Re: Does MacPerl live here too? (Bart Lateur)
Re: GD.pm / DynaLoader problem (jim barchuk)
Re: Gratuitous warnings when statting files with newlin (M.J.T. Guy)
Re: Matching binary strings (Ben Coleman)
Re: More efficient way to program this? Maybe Daemon? neal@make-a-store.com
Re: More efficient way to program this? Maybe Daemon? nkaiser@my-dejanews.com
Re: NT/ActivePerl/File::Copy/Network Drive/AT command = <mclellan@ReactionDesign.com>
Re: ODBC Drivers <gp@gpsoft.de>
Re: Perl Criticism topmind@technologist.com
Re: Sorting question (M.J.T. Guy)
Re: STDIN Read buffer size (Steven Barbash)
writing file output....newbie perlstudent@my-dejanews.com
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 09 Jan 1999 02:05:34 GMT
From: paxton@cyberstrider.org (Tony Greenwood)
Subject: Re: "internal server error"
Message-Id: <3697b42b.699520@news.freeserve.co.uk>
** CyberSTrider Web Services http://web.cyberstrider.net **
Hey! phenix@interpath.com (John Moreno)
>Tony Greenwood <paxton@cyberstrider.org> wrote:
>
>> ** CyberSTrider Web Services http://web.cyberstrider.net **
>>
>>
>> >> >Let's see.... you don't have -w, you don't have "use strict", you do
>> >>
>> >> Niether do I.. what do they do ?
>> >
>> >Gives warning message on suspect code and enforces a stricter syntax.
>>
>> haaa fanx
>
>I don't know if I'm responding to a well done troll or you're simply
>being difficult. I'll give it one more try.
Now you are doing the same as me
I had absolutely no idea what -w was for or if I could use it or
anything about it, Yes I have seen it many times, but it is not
commented as to the meaning anywhere
>
>> >> >everything yourself instead of using modules written by people with a
>> >>
>> >> Same here.. I still don't understand what a module is or how to use
>> >> them
>> >
>> >"use" them and then call their functions, fairly simple.
>>
>> I said I don't know how to use them.. your answer to use them is
>> therefore a little confusing
>
>"use" is similar to the C #include (or at least that's good enough to
>get you started in the right direction).
>
>use CGI;
How could I know ?.. I think you sort of answered me but presumed I
would know... I didn't...thus it would obviously look like you are
telling me to use it wouldn't it ?...can you see that ?
>is probably what was being referred to, in the above modules statement.
>
So would I have the module and upload with a cgi or would the module
already be there as standard. This is an important bit and I would
like more info on the subject.. if the answer is to go look it up on
the web then that kinda negates the use of this newsgroup.. but we
shan't get into that old chestnut eh :)
>> >> I "think" I have the appropriate enviroment though so I am one up on
>> >> the original poster :)
>> >
>> >Trying to learn perl by doing CGI programming (especially for someone
>> >with no programming experience) is like trying to learn to ride a
>>
>> I have ten years programming experience... you are having a bad day
>> arn't you
>
>No, and this wasn't directed at you -- you I assumed were learning by
>doing regular programming (and that that was what you were referring to
>when saying that you were using the appropriate environment).
I saw environment as having my own server and having a server and perl
on my machine at home, the ability to test out my work with ease.. ie:
not having to ask others to test it, we both looked at that one
differently.
>> I see humour goes right over your head...Whoooosh!
>
>Sometimes.
:)
>> >> BTW it isn't sarcasm.. I really don't know the answers to the above..
>> >> .
>> >Then you need to read some more.
Is that as apposed to asking in here ?
>> I agree, I just hope I don't have to read bad mannered posts too often
>
>What you need to read isn't post, bad mannered or good. What you need
>to read is the perl documentation and maybe a book or two.
Again you must have presumed I knew.. a sweeping statement like "use"
or "read" isn't quite going to hack it for us newbies is it.... I have
been directed to books on the subject TBH and I am awaiting them to
arrive.. meanwhile I have thousands of messages posted to this
newsgroup to reference to and a good global search option in
forte.agent...
>> >You seem to be missing a sigdash, would you like to borrow one?
>>
>> What for?
>
>The sigdash is how newsreaders recognize that what follows is a sig,
My apologies... the above was sarcasm........Whoosh again :))
>Either you are jerking me around or you took it for an attack for some
I did take it as an attack actually and I can and do openly apologise
most strongly as it seems that wasn't the case.. but your post held
absolutely no answers to the questions I posted....just snippets that
under the circumstances where easily taken the wrong way
>reason, I don't know why you'd do either.
Look at your post from the point of view of someone who knows
nothing.. like me :)
<fx:hand out>
Cheers.....!ynoT
CyberSTrider Web Services
http://web.cyberstrider.net
------------------------------
Date: Fri, 08 Jan 1999 18:35:46 GMT
From: cmc@aracnet.com
Subject: Crypto with PERL?
Message-Id: <36964f69.247821658@news.aracnet.com>
I have done some searching in CPAN and dejanews concerning crypto
support with PERL, and essentially came up empty. So, is there a pm
or PERL extension somewhere that supports crypto operations?
Thanks in advance.
--Ming
------------------------------
Date: Fri, 08 Jan 1999 18:10:12 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Does MacPerl live here too?
Message-Id: <369648af.428469@news.skynet.be>
Arved Sandstrom wrote:
>Seriously, though, there is a very active MacPerl mailing list. Find links
>to it from the Mac references on www.perl.com or go to www.ptf.com.
Yup. That's were the main action is. But, then again, several regulars
in this newsgroup are also active on the mailing list, so you CAN ask
here, too.
>As a matter of fact, getting the Time Zone in MacPerl is a current topic.
>I haven't really been following it, though.
Oddly enough, the thread was started by a "walter". It seems like it's a
different person anyway (different e-mail address).
Roughly, it involves subtracting localtime() from gmtime(), and
interpreting that result. Ugly.
Bart.
------------------------------
Date: Fri, 8 Jan 1999 13:38:42 -0500
From: jb@jbarchuk.com (jim barchuk)
Subject: Re: GD.pm / DynaLoader problem
Message-Id: <ibj577.35t.ln@jbarchuk.tiac.net>
Hello All!
> Upgraded to Perl 5.00403 and get compile error. Noticed there was a
> GD.pm 1.18, tried that but still get the same error.
Well, I 'fixed' it for no apparent reason. I simply did a full 'perl
Makefile.PL, make, make install' on GD 1.18 and voila, it works. I
have no clue why it works but I don't care. Just wunna them things
that make ya thimmk 'Huh?'. :)
If anyone cares to see a few neat online image utilities that use GD:
CGM - Composite GIF Machine - Creates images of very fine patterns of
pixels. Fine grained patterns of 'two different colors' are perceived
by the human eye as a 'different color'. For use with web pages to
make backgrounds of 'different but web palette compatible' colors, or
for backgrounds for other new images. http://www.jbarchuk.com/cgm/
GIFSplit - Accepts uploaded or 'online accessible' GIF image and
splits it into user defined horizontal and vertical chunks. Returns
full HTML snippet for use with 'fake image maps'.
http://www.jbarchuk.com/gifsplit/
I'm working on a widget someone asked for, a tool to set user selected
GIF colors to transparent.
Also another widget to adjust 'density' of GIFs by adjusting some of
the GIF to transparent.
Have a :) day!
jb
--
jim barchuk
jb@jbarchuk.com
------------------------------
Date: 8 Jan 1999 18:39:15 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Gratuitous warnings when statting files with newlines
Message-Id: <775jcj$dtf$1@pegasus.csx.cam.ac.uk>
Hrvoje Niksic <hniksic@srce.hr> wrote:
>I noticed a strange thing today. This runs without warnings:
>
> perl -we '(-d "foo")'
>
>However, this prints out a warning:
>
> perl -we '(-d "foo\nbar")'
> --> Unsuccessful stat on filename containing newline at -e line 1.
>
>Apparently, `-w' doesn't like the stat-related operators to contain
>newlines.
Not quite - -w doesn't like *failing* stat-related operators.
So in the common case where the file exists, you don't get a warning.
>While I know files with newlines in the name are rare, their occurence
>shouldn't cause my application, which otherwise handles those files
>just fine, to spew warnings to stderr.
Warnings cover cases where, although you have valid Perl, it is doing
something sufficiently odd that you've *probably* made a mistake.
In this case, it's catching the common error of failing to chomp()
the filename, as the perldiag entry for that message would tell you.
>Of course, I can remove `-w', but I don't want to do that -- `-w' is
>useful and I normally want to use it.
As Greg points out, you can switch it off locally.
Mike Guy
------------------------------
Date: Fri, 08 Jan 1999 18:33:53 GMT
From: tnguru@termnetinc.com (Ben Coleman)
Subject: Re: Matching binary strings
Message-Id: <36964f2a.151256925@news.mindspring.com>
On Fri, 08 Jan 1999 18:12:17 GMT, tnguru@termnetinc.com (Ben Coleman)
wrote:
>The pattern this actually looks for is '\x01\x02', *not* '\\x01\\x02'. If
>you want to look for a literal match on the contents of $mask, even if it
>contains pattern match metacharacters, you need to do
Oops: ignore that & pay attention to what Tad posted. Obviously I'm
getting too little sleep.
Ben
--
Ben Coleman
Senior Systems Analyst
TermNet Merchant Services, Inc.
Atlanta, GA
------------------------------
Date: Fri, 08 Jan 1999 18:10:26 GMT
From: neal@make-a-store.com
Subject: Re: More efficient way to program this? Maybe Daemon?
Message-Id: <775hmf$fhl$1@nnrp1.dejanews.com>
Yes, but the problem is that I can't afford to miss 1 minute. I sorta has to
be like an inetd program. It should "wake-up" whenever a file is put in a
certain directory and handle it. (which will be pretty often).
In article <m3zp7tu75h.fsf@joshua.panix.com>,
Jonathan Feinberg <jdf@pobox.com> wrote:
> nkaiser@my-dejanews.com writes:
>
> > while (1) {
> > &handleTypeA;
> > &handleTypeB;
> > .. etc
>
> sleep(60); # give back the CPU for a minute
>
> > }
>
> --
> Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
> http://pobox.com/~jdf
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 08 Jan 1999 18:10:34 GMT
From: nkaiser@my-dejanews.com
Subject: Re: More efficient way to program this? Maybe Daemon?
Message-Id: <775hmo$fin$1@nnrp1.dejanews.com>
Yes, but the problem is that I can't afford to miss 1 minute. I sorta has to
be like an inetd program. It should "wake-up" whenever a file is put in a
certain directory and handle it. (which will be pretty often).
In article <m3zp7tu75h.fsf@joshua.panix.com>,
Jonathan Feinberg <jdf@pobox.com> wrote:
> nkaiser@my-dejanews.com writes:
>
> > while (1) {
> > &handleTypeA;
> > &handleTypeB;
> > .. etc
>
> sleep(60); # give back the CPU for a minute
>
> > }
>
> --
> Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
> http://pobox.com/~jdf
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 8 Jan 1999 10:27:06 -0800
From: "Clifton L. McLellan" <mclellan@ReactionDesign.com>
Subject: Re: NT/ActivePerl/File::Copy/Network Drive/AT command = unsuccessful
Message-Id: <g5sl2.518$6P4.6022@news.connectnet.com>
Try adding a 'net use ...' to the script, where you map the UNC path to a
drive letter with a login/password option. The main point is not the drive
letter, it is identifying you as the correct user to the remote system.
'net use' is the easiest way to do that. Of course, you will want to
protect the script since it will contain a clear text password. You could
create a special user on the local and remote machines that only has access
to the directories you want to copy from and to and log in as that user. No
real recommendation there since I do not know your requirements.
Hope this helps,
Clifton
>I have written a script that is supposed to copy files to a network drive
at
>regularly scheduled intervals using the NT AT command to execute the script
>every hour. I am using File::Copy to copy the files.
>
>Problem:
>Script works fine when I run it manually from the console. However when I
>schedule it to run under NT all of a sudden the copy command is returning
errors
>and will not copy files to the network drive, which happens to be a
directory on
>our web machine. I have tried both UNC and drive letters in the paths.
Both
>work when I run the script manually. Both do NOT work when the AT function
>executes them.
>
>I have also tried the Arcana Scheduler application because it has the
ability to
>run the script as a somebody rather than as the system. Still no success.
>
>How can I get the network copy to work?
>
>Thanks in advance
>
>Jim
------------------------------
Date: Fri, 08 Jan 1999 19:10:57 +0100
From: Guenther Pewny <gp@gpsoft.de>
Subject: Re: ODBC Drivers
Message-Id: <36964A31.9CF6E348@gpsoft.de>
I think you will need at least Oracle's "SQL*Net Client"
(and the OCI API - normally included) on the client machine,
independent from what programming language you prefer.
I don't know any "free" module which could be used instead.
I also think Oracle has its secrets concerning protocol information
avoiding other people from writing such modules.
NB: I had no problems with DBD:Oracle, even not with BLOB
data fields (LONG RAW).
Andy.Fry@netserv.net wrote:
> Help,
>
> I have a SCO Unix Box and I'd like to connect to a remote Oracle server using
> PERL, what drivers do I need, and where the heck can I get them. Or do I need
> some Oracle Software (probably very expensive) in order to do this. I've
> tried the DBD::Oracle module, and had no joy with that, cause it requires
> some client software to be installed.
>
> Any Ideas ????
>
> Regards
>
> Andy
>
> --
> Andy Fry Phone: +44 1924 422111
> Internet Consultant Fax: +44 1924 425220
> ICM NetServ Ltd
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 08 Jan 1999 18:13:46 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <775hso$fs9$1@nnrp1.dejanews.com>
Reply to David Formosa's 1/8 message:
>> There are posts in this newsgroup, comments in the O'Rielly books and
the online documentaion. Also the decision process is carried out
(more or less) on the p5p mailing list. <<
Bits and peices here and there? Hardly a consistant, organized approach
to building a language.
>> Then you don't employ stupid people in the IT dept.<<
Except in isolated cases this is not going to happen.
There is not automated way for managers to detect fools. Thus
a *practical* language should assume there *are* plenty of idiots.
>> In most cases
I've found its the non-unix solotions dragging down a comperney esp
where it is combined with stupidity. At worst such systems fool the
stupid people into thinking that they can mannige the system. <<
The type of OS people work on depends mostly on circumstances
not controlled by them. Since it is tough to switch sub-specialties
in IT, most end up using what their college or first employer
used. Therefore, I see no mechanism in place to filter or separate
idiots into Windows instead of Unix.
I suspect your statement is flame bait.
>> Unfortunitly this is likely true, however if you are a clever person
it is a constent irratation to be strait jacketted by these safetylocks. <<
I think power and reasonable safety are only slightly mutually exclusive.
In another message I challenged someone to come up with power-Perl
code that MUST BE cryptic in order to be powerful. (Let's stay away
from reg.ex's since i did NOT exclude them in my article.)
>> Contexts, these are for the beginner one of the most confusing aspects
of perl programing. However there fundermental to perls expressive
power and its convence. <<
Could you supply a specific code example of why contexts are so great?
(hopefully with comments :-), my Perl is rusty.)
I looked them up and could not see practical
examples, only illustrative ones.
>> Regular expressions, if you have ever studied formal langages and
automarter you will discover how increadably powerfull these constructs are.<<
Like I said, I did not exclude regex's. In fact, I just put an example
on my webpage. Although I cleaned up the calling process a bit.
>> Personaly I
think where something is operating on two values and returning a third
it should be an infix operator. <<
I do not see many examples of this using descriptive operators,
at least not with user-definable functions.
It appears you have been out-voted. Besides, it complicates
a language to support both prefix and infix.
>> + * - / are all descriptive, we use them all the time to describe
those operations. And most people I know read & as and. <<
Well, you are right about these because they are banged into
our heads from years of math classes. Beyond these, I still
do not see much of a case except where multiple things
are tied together, such as string concatenation (as you mentioned).
>> in this system I would have to keep concusly checking which verent
I'm in. <<
I have been kicking around ideas for the compiler/interp. to
use the style based on how a given subroutine starts. Example:
sub (x,y,z) {
...
}
If it sees the brace right after the parameter list (or after "isolate"),
then it would assume braces for the rest of the routine.
>> In perl you can do this....{ package mysillypack... :: ... } <<
Not a very compact approach. My suggestion uses only one little
optional keyword ("isolate").
>> What I'm saying is the leeky approch is the correct one, you may not
like it but it is so usefull that it is neccery. <<
Correct One!????
Show me an example of where it is so indespensable!!!
-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm
Tom IT Cruise: "Show me the code!"
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 8 Jan 1999 18:10:13 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Sorting question
Message-Id: <775hm5$cel$1@pegasus.csx.cam.ac.uk>
Tad McClellan <tadmc@metronet.com> wrote:
>#UNTESTED!
You bet!
>sub by_components
> {
> my ($a1, $a2) = (split(/\s+/,$a))[$key1, $key2];
> my ($b1, $b2) = (split(/\s+/,$b))[$key1, $key2];
>
> return $a1 cmp $b1 unless $a1 eq $b1;
>
> return 0 unless defined($a2) and defined($b2);
>
> return $a2 cmp $b2;
> }
WARNING! Using a sort subroutine that doesn't define an ordering can
seriously damage the health of your qsort().
You need to decide where in the ordering the 'undef's should go. This
code puts them first:
return $a1 cmp $b1 ||
defined($a2) cmp defined ($b2) || # reverse to get 'undef' last
$a2 cmp $b2;
(also UNTESTED :-)
Mike Guy
------------------------------
Date: Fri, 8 Jan 1999 13:21:38 -0500
From: stevenba@ccpl.carr.org (Steven Barbash)
Subject: Re: STDIN Read buffer size
Message-Id: <MPG.110016bed111f72a98968d@www.siast.sk.ca>
Mike,
(I'm new to Perl, so I hope I'm not leading you down the garden
path.)
>From Perlfunc documention:
X FILEHANDLE
-X EXPR
-X
A file test, where X is one of the letters listed below. This unary
operator takes one argument, either a filename or a filehandle, and tests
the associated file to see if something is true about it. If the argument
is omitted, tests $_,
<snip>
-e File exists.
-z File has zero size.
-s File has nonzero size (returns size).
<snip>
Use like:
open (MYINPUT, $infile) || die "Cannot open \'$infile\' file";
$filesize = -s MYINPUT;
$readlen = read MYINPUT, $indata, $filesize;
if ($readlen != $filesize) { print "only read $readlen of file size
$filesize\n"};
I note in passing that if you are on a Windows based machine, you may
want/need to add:
binmode MYINPUT;
or else the length you read may reflect something smaller than what the
file size returns due to conversion of CF,LF. (Check the doc regarding
'binmode')
Regards,
Steve
> I want to read information from a file, or capture the information in a
> file to display information on a web page. Unfortunatley the file size
> can be very large and it seemd that read needs to know how big the file
> is. As one file might be 1 k and another may be 20m I do not want to set
> the buffer to be 20 m (or bigger) due to sucking resources. Any
> suggestion on how to take information from a flat text file without
> declaring the size of the file?
>
> read(FILE,$buffer,5000);
------------------------------
Date: Fri, 08 Jan 1999 18:21:06 GMT
From: perlstudent@my-dejanews.com
Subject: writing file output....newbie
Message-Id: <775iae$g6j$1@nnrp1.dejanews.com>
hi all,
i have a log file being written by a system call, i need to write the same
output to screen as its being created.. Also it should write out the file
only once to screen..
thanks
-perlstudent
sample code .. which i tried but fails miserably...
<snipping of....>
system "ls -1 > getfilename.log";
i can check with (- M etc for the file but does not seem to work for some
reason)
while ((-M "getfile.txt") < 0) {
open ( FILE, "<getfilename.log") || die;
my @lines = <FILE>;
print "@lines";
-M "getfile.txt";
}
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
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 4591
**************************************