[13955] in Perl-Users-Digest
Perl-Users Digest, Issue: 1365 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 12 21:08:45 1999
Date: Fri, 12 Nov 1999 18:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942458710-v9-i1365@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 12 Nov 1999 Volume: 9 Number: 1365
Today's topics:
Re: function: full(\*FILEHANDLE) (Neko)
Re: Generating pi (Craig Berry)
Re: Generating pi <revjack@radix.net>
Re: Generating pi <cassell@mail.cor.epa.gov>
Re: Help needed fast please <lr@hpl.hp.com>
Re: Help With CyberCash.... (brian d foy)
How to call a xs sub with a hash (Gustav Kristoffer Ek)
Re: how to parse dir recursively for files? <cassell@mail.cor.epa.gov>
How to retrieve substrings at fixed position in a strin <juntao@pan.as.utexas.edu>
more STDOUT STDERR problems <lfriedl@genome.wi.mit.edu>
Re: Need help understanding directory structure (NEWBIE <cassell@mail.cor.epa.gov>
Re: Need help with editing a word in a flat text file.. (Slim)
Re: Perl parseing <cassell@mail.cor.epa.gov>
Re: Perl Wizards <cassell@mail.cor.epa.gov>
Re: printing a number with 3 digits (Martien Verbruggen)
Re: regular expression to parse html out- <cassell@mail.cor.epa.gov>
Re: Some more questions on modules' usage (Eric Dew)
Re: Time (Steve Linberg)
Re: Time <cassell@mail.cor.epa.gov>
Re: Using Oracle DB's <dzerkle@us.ibm.com>
Re: Weekday in perl <lr@hpl.hp.com>
Re: Weekday in perl (Martien Verbruggen)
Re: Where can I find ? <suganesh@americasm01.nt.com>
Re: Why does print only prints to STDOUT when <christopher.kuhi@stud.uni-muenchen.de>
Re: Why does print only prints to STDOUT when <christopher.kuhi@stud.uni-muenchen.de>
Re: Why does print only prints to STDOUT when <christopher.kuhi@stud.uni-muenchen.de>
Re: Why does print only prints to STDOUT when <cassell@mail.cor.epa.gov>
Re: Why does print only prints to STDOUT when <lfriedl@genome.wi.mit.edu>
Re: Writing data to file on another server. <cans1@hotmail.com>
Re: Writing data to file on another server. <moseley@best.com>
Re: Writing data to file on another server. (Michael Budash)
Re: Writing data to file on another server. <cassell@mail.cor.epa.gov>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 12 Nov 1999 15:57:05 -0800
From: tgy@chocobo.org (Neko)
Subject: Re: function: full(\*FILEHANDLE)
Message-Id: <BpgsON1+LozRoQvr75rauw4Dhusv@4ax.com>
On Fri, 12 Nov 1999 14:39:56 -0500, Jeff Pinyan <jeffp@crusoe.net> wrote:
>Now, let's examine your program first...
>
>> The following function accounts for the different meanings of $/. It is
>> untested and may or may not work.
>
>Ooh, please test it, then. I see one glaring error.
>
> length('\n\n') == 4;
> length("\n\n") == 2;
>
>... unless I am sorely mistaken.
In a perfect world, you would only have to seek back 2 bytes to get 2 newlines.
Otherwise, you may have to account for end of line translations.
>> } elsif ($/ eq "") {
>> seek $fh, -4, 1; # length("\n\n") <= 4 # XXX see above
>> <$fh> until tell $fh >= $mark;
>
>You should only need to <$fh> ONCE, if you seeked backwards correctly
>(that is, seek($fh,-2,1)). You can't go back more than one paragraph in
>paragraph mode if you go back only two bytes.
But you can go back less than one paragraph, depending on your OS. :)
>> } elsif (ref $/ eq 'SCALAR') {
>> my $size = ${$/} + 0;
>> if ($size) {
>> seek $fh, $size - $mark % $size, 1;
>> } else {
>> # $/ = \0 currently works like $/ = ""
>
>If $/ is a reference to a constant less than 1 (not just 0), it acts like
>$/ = "". It's an obscure case, yes, but it happens. And I'm not sure
>your seek($fh, $size - $mark % $size, 1) is correct... that's going
>backwards to the beginning of the record. Why do that if you're then
>going to seek forward to the next record? Why not seek forward?
I won't argue it's correctness, except that it is incorrect if already at the
start of a record, which you've handled correctly (from a post where you correct
your own corrected program):
seek FH, $size - ($pos % $size), 1 if $pos % $size;
>Here's my corrected version, which I have tested. I include it as an
>entire program. Make your own file to test it on.
[snip]
>sub full (*) {
> local *FH = shift;
> warn("full() on unopened filehandle"), return if !fileno(FH);
> my $pos = tell(FH);
>
> return scalar <FH> if tell(FH) == 0;
>
> if (not defined $/) {
> seek FH, 0, 0;
> }
Why seek to the beginning of a 'line'? Of course, seeking to the end of the
file is not very useful either.
> elsif (ref $/ eq 'SCALAR' and my $size = ${$/}) {
> seek FH, $size % $pos, 1;
> }
You already fixed this one.
> elsif ($/ eq "" or (ref $/ eq 'SCALAR' and ${$/} < 1)) {
> seek FH, -2, 1;
> <FH>;
> }
This needs to take DOS/Windows newlines "\015\012" into account.
> else {
> seek FH, -length($/), 1;
> <FH>;
> }
>
> return scalar <FH>;
>}
--
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=
------------------------------
Date: Sat, 13 Nov 1999 00:32:10 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Generating pi
Message-Id: <s2pccaqbhsq13@corp.supernews.com>
Yanick Champoux (yanick1@sympatico.ca) wrote:
: I know! I got it! I bet there is no module to compute '1' to
: an arbitrary precision. ;)
No module, but here's a program:
#!/usr/bin/perl -w
# one - generate N digits of 1 using a series
# Useage: one _N_
# Default for N is 5. Limit of precision is double representation
# Craig Berry (19991112)
use strict;
my $digits = shift || 5;
my $dfrac = $digits - 1; # Fractional-part digits
my $epsilon = 10 ** (- $digits); # Eps = 1/10 least sig digit
my $one = 0;
my $n = 0;
my $term;
do {
$term = 0.9 * 10 ** (-$n++);
$one += $term;
} while $term > $epsilon;
printf "one = %.${dfrac}f ($n terms in series)\n", $one;
__END__
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: 13 Nov 1999 00:55:57 GMT
From: revjack <revjack@radix.net>
Subject: Re: Generating pi
Message-Id: <80icut$17h$2@news1.Radix.Net>
Keywords: Hexapodia as the key insight
revjack explains it all:
:Anybody ever tool up an algorithm in perl to generate the
:digits of pi?
Um, I mean, an algorithm that will crank out the digits one
after another, ad infinitum, without cheating like Abigail.
Seriously, I have really enjoyed all the responses so far,
thank you.
--
hey/don't look now/but there goes god/in sexy pants/with a sausage
dog/and he can't stand beelzebub/coz he looks so good in black
revjack@radix.net
------------------------------
Date: Fri, 12 Nov 1999 17:33:40 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Generating pi
Message-Id: <382CBFF4.45075C8A@mail.cor.epa.gov>
revjack wrote:
>
> revjack explains it all:
> :Anybody ever tool up an algorithm in perl to generate the
> :digits of pi?
>
> Um, I mean, an algorithm that will crank out the digits one
> after another, ad infinitum, without cheating like Abigail.
If you don't like Yannick's algorithm, you can look up
'spigot algorithms' and code it up yourself. I think there
was an article on them in the American Mathematical Monthly
about four years ago.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 12 Nov 1999 15:25:52 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Help needed fast please
Message-Id: <MPG.129641d1d049bedf98a1ea@nntp.hpl.hp.com>
In article <x3yogczqzc5.fsf@tigre.matrox.com> on Fri, 12 Nov 1999
14:33:47 -0500, Ala Qumsieh <aqumsieh@matrox.com> says...
>
> "Randy Smith" <randys@NOSPAMamigo.net> writes:
>
> > Chris <chris@chrismail.connectfree.co.uk> wrote in message
> > news:382a87d4.0@news2.cluster1.telinco.net...
>
> > : $ENV{qw(PATH IFS)} = '' x 2;
> > Did you forget a " in this line?
>
> No he didn't. Those are two single quotes. Not one double quote. You'd
> better change your newsreader's font to differentiate between the two.
>
> (I had this problem before).
Which is why my response was:
@ENV{qw(PATH IFS)} = ("") x 2;
Four hen scratches in a row are hard to mistake for two.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 12 Nov 1999 19:40:18 -0500
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Help With CyberCash....
Message-Id: <brian-ya02408000R1211991940180001@news.panix.com>
In article <382c5a6f.102501068@news.cois.on.ca>, xavier10@die.spammers.hotmail.com (Mr. X) posted:
> This has been dumped in my lap this morning....not happy....
> The company I work for just recently setup CyberCash on their secure
> servers. It works just great, it verify the credit cards and all. BUT
> it does not mail the merchant a verification or indication that there
> has been a CC sale. The company wants the script to email the merchant
> the information that CyberCash gets back from the bank. I have talked
> extensively with CyberCash about this and they indicate it is not
> their policy to help with stuff like this. I have modified the script
> to mail the merchant, but I cannot find out how to include the
> information in the email.
> I hope someone has had experience with this, as we are going nuts here
> trying to figure it out!
have you read the various documentation sets (including the developer
set) supplied with Cybercash? it's all in there.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Sat, 13 Nov 1999 02:03:19 +0100
From: stoffer@netcetera.dk (Gustav Kristoffer Ek)
Subject: How to call a xs sub with a hash
Message-Id: <stoffer-1311990203190001@powerbook.netcetera.dk>
Hi group, I'm looking for an example of how to call an xs sub with a hash
as argument.
In my script using the module, I write something like:
%my_hash = {key => 'value'};
foo(%my_hash)
then the xs sub c-code should alter 'value' to something else and return
the modified hash in the %my_hash variable.
I'm sorry to say, that I can't find any examples of that neither in
perlxstut or perlxs, could you please direct me to some information about
this :)
- gustav
------------------------------
Date: Fri, 12 Nov 1999 17:18:15 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: how to parse dir recursively for files?
Message-Id: <382CBC57.A9C6AFE4@mail.cor.epa.gov>
Kazz Asher wrote:
>
> >This is bad advice.
>
> Kragen, perhaps you should take your medication. 90% of your posts are
> merely to be an asshole. Refrain - is your keyword of the day.
Congratulations. You have just managed to get yourself killfiled
by most of the people who give correct answers in this newsgroup.
Kragen gave good advice there, whether you understood it or not.
If you didn't see his point, then re-read his message again.
He was trying to help someone. He is *usually* trying to help,
and he has posted more answers here over the last few months
than almost anyone else on the planet. Why? Well, it isn't
so people who know little about Perl or this newsgroup's
traditions can insult him for no good reason.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 12 Nov 1999 19:32:41 -0600
From: Michael Yuan <juntao@pan.as.utexas.edu>
Subject: How to retrieve substrings at fixed position in a string?
Message-Id: <Pine.GS4.4.10.9911121927360.12968-100000@pan.as.utexas.edu>
Hi, I am pretty new to Perl and I could not find how to do this in my book
...
I have a data file. Each record is a line but the fields in each line
(record) have some fixed lengthes (like the first field is column 1-12
etc). The data file is designed to be easily read using Fortran but I am
not a fan for Fortran ...
I do not want to use the binary read to control the fields I read since
each line has about 30 fields to 200 columns but I am only interested in
serveal of them. So, my question is, if I read a line into perl, how can I
get the columns, say 20-25, out as a substring? Thanks a lot.
Michael
------------------------------
Date: Fri, 12 Nov 1999 20:21:39 -0500
From: Lisa Friedland <lfriedl@genome.wi.mit.edu>
Subject: more STDOUT STDERR problems
Message-Id: <382CBD23.81368C14@genome.wi.mit.edu>
Hi.
I used to have this:
open(SAVERR, ">&STDERR");
open(STDERR, ">$process_warn");
$fail = eval { system("$PROCESS_GEL -a $gel > $process_out"); };
That worked. stdout went to $process_out, stderr (warnings and such)
went to $process_warn.
But system calls are messy, so I've switched to:
open(STDERR, ">$process_warn") or die "$!";
open(STDOUT, ">$process_out") or die "$!";
warn "hello, this is a warning\n";
print STDERR "hello to stderr\n";
($ok, $err) = process_gel('gelname'=>$gel->gelname(),
'test'=>$TEST,
'gelprefs'=>$gel, 'automatic'=>1);
. . . and a variety of strange things seem to happen. stdout is fine,
goes to $process_out.
As for stderr--when I run this from the command line I can't find it
anywhere. When I run it under the debugger,
print STDERR "hello to stderr\n" # ends up in the file!
warn "this is a warning" # ends up on my screen
and the warnings within the subroutine also go to my screen.
As far as I can tell, I don't play with STDOUT or STDERR anywhere else
in the script or included packages. Any ideas what's happening?
thanks,
-Lisa
------------------------------
Date: Fri, 12 Nov 1999 17:23:56 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Need help understanding directory structure (NEWBIE)
Message-Id: <382CBDAC.E25E336B@mail.cor.epa.gov>
[Please don't put the word newbie in your Subject: line.
Many experts have their newsreaders dump all posts with
words like that in there. The rest of your Subject: line
is descriptive, and sufficient. Thank you.]
Grizlow wrote:
>
> If I have a perl script in my cgi-bin directory on my server
> and I want to write to a file that i keep in a diretory files
> how do i reference this file..? Is this the proper structure ?
>
> When I try to do this with --- open MYFILE,
> "../files/myfile.data" I get an error.
A relative path. Bad in web apps.
> When I do it with a direct path --- open MYFILE,
> "c:/server/files/myfile.data"
> it works but I dont believe this is the correct way to do it....
An absolute path. Good.
Why, you ask? Because webservers can start your process in
any place they want to, which is quite often in some place
you never thought of. So an absolute path gets you to your
file, while the relative path may go nowhere fast [because
you're not starting in the directory you supposed].
> Next question .....
> If I want my script to send the browser to another html page
> how do I do this with the Location header.....
>
> I tried print "Location: /website1/index.html" - this doesnt work
> do I need to print anything before this first
> and do I need to set a response code???
You'll find that answer in the FAQ. Just type this at a
command line [on a system where Perl is installed]:
perldoc -q redirect
If that isn't clear enough, then the next thing for you to
do is to ask this in a newsgroup which focuses on CGI like
comp.infosystems.www.authoring.cgi where you can get a
host of relevant answers.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Sat, 13 Nov 1999 01:06:53 GMT
From: ShadeyGradey@linuxfreak.com (Slim)
Subject: Re: Need help with editing a word in a flat text file...
Message-Id: <382cb5bc.33767217@news.inet4u.com>
thanks, for the help"
see what I was trying to do was, let users add and change their info
in an .ini file to my FTP server, so I wouldn't have to do it by hand.
like an instant access script... I had already created the script
for adding the info, creating directories, and making it where the
same Username can't be added again for other users...
but I guess without being able to use the flock(FILE,2);
command on win95... that script's no good either"
-Slim-
------------------------------
Date: Fri, 12 Nov 1999 17:11:58 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Perl parseing
Message-Id: <382CBADE.AD188A09@mail.cor.epa.gov>
teknik2000@my-deja.com wrote:
>
> Many thanks to all for the solutions. It has helped immensely.
> I have one other question:
> How to split the sting "Alphabet|3_5" to extract the numbers (3 and 5)?
> How would you do the same if the string was "Alphabet|3_5_6"??
my @numbers = /\d+/g;
That's one way to do it. Or you could split on \D+
Try the following commands:
perldoc -f split
perldoc perlre
perldoc perlop
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 12 Nov 1999 15:06:00 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Perl Wizards
Message-Id: <382C9D58.E6E97DC7@mail.cor.epa.gov>
David H. Adler wrote:
>
> On Wed, 10 Nov 1999 16:55:16 -0800, David Cassell
> <cassell@mail.cor.epa.gov> wrote:
>
> >But I don't consider myself a Perl wizard. Just a satisfied
> >customer. Abigail, Larry, Uri, Damian... They're wizards.
>
> I'm a Perl Druid, if that's any help. :-)
I didn't mean to slight a fellow Member Of The Tribe, but
it seemed that adding what would look like my own first name
could be confusing, given the context. :-)
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 13 Nov 1999 01:03:57 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: printing a number with 3 digits
Message-Id: <slrn82pee6.eri.mgjv@wobbie.heliotrope.home>
On Fri, 12 Nov 1999 09:59:31 -0800,
kurumi <kurumi@3di.org> wrote:
> "G.Ananth Somayaji" wrote:
> >
> > I am trying to print a number so that it should always
> > have only 3 digits. For example 7 should be printed as 007. Looks
> > sort of a simple task but the solution has evaded me for a couple
> > of days now.
> >
> > Thanks in advance
> > Ananth
>
> Ouch. Were those billable hours?
>
> 2 days x 8 hours x US $200/hour / 1 LOC = US $3200/LOC [0]
No one who has to ask this question will be able to make US $200/hour
programming.
Martien
--
Martien Verbruggen |
Interactive Media Division | Failure is not an option. It comes
Commercial Dynamics Pty. Ltd. | bundled with your Microsoft product.
NSW, Australia |
------------------------------
Date: Fri, 12 Nov 1999 17:13:44 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: regular expression to parse html out-
Message-Id: <382CBB48.A0BE7F5C@mail.cor.epa.gov>
Simon Cozens wrote:
>
> vod (comp.lang.perl.misc):
> >Thanks a lot i wil check out the perldoc.
> >U see i had just learnt Perl and wasnt aware of "perldoc".
>
> OK; I'm not having a go - this is a serious question: what book
> did you use to learn Perl? if you could, I'd like the title and author.
>
> I'll tell you why I ask: A lot of people seem to be in your position,
> and I'm finding it annoying that whatever books or tutorials these people
> learnt from neglected to mention the documentation, the FAQ or perldoc.
> Countless man-hours and bandwidth could be saved here alone if these
> resources were pointed out by whatever references people `out there' are
> using.
Another reason why I liked Andrew Johnson's book "Elements of
Programming with Perl". He actually spends time explaining
how to read the FAQ, and where to find the docs, and how to
post here so as not to pi$$ people off.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 12 Nov 1999 23:58:59 GMT
From: edew@netcom.com (Eric Dew)
Subject: Re: Some more questions on modules' usage
Message-Id: <80i9k3$vqk$1@nntp2.atl.mindspring.net>
Thanks, I will try to implement some of these suggestions.
EDEW
------------------------------
Date: Fri, 12 Nov 1999 18:39:23 -0500
From: slinberg@crocker.com (Steve Linberg)
Subject: Re: Time
Message-Id: <slinberg-1211991839230001@bsg-ma2d-179.ix.netcom.com>
In article <382C997A.37F84B90@wix.dk>, Christian Wix <christian@wix.dk> wrote:
> Hi
> I have a web server in another time zone than I. I want to convert the
> time and date 6 hours forward. How do I do that very easy?
> ($sec,$min,$hour,$mday,$mon,$year,$wday) =
> (localtime(time))[0,1,2,3,4,5,6];
How about:
(localtime(time+6*60*60))[0..6];
------------------------------
Date: Fri, 12 Nov 1999 17:30:38 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Time
Message-Id: <382CBF3E.9A75AF0@mail.cor.epa.gov>
Steve Linberg wrote:
>
> In article <382C997A.37F84B90@wix.dk>, Christian Wix <christian@wix.dk> wrote:
>
> > Hi
> > I have a web server in another time zone than I. I want to convert the
> > time and date 6 hours forward. How do I do that very easy?
>
> > ($sec,$min,$hour,$mday,$mon,$year,$wday) =
> > (localtime(time))[0,1,2,3,4,5,6];
>
> How about:
>
> (localtime(time+6*60*60))[0..6];
Of course, Steve knows that this does not handle timezone
differences at times when Daylight Savings Time is changing
in one or both places. Decide whether you need to address
such features.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 12 Nov 1999 16:35:59 -0500
From: Dan Zerkle <dzerkle@us.ibm.com>
Subject: Re: Using Oracle DB's
Message-Id: <382C883F.2A9E46B0@us.ibm.com>
Andrew Longworth wrote:
>
> I wish to connect to an oracle db.... I know this can be done in perl but
> how can I find out more. Can anyone shed any light on this for me??
You use the DBI module with the DBD:Oracle module. These are available
on CPAN.
There's a nice tutorial on this topic at www.perl.com. Unfortunately,
their Web site seems to be down at the moment, but try
http://www.perl.com/pub/1999/10/DBI.html when it comes back up.
------------------------------
Date: Fri, 12 Nov 1999 15:54:13 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Weekday in perl
Message-Id: <MPG.129648815c826cb498a1ec@nntp.hpl.hp.com>
In article <382c8369.5444336@news.idt.net> on Fri, 12 Nov 1999 21:21:37
GMT, Viscano <kc@disinfo.net> says...
+ Probably a faster way to do it..but...
+
+ use Time::Local;
+
+ sub weekday
+ {
+ # Determine epoch seconds for current day
+ my($d, $m, $y) = (localtime)[3..5];
+ $epoch_seconds = timelocal(0, 0, 0, $d, $m, $y);
+
+ $date = scalar(localtime($epoch_seconds));
+ @datemembers = split(/ /, $date);
+
+ $xweekday = $datemembers[0];
+
+ return $weekday;
+ }
+
+ That will give you the current day of the week in three letter form,
+ ie: Mon, Tue, Wed, etc....
+
+ for any other date....just set the $d $m $y variables to the specific
+ values.
It is somewhat irresponsible to post code that has typos that would have
been caught by '-w' and 'use strict;'. You have $xweekday and then
$weekday.
But in general, you have a problem with code bloat. The last four lines
of code in your subroutine (from '$date =' on) do nothing more than
this:
substr localtime $epoch_seconds, 0, 3
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 13 Nov 1999 01:08:36 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: Weekday in perl
Message-Id: <slrn82pemu.eri.mgjv@wobbie.heliotrope.home>
On Fri, 12 Nov 1999 15:54:13 -0800,
Larry Rosler <lr@hpl.hp.com> wrote:
> In article <382c8369.5444336@news.idt.net> on Fri, 12 Nov 1999 21:21:37
> GMT, Viscano <kc@disinfo.net> says...
> + Probably a faster way to do it..but...
[snip code]
> + That will give you the current day of the week in three letter form,
> + ie: Mon, Tue, Wed, etc....
> But in general, you have a problem with code bloat. The last four lines
> of code in your subroutine (from '$date =' on) do nothing more than
> this:
>
> substr localtime $epoch_seconds, 0, 3
And the whole thing really doesn't do much more than
use POSIX;
print strftime "%a", localtime;
Martien
--
Martien Verbruggen |
Interactive Media Division | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd. | make up 3/4 of the population.
NSW, Australia |
------------------------------
Date: Fri, 12 Nov 1999 20:24:52 -0500
From: "Ganeshan, Suresh [CAR:7H14:EXCH]" <suganesh@americasm01.nt.com>
Subject: Re: Where can I find ?
Message-Id: <382CBDE3.4E3705FB@americasm01.nt.com>
Hello Andrew,
Thanks for the respond.
I want to keep record of some kind of personal informations about
subscribers so that they can login and access their file.
I want to give access to only the subscribers, give a user name and
password. Like hotmail.
Regards,
Suresh
Andrew Broadley wrote:
>
> What kind of database, and how do you want it interagted into the web ?
>
> "Ganeshan, Suresh [CAR:7H14:EXCH]" wrote:
>
> > Hello,
> >
> > I am planning to setup a web base interface to my database. Since I am
> > highly concerned about the security issues associated with it, I am
> > thinking to hire some professional to write a code for me.
> >
> > Is there any people where I can get help or any web sites you
> > recommended?
> >
> > Or would it be better for me to write my own code?
> >
> > Beside, I still not clear which language is best suited?
> >
> > I will appreciate your help?
> >
> > Thanks,
> > Suresh
>
------------------------------
Date: Sat, 13 Nov 1999 00:31:20 +0100
From: "Chris Kuhi" <christopher.kuhi@stud.uni-muenchen.de>
Subject: Re: Why does print only prints to STDOUT when
Message-Id: <80i84e$ssi$1@sparcserver.lrz-muenchen.de>
>&run( "perl $my_other_perl $arg1 $arg2", "$logfile", "a message");
>
>sub run {
>my( $test, $log_file, $title ) = @_;
>my($result) = system("$cmd > $log_file");
Where does $cmd come from? Is it a global you haven't mentioned? If not,
running your script with a '-w' will point out uninitialized variables...
Chris
------------------------------
Date: Sat, 13 Nov 1999 00:31:20 +0100
From: "Chris Kuhi" <christopher.kuhi@stud.uni-muenchen.de>
Subject: Re: Why does print only prints to STDOUT when
Message-Id: <80i7vv$sra$1@sparcserver.lrz-muenchen.de>
>&run( "perl $my_other_perl $arg1 $arg2", "$logfile", "a message");
>
>sub run {
>my( $test, $log_file, $title ) = @_;
>my($result) = system("$cmd > $log_file");
Where does $cmd come from? Is it a global you haven't mentioned? If not,
running your script with a '-w' will point out uninitialized variables...
Chris
------------------------------
Date: Sat, 13 Nov 1999 00:31:20 +0100
From: "Chris Kuhi" <christopher.kuhi@stud.uni-muenchen.de>
Subject: Re: Why does print only prints to STDOUT when
Message-Id: <80i87m$ssr$1@sparcserver.lrz-muenchen.de>
>&run( "perl $my_other_perl $arg1 $arg2", "$logfile", "a message");
>
>sub run {
>my( $test, $log_file, $title ) = @_;
>my($result) = system("$cmd > $log_file");
Where does $cmd come from? Is it a global you haven't mentioned? If not,
running your script with a '-w' will point out uninitialized variables...
Chris
------------------------------
Date: Fri, 12 Nov 1999 17:28:32 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Why does print only prints to STDOUT when
Message-Id: <382CBEC0.1A2B7B49@mail.cor.epa.gov>
mirranda@my-deja.com wrote:
>
> Kragen,
>
> inside my test.pl:
>
> &run( "perl $my_other_perl $arg1 $arg2", "$logfile", "a message");
>
> sub run {
> my( $test, $log_file, $title ) = @_;
> my($result) = system("$cmd > $log_file");
> .
> }
>
> in "my_otherperl" script I call a foo.exe which has print statemnts too.
> I get the print statements from the foo.exe in the log file but not the
> ones from "my_otherperl.pl"
Hmmm. Let me see. The unreliable PSI::ESP module suggests
to me that you're trying this on a win32 box. You should be
aware that redirection (that '>' in your system() statement)
and pipes are broken in win9x, and must be treated with care
in WinNT. Instead of using system() to run another copy
of Perl to get that redirection, just do it by hand and make
that second program open() your $logfile, print() to it,
and close() it. With appropriate error-checking, of course.
It really looks to me like you're going about this the
hard way. You can probably get this to work without having
to system() another copy of Perl into existence.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 12 Nov 1999 20:28:19 -0500
From: Lisa Friedland <lfriedl@genome.wi.mit.edu>
Subject: Re: Why does print only prints to STDOUT when
Message-Id: <382CBEB3.33FF4E54@genome.wi.mit.edu>
> in "my_otherperl" script I call a foo.exe which has print statemnts too.
> I get the print statements from the foo.exe in the log file but not the
> ones from "my_otherperl.pl"
One suggestion for tracking down the problem: set $| = 1 in
my_otherperl. This lets you see the output immediately; otherwise
sometimes my_otherperl's print statements get buffered and foo's get
printed first (and then maybe my_otherperl dies before you see its
statements?).
I assume you haven't, say, redirected stdout or selected another stream
anywhere?
-Lisa
------------------------------
Date: Sat, 13 Nov 1999 00:25:00 GMT
From: "Crawfishy" <cans1@hotmail.com>
Subject: Re: Writing data to file on another server.
Message-Id: <01bf2d65$ae4d1fa0$c834d8c0@default>
OK, that's all fine and dandy but... I would consider myself a novice perl
programmer...
I will research your suggestions but I do a lot better when I have sample
code to examine and tear apart. Any suggestions???
George
------------------------------
Date: Fri, 12 Nov 1999 16:39:54 -0800
From: Bill Moseley <moseley@best.com>
Subject: Re: Writing data to file on another server.
Message-Id: <MPG.12965330a909551989866@nntp1.ba.best.com>
Crawfishy (cans1@hotmail.com) seems to say...
> OK, that's all fine and dandy but... I would consider myself a novice perl
> programmer...
> I will research your suggestions but I do a lot better when I have sample
> code to examine and tear apart. Any suggestions???
Type at a prompt near you:
perldoc LWP
perldoc lwpcook
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Fri, 12 Nov 1999 17:03:58 -0800
From: mbudash@wcws.com (Michael Budash)
Subject: Re: Writing data to file on another server.
Message-Id: <mbudash-1211991703580001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>
In article <01bf2d65$ae4d1fa0$c834d8c0@default>, "Crawfishy"
<cans1@hotmail.com> wrote:
> OK, that's all fine and dandy but... I would consider myself a novice perl
> programmer...
> I will research your suggestions but I do a lot better when I have sample
> code to examine and tear apart. Any suggestions???
> George
you might try going to tpj.com and doing a search on lwp...
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@wcws.com
------------------------------
Date: Fri, 12 Nov 1999 17:32:02 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Writing data to file on another server.
Message-Id: <382CBF92.866CC79@mail.cor.epa.gov>
Crawfishy wrote:
>
> OK, that's all fine and dandy but... I would consider myself a novice perl
> programmer...
> I will research your suggestions but I do a lot better when I have sample
> code to examine and tear apart. Any suggestions???
> George
Start with:
perldoc LWP
perldoc lwpcook
and then look at the examples in the Perl Cookbook.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 1365
**************************************