[18756] in Perl-Users-Digest
Perl-Users Digest, Issue: 924 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 17 14:05:42 2001
Date: Thu, 17 May 2001 11:05:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <990122713-v10-i924@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 17 May 2001 Volume: 10 Number: 924
Today's topics:
[OT] Prague.pm - Prague Perl Mongers just started <Jenda@Krynicky.cz>
Re: An Example Of A Polite FAQ <godzilla@stomp.stomp.tokyo>
Re: An Example Of A Polite FAQ <flavell@mail.cern.ch>
Re: An Example Of A Polite FAQ <godzilla@stomp.stomp.tokyo>
Re: An Example Of A Polite FAQ <me@my_no_spam.org>
Re: An Example Of A Polite FAQ (Tad McClellan)
Re: An Example Of A Polite FAQ <gerard@NOSPAMlanois.com>
Re: An Example Of A Polite FAQ <Jenda@Krynicky.cz>
Re: An Example Of A Polite FAQ <godzilla@stomp.stomp.tokyo>
Building ActivePerl under Win9x (Ian Dash)
Re: Building ActivePerl under Win9x <randy@theoryx5.uwinnipeg.ca>
Re: check if file exists with different extensions <real@earthling.net>
Re: check if file exists with different extensions <nospam@peng.nl>
Re: check if file exists with different extensions <pne-news-20001517@newton.digitalspace.net>
Re: Connecting to MS Access with an Apache Server??? <cpryce@pryce.net>
Curious Newbie asks a question <Sinema_BTVS@SPAM-hotmail.com>
Re: Excluding certain output variables? (Tad McClellan)
Re: Filehandling, opening & Reopnening <alexis.roda@si.urv.es>
Re: Filehandling, opening & Reopnening <christoph.neubauer@siemens.at>
Re: Filehandling, opening & Reopnening <peb@bms.umist.ac.uk>
Re: Filehandling, opening & Reopnening <bart.lateur@skynet.be>
Re: Hex values (Mark Jason Dominus)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 17 May 2001 18:02:15 GMT
From: Jenda Krynicky <Jenda@Krynicky.cz>
Subject: [OT] Prague.pm - Prague Perl Mongers just started
Message-Id: <1107_990122535@JENDA>
[Sorry for the slightly off-topic post.]
No need to say much.
If you are in Prague, Czech rep. and fiddle with Perl you might want to talk to your friends who are similarily inflicted.
See http://prague.pm.org and http://www.pm.org
Jenda
============================== Czech version follows
Neni treba to rozvadet.
Pokud jste v Praze a hrajete si s Perlem tak si urcite radi pokecate s jinymi stejne postizenymi lidmy.
http://prague.pm.org and http://www.pm.org
Jenda
------------------------------
Date: Thu, 17 May 2001 09:07:54 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: An Example Of A Polite FAQ
Message-Id: <3B03F75A.54DDADA2@stomp.stomp.tokyo>
Dave VP wrote:
> "Godzilla!" wrote:
(snippage here and there)
> > 1b. Check the other standard Perl docs (*.pod)
> > (possible examples of using the Perl search feature)
> Yes! Having some concrete examples in these sections would be very
> helpful to the uninitiated. Maybe the first suggestion should be
> perldoc perlfaq
> I find it amazing how many folks don't know that they can do something
> as simple as this. Well, I guess there's always going to be those who
> don't read the READMEs/Release Notes/INTROs.
Well, ahem... know anyone who doesn't follow instructions
until they absolute must? Heh! Few read those instructions
about inserting tab A into slot B. However, few read Chinese,
least around here. Times are changing. Those instructions
were once written in Japanese and, just as unread.
> We must try to remember that one must *learn* to be an effective reader
> (user) of FAQs, docs, etc. Until one learns how to properly phrase the
> question to be asked, FAQ checking generally returns less than
> satisfactory results. Giving new posters a few concrete examples may
> get them on the right track.
I've given thought to suggesting periodic postings of articles
which "teach" people how to use all these features of Perl many
don't know about. When I first started, I experienced a lot of
difficulty figuring out "how" to make these features work. There
is a problem with actual instructions and syntax usage. How to go
about using these features, the actual instructions, are not
all that well written; they address more advanced users.
Providing some help with simple step-by-step examples would be
of great help for all of us, especially those just beginning.
Perl is not known for having easy-to-read documentation.
> Kira, this draft is an excellent reworking and it's great to see you
> taking a lead in such a positive direction.
* boggled *
I am not taking a lead. I am offering suggestions in the
spirit of cooperation, which is a normal expectation of
all participants. An unspoken rule is we have dues to pay
in exchange for the privilage of using this newsgroup.
Perhaps your perspective is changing. I sure ain't! I am
the same as I always have been; mule headed stubborn.
Ray Bradbury is a master of creating paradoxes of reality,
which is obviously a matter of personal perspective. In his
book, The Martian Chronicles, his main character finally
has his wish fulfilled; he meets a Martian. However, this
Martian appears to be a ghost. Dialog ensues, passing of
hands through each other takes place and the Martian says,
in response to being labeled a ghost,
"No, you are the ghost."
Each has a perspective, the other is a ghost. We the reader,
we the observers, are presented with a true reality paradox.
Which is truly the ghost? Neither is.
There are times, taking off those rose colored glasses,
can be intimidating but refreshing.
Godzilla!
------------------------------
Date: Thu, 17 May 2001 17:48:00 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: An Example Of A Polite FAQ
Message-Id: <Pine.LNX.4.30.0105171733110.12021-100000@lxplus003.cern.ch>
On Thu, 17 May 2001, Dave VP wrote:
> Maybe the first suggestion should be
>
> perldoc perlfaq
Except that too many people evidently have no idea what to do with
that recipe, and when told to type it into a shell window, come right
back with "what's a shell window?".
> We must try to remember that one must *learn* to be an effective reader
> (user) of FAQs, docs, etc. Until one learns how to properly phrase the
> question to be asked,
This is perfectly true, and each of us comes with a different set of
previous experiences, assumptions and prejudices. But the key feature
of Tad's draft is not to be a finely detailed solution that satisfies
each and every one of them - but rather, to be a succint "rules of
engagement" briefing to help them to make best use of the resources
that are there, no matter what their background may be.
> FAQ checking generally returns less than
> satisfactory results. Giving new posters a few concrete examples may
> get them on the right track.
If I may express an opinion, there is really NO substitute for
actually browsing the entire FAQs as a preliminary, just so that one
gets an idea of what's there, how they are laid out, and to get a clue
about how to use them. I originally printed them out as bedtime
reading or while lying in a nice warm bath - not to learn them by
rote, but just to familiarise myself with what's there and how it's
organised.
Waiting until one has a specific programming question, and using that
question as a lever for one's first encounter with the FAQs and other
Perl documentation, is simply too late in the proceedings. Just as
lurching into the Perl group totally unprepared, blurting out "help,
it doesn't work", is far too early.
------------------------------
Date: Thu, 17 May 2001 10:07:33 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: An Example Of A Polite FAQ
Message-Id: <3B040555.6E52E9BA@stomp.stomp.tokyo>
Dave VP wrote:
> "Godzilla!" wrote:
(significant snippage)
> > (possible examples of using the Perl search feature)
> Yes! Having some concrete examples in these sections would be very
> helpful to the uninitiated. Maybe the first suggestion should be
> perldoc perlfaq
I've elected to treat this as a unique topic.
In a parallel article, I mention a problem with difficulties
in following instructions and, suggest simple step-by-step
instructions for examples. Here is a clear problem which
is not clear at all.
At your command line prompt type in:
perldoc perlfaq
Press your enter key:
Lots of documentation appears!
This example is sorely lacking. A person may not know a requirement
is to change to a directory within or under your Perl install directory.
My example also lacks qualification of a command line prompt; is it
a unix prompt, a dos prompt or other?
I become annoyed with documentation which simply states, "%"
for a command line prompt. What the heck is that?
**
If you are on a Win32 system, open a DOS window,
(instructions)
In your DOS window, at your command line prompt, C:\Windows
type in:
cd c:\path\to\perl\execute\directory
press ENTER
type in:
perldoc perlfaq
press ENTER
Lots of documentation!
**
Another problem with instructions, are switches.
Suggesting, " perldoc -f somefunction " is very
confusing. What does " -f " mean?
**
Many switches are avaiable for use. A switch is nothing
more than an abbreviation for an instruction. For example,
perldoc -f reset
This means, in Plain English,
"Look in Perl Documentation, FIND information on the reset function."
This switch, -f , simply means "Find."
Read about and research switches available for use to better
understand how to use them.
**
As a teacher, with each beginning of a new quarter, one of my
first objectives is to test all my students and set a personalized
baseline knowledge level, for each and every student, all two-hundred
or so passing through my classroom daily. Within my attendance book,
I add coded comments next to a name. One of those codes indicates
the relative knowledge level of a student, a comparison based on
the average knowledge of all students within a specific class.
I memorize this knowledge level rating by student name and, if I
cannot remember, it is right there in my book for quick reference.
Doing this affords me an ability to "speak at a language level" which
is customized for each student. For a student who is very keen, for
one-on-one dialog, my language level is high. For lower abilities,
I adjust my language level downward. This affords each student a
chance to understand at his or her own skill level.
When addressing a class as a whole, like during lectures, I use
a language level aimed at the "average" skill level of a given
class. This presents the best chances for understanding by all.
Few realize how much talent is required to be a good teacher.
It is a very challenging occupation.
As to this FAQ being developed, it would be prudent to set examples
which speak at a knowledge level reflecting the average for those
relatively new to Perl. It would be prudent to provide instructions
which are more informative than what we, as more experienced people,
would expect.
This is why I have entertained a thought of suggesting periodic
postings of instructions on how to use Perl faq functions, as
documents separate from the actual FAQ for this group. The FAQ
could provide one or two quick examples, then provide links
to documents with more detailed instructions.
Godzilla!
------------------------------
Date: Thu, 17 May 2001 12:54:14 -0400
From: Dave VP <me@my_no_spam.org>
Subject: Re: An Example Of A Polite FAQ
Message-Id: <3B040236.11C5853A@my_no_spam.org>
"Alan J. Flavell" wrote:
>
[ snip ]
> If I may express an opinion, there is really NO substitute for
> actually browsing the entire FAQs as a preliminary, just so that one
> gets an idea of what's there, how they are laid out, and to get a clue
> about how to use them. I originally printed them out as bedtime
> reading or while lying in a nice warm bath - not to learn them by
> rote, but just to familiarise myself with what's there and how it's
> organised.
>
> Waiting until one has a specific programming question, and using that
> question as a lever for one's first encounter with the FAQs and other
> Perl documentation, is simply too late in the proceedings. Just as
> lurching into the Perl group totally unprepared, blurting out "help,
> it doesn't work", is far too early.
In complete agreement with you. I thought I was the *only* person who
actually *liked* reading docs -- **before** anything went wrong ;-)
------------------------------
Date: Thu, 17 May 2001 12:18:20 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: An Example Of A Polite FAQ
Message-Id: <slrn9g7uec.qbc.tadmc@tadmc26.august.net>
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>Dave VP wrote:
>> "Godzilla!" wrote:
>> Kira, this draft is an excellent reworking
Indeed it is! I plan to borrow heavily from it, ripping out my words
wholesale at times.
>> and it's great to see you
>> taking a lead in such a positive direction.
>
>* boggled *
I expect the root of this thread dominoed boggles in wild profusion!
I know I had/have one.
>I am not taking a lead. I am offering suggestions in the
>spirit of cooperation, which is a normal expectation of
>all participants. An unspoken rule is we have dues to pay
>in exchange for the privilage of using this newsgroup.
Thank you for contributing it.
>Perhaps your perspective is changing. I sure ain't! I am
>the same as I always have been; mule headed stubborn.
I guess I'll have to switch back to manual filtering for a
period of time then, given my change in perlspective. :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 17 May 2001 10:44:55 -0700
From: Gerard Lanois <gerard@NOSPAMlanois.com>
Subject: Re: An Example Of A Polite FAQ
Message-Id: <uk83fna3s.fsf@NOSPAMlanois.com>
"Godzilla!" <godzilla@stomp.stomp.tokyo> writes:
> 3. Social faux pas to avoid
>
> 3a. Asking a Frequently Asked Question
> 3b. Asking a question easily answered by a cursory doc search
> 3c. Asking for emailed answers
> 3d. Getting along with others
3e. Job Offerings
...are heavily frowned upon in this newsgroup.
3f. Homework
...requests are usually easily spotted, especially
when coming from a .edu domain (hint: get a hotmail
account).
-Gerard
http://www.lanois.com/perl/
------------------------------
Date: Thu, 17 May 2001 17:43:44 GMT
From: Jenda Krynicky <Jenda@Krynicky.cz>
Subject: Re: An Example Of A Polite FAQ
Message-Id: <1106_990121424@JENDA>
On Thu, 17 May 2001 07:25:20 -0700, "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> Dave VP wrote:
>
> > "Godzilla!" wrote:
> > > Bart Lateur wrote:
> > > > Godzilla! wrote:
>
> > > > >Welcome to comp.lang.perl.misc newsgroup!
>
> (snipped)
>
> > I would encourage a reworking of the sentence beginning "You are an
> > adult....", as it is apparent that minors also participate in the group.
>
> "You are a mature responsible person...."
>
> There are many ways to impart a message without running
> into these problems of sounding condescending or causing
> a segregation based on age, background knowledge and
> the such.
>
> Diplomacy is of utmost importance and, proves the
> hardest talent of all to master.
Oh sh*t, political correctness rears its ugly head ...
I seriously doubt any youngster would be offended if you called him/her "adult".
Unless seriously brainwashed.
Jenda
------------------------------
Date: Thu, 17 May 2001 10:47:18 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: An Example Of A Polite FAQ
Message-Id: <3B040EA6.8B4AE5F3@stomp.stomp.tokyo>
Tad McClellan wrote:
> Godzilla! wrote:
> > Dave VP wrote:
> >> Godzilla! wrote:
> >> Kira, this draft is an excellent reworking
> Indeed it is! I plan to borrow heavily from it, ripping out my words
> wholesale at times.
(snipped)
Be sure you understand a few items. I do not expect to be
credited in any form or fashion. You are writing this
document and are entitled for full credit. Use anything
you deem fit from my rewrite and claim it as your own.
Care should be taken to closely examine any wording of
mine which is used. I know there are grammar and spelling
errors in there somewhere. This is why we have editors
to catch what we cannot see, as an author or, authoress.
After all my bitching about the overall tone of the
original document, it is only fitting I offer some
alternatives lest I be considered a member of the
annoying peanut gallery. When I bitch about something,
I am inherently subject to our rule, "Put Up Or Shutup."
This seems in keeping with my personal style of being,
"Firm but fair."
As a barefoot, penniless and ignorant farm girl, one
of my uncles, somewhat older but not much, being a
real prankster, told me, after watching me struggle
to harness a mule at least forty hands taller than
myself, "Kira, yall done need to take a big stick
to that thar mule. Give 'em a right quick smack
between the eyes to git his attention."
Purely by coincidence, he held a stick and offered it.
I did and nearly ended up trampled to death. However,
this is a common event when working with mules. You
get use to it. I am not sure my uncle became use to all
these switchings Grandpa gave him. Nonetheless, today
my uncle is a successful multi-millionaire businessman.
If I smack you between the eyes, it is to attain
your undivided attention. I do expect to be trampled
by the mules here. I am use to this.
You should also note, if I take a big stick to you,
it might very well be simply because you piss me off.
Godzilla!
------------------------------
Date: 17 May 2001 17:16:48 GMT
From: I.J.Dash@cs.cf.ac.uk (Ian Dash)
Subject: Building ActivePerl under Win9x
Message-Id: <9e1120$gkr7$1@ID-90042.news.dfncis.de>
Hi,
has anyone actually managed to build ActivePerl under Win9x? I
installed dmake and tried many times (even having tried a couple of
different command shells, cygwin & 4DOS and trying nmake/dmake), but it
bombs out telling me that something somewhere has passed too many
parameters to something :-(.
I'm trying (with not much success /:-| ) to build ActivePerl build 626,
using MS Visual C++ 5.0 Enterprise Edition. I would really like to get
this to work - as I can't build extensions under the binary release of
626 that Activestate give out, unfortunately they've used VC6.0 and the
.lib file structure has changed so I can't link in perl56.lib!!
Any help would be much appreciated :-)
=Ian=
------------------------------
Date: 17 May 2001 17:34:22 GMT
From: Randy Kobes <randy@theoryx5.uwinnipeg.ca>
Subject: Re: Building ActivePerl under Win9x
Message-Id: <9e122u$ac4$1@canopus.cc.umanitoba.ca>
In comp.lang.perl.misc, Ian Dash <I.J.Dash@cs.cf.ac.uk> wrote:
> Hi,
> has anyone actually managed to build ActivePerl under Win9x? I
> installed dmake and tried many times (even having tried a couple of
> different command shells, cygwin & 4DOS and trying nmake/dmake), but it
> bombs out telling me that something somewhere has passed too many
> parameters to something :-(.
> I'm trying (with not much success /:-| ) to build ActivePerl build 626,
> using MS Visual C++ 5.0 Enterprise Edition. I would really like to get
> this to work - as I can't build extensions under the binary release of
> 626 that Activestate give out, unfortunately they've used VC6.0 and the
> .lib file structure has changed so I can't link in perl56.lib!!
I've gotten it to build on Win98 with VC++ 6 and nmake - I'm not
sure how it would be with VC++ 5, but here's what I had to do:
- in ExtUtils\MM_Unix.pm and ExtUtils\MM_Win32.pm, deleted
all occurrences of the redirection '2>&1',
- in ExtUtils\MM_Unix.pm, changed (around line 3319)
######################################################
# XXX: dmake-specific, like rest of Win95 port
return <<EOT;
subdirs ::
@[
cd $subdir
\$(MAKE) all \$(PASTHRU)
cd ..
]
EOT
######################################################
to
######################################################
# XXX: dmake-specific, like rest of Win95 port
return <<EOT;
subdirs ::
cd $subdir
\$(MAKE) all \$(PASTHRU)
cd ..
EOT
######################################################
With these perl-5.6.1 built successfully, but didn't pass
all the tests. However, I haven't noticed any real problems
with this perl beyond the basic limitations on Win9?.
best regards,
randy kobes
------------------------------
Date: Thu, 17 May 2001 17:11:40 +0200
From: "Real" <real@earthling.net>
Subject: Re: check if file exists with different extensions
Message-Id: <9e0png$fv6$1@news.surfnet.nl>
"Lex" <nospam@peng.nl> wrote in message
news:ApPM6.143329$Uo2.3806444@zwoll1.home.nl...
> question:
>
> I have a perlscript that checks if a certain file exists, if so, it is
shown
> on a web page.
> The code I'm using is:
>
> my $sourcefile = $rec{'ID'} ."a.gif";
> my $thumbfile =
> '/usr/home/lex/htdocs/btsbos.nl/portfolio/fotos/'.$sourcefile;
>
> if (-e $thumbfile) {
> print qq|
> <td><img
src="http://www.peng.nl/btsbos.nl/portfolio/fotos/$rec{'ID'}a.gif"
> alt="" border="0">
> </td>
> |;
> }
>
>
> Now this works fine, but i'd like to change something.
>
> It only works fine if the image has the extension .gif .
> I would like it to work no matter if it is a .jpg .jpeg .gif .png (or all
> those in capitals)
>
> I don't know how to accomplish this.
You could use opendir() and readdir() to get a list of files and use grep()
to check if a file exists. Using a sub-routine, you could then return the
first occurrence found.
Another, easier to code, method is using a sub-routine which will just try
to find a file using multiple extention. Basically, you just step through
the list of extention and perform a "if (-e ...). Here's some code;
#!/usr/local/bin/perl
sub Find_File
{
# Usage: Find_File <location> <name> <extention ...>
my($location, $name, @Exts) = @_;
foreach (@Exts) {
if (-e "$location/$name.$_") { return("$location", "$name.$_"); }
}
return;
}
($found_path, $found_name) = Find_File('./', 'name', 'gif','png','jpg');
print "Found: ", $found_name, " in ", $found_path, "\n";
Bye,
Real
------------------------------
Date: Thu, 17 May 2001 15:18:46 GMT
From: "Lex" <nospam@peng.nl>
Subject: Re: check if file exists with different extensions
Message-Id: <qZRM6.144451$Uo2.3814322@zwoll1.home.nl>
Thanks to all of you!
I am now using this code:
my $fotodir = '/usr/home/lex/htdocs/btsbos.nl/portfolio/fotos';
my $fotodirurl = 'http://www.peng.nl/btsbos.nl/portfolio/fotos';
opendir(FOTOS, $fotodir) or die "could not open '$fotodir' directory $!";
foreach my $file ( grep
/^$rec{ID}a\.(jpg|jpeg|gif|png|JPG|JPEG|GIF|PNG)$/i, readdir FOTOS ) {
print "<td valign='top' align='center'><img src='$fotodirurl/$file'
border='0'></td>\n";
}
closedir(FOTOS);
as in this case there can be only 1 $rec{ID}a.something this works just
fine!
Thanks for all the answers, it's great to see so many people like to help
out!
Lex
------------------------------
Date: Thu, 17 May 2001 18:15:47 +0200
From: Philip Newton <pne-news-20001517@newton.digitalspace.net>
Subject: Re: check if file exists with different extensions
Message-Id: <88u7gtg0h2v4f3k2png8mi2bs0odhqac68@4ax.com>
On Thu, 17 May 2001 15:18:46 GMT, "Lex" <nospam@peng.nl> wrote:
> /^$rec{ID}a\.(jpg|jpeg|gif|png|JPG|JPEG|GIF|PNG)$/i
If you're going to use the /i switch, why do you include both jpg and
JPG, both gif and GIF, etc.?
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Thu, 17 May 2001 11:26:13 -0500
From: Chris <cpryce@pryce.net>
Subject: Re: Connecting to MS Access with an Apache Server???
Message-Id: <B72965D5.557F%cpryce@pryce.net>
in article v0n7gt8ro4h5b0pua3t7771ultge8vb7q9@4ax.com, Bart Lateur at
bart.lateur@skynet.be wrote on 05/17/2001 9:10 AM:
> The guy justed wanted to OPEN an Access file on a Solaris box. He
> doesn't have Access running on a connected Windows machine.
>
> --
> Bart.
Uh.. No. If you read the post carefully [1], he wanted to connect to an MS
Access database running on a Windows machine. Using, we assume, a Unix/Linux
flavor. He then gave an example of a connection script in Perl, which
produced and error.
After you told him that connecting to an MS Access database wasn't possible
from a Unix/Linux machine, I gently corrected, saying that it was possible
to make the connection, and gave a reason why he might be getting the error
message.
I meant nothing personal, your original advice was simply incorrect, and it
did not answer the question, which was - paraphrased - "why does this code
fragment produce an error."
cp
[1] in article 9duv5t$ajf$1@news.xmission.com, Ryan at ryan@tuitions.com
wrote on 05/16/2001 5:36 PM:
> Our web site is running on an remote apache server and we have a MS access
> database that we would like copy up to a directory and to be able to simply
> exctract information from and show it in an HTML format. Here is the start
> of my code.
>
> #!/usr/bin/perl
> use DBI;
> $dbh = DBI->connect("dbi:ODBC:'driver=Microsoft Access Driver (*.mdb);
> dbq=major.mdb'",'','');
> #do stuff...
> $dbh->disconnect;
>
> Im having trouble connecting to our database I keep getting this error:
------------------------------
Date: Thu, 17 May 2001 12:22:25 -0500
From: "Sinema" <Sinema_BTVS@SPAM-hotmail.com>
Subject: Curious Newbie asks a question
Message-Id: <1NTM6.2292$OS1.441314@news1.iquest.net>
It seems no one knows how to do this.. ( well not sure If I posted here as
of yet )
I'm wanting to find a cgi script that will allow users to register from one
area instead of having to register in each of the areas provided on my
website.
I was told to make one and add some line to the bottom but I'm a novice I
have no idea what that means and then I heard that I should try Javascript
and then I didn't think that would work because if there was an error it
would cause a huge mess
( like if a nick name is not available in that area )
I'm totally lost .. I even thought that maybe there was a way to make check
boxes and let the user register in the areas they wish .. but again no clue
how to do that either lol
Any help would be great
--
Regards
Sinema - Sinema_BTVS@SPAM-hotmail.com
< remove SPAM- to reply >
--- Start Codex Buffy Code 0.1 -------------------------------------
ECa S+++(S++)>S+ O! M+++(M+)>M P B* G(G-) W+(W)>W-- X! C* A+++ Z!
--- End Codex Buffy Code --- http://www.planetx.com/buffy/code/ ----
------------------------------
Date: Thu, 17 May 2001 10:21:24 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Excluding certain output variables?
Message-Id: <slrn9g7nj4.q33.tadmc@tadmc26.august.net>
Clinton A. Pierce <clintp@budman.roalok1.mi.home.com> wrote:
> next if (/^UNIQUE_USER_ID|REDIRECT_UNIQUE_ID|REDIRECT_USER_NAME$/);
^^ ^^
You need some parenthesis there.
I left them out in a post a few days ago, and nobull caught it.
My turn! :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 17 May 2001 17:15:42 +0200
From: Alexis Roda <alexis.roda@si.urv.es>
Subject: Re: Filehandling, opening & Reopnening
Message-Id: <3B03EB1E.FD673ED1@si.urv.es>
Mika Morell wrote:
>
> Hi.
>
> This is kind of anewbie question, first time for perl. I need to reread
> the same file 18 times, is there a way to not having to open and close
> it 18 times. With this layout of the script it only reads the file
> once. And if I move the opening/closing of LOGFILE inside the for loop
> it takes forever. The important part of the script looks like this:
>
> open (LOGFILE,"$tmplog") || die "YOu killed kenny!!! YOu Bastard\n";
> for ($i = 1 ; $i <=$total; $i++) {
> open (OUTFILE,">>$outpath/$hosts[$nuffra].log.txt");
> while (<LOGFILE>){
> if (/\ $hosts[$nuffra]\ /) {
> print OUTFILE ("$_");
> }
> }
> close OUTFILE|| die " Someone is bakin brownies\n";
> $nuffra++;
> }
look for seek in the perlfunc man page. Alternatively write the script
this way:
open logfile
foreach line in logfile do
foreach pattern in patternlist do
if (pattern matches line) do_something
end
end
close logfile
so you open logfile only once.
HTH
--
////
(@ @)
---------------------------oOO----(_)----OOo------------------------
Los pecados de los tres mundos desapareceran conmigo.
Alexis Roda - Universitat Rovira i Virgili - Reus, Tarragona (Spain)
--------------------------------------------------------------------
------------------------------
Date: Thu, 17 May 2001 17:30:49 +0200
From: Christoph Neubauer <christoph.neubauer@siemens.at>
Subject: Re: Filehandling, opening & Reopnening
Message-Id: <3B03EEA8.C25498BF@siemens.at>
If your logfile is not too big (real Perl professionals can tell you
numbers),
you could try a structure like this:
open (LOGFILE, "...") || die "...";
my @loglist = <LOGFILE>;
# close LOGFILE;
for ($i = 1 ; $i <=$total; $i++) {
open (OUTFILE,">> ...");
foreach $line (@loglist) {
# whatever you want to do with $line
};
# close OUTFILE;
$nuffra++;
};
Not closing the filehandles (if it's not really neccessary) saves some
time, too.
Hope that helps.
Chris
------------------------------
Date: Thu, 17 May 2001 15:48:36 +0100
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: Filehandling, opening & Reopnening
Message-Id: <3B03E4C4.F0F5630F@bms.umist.ac.uk>
Mika Morell wrote:
>
> Hi.
>
> This is kind of anewbie question, first time for perl. I need to reread
> the same file 18 times, is there a way to not having to open and close
> it 18 times. With this layout of the script it only reads the file
> once. And if I move the opening/closing of LOGFILE inside the for loop
> it takes forever. The important part of the script looks like this:
>
> open (LOGFILE,"$tmplog") || die "YOu killed kenny!!! YOu Bastard\n";
> for ($i = 1 ; $i <=$total; $i++) {
> open (OUTFILE,">>$outpath/$hosts[$nuffra].log.txt");
> while (<LOGFILE>){
> if (/\ $hosts[$nuffra]\ /) {
> print OUTFILE ("$_");
> }
> }
> close OUTFILE|| die " Someone is bakin brownies\n";
> $nuffra++;
> }
>
If the file isn't too big, you could just slurp it into an array.
open (LOGFILE, "$tmplog") or die "couldn't open $tmplog : $!";
my @logfile = <LOGFILE>;
close LOGFILE;
then you can just loop through the array as many times as you like.
HTH
Paul
------------------------------
Date: Thu, 17 May 2001 16:23:53 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Filehandling, opening & Reopnening
Message-Id: <uou7gtg4b1ssa3ug1uhu8oopnksedrtud6@4ax.com>
Mika Morell wrote:
>This is kind of anewbie question, first time for perl. I need to reread
>the same file 18 times, is there a way to not having to open and close
>it 18 times. With this layout of the script it only reads the file
>once.
seek LOGFILE, 0, 0;
Rewind back to the beginning.
--
Bart.
------------------------------
Date: Thu, 17 May 2001 17:55:36 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Hex values
Message-Id: <3b04107a.4562$3a4@news.op.net>
In article <0ebud9.4p.ln@imperia.net>,
Steffen Beyer <sb@mcasia.imperia.net> wrote:
>< still more intense nit-picking ON ;-) >
>
>Perl happens to be written in C, which uses two's complement binary
>representation
This is wrong in two ways. Since you are in intense nitpicking mode,
I will not scruple to correct your misinformation.
First, the true underlying representation might be anything; it might
even be Roman numerals, or, as you mentioned below, BCD. The C
standard does not dictate how numbers are represented.
The standard defines only how certain integer types in C behave with
regard to certain C operators. For example, the '&' operator does a
'bitwise and' operation on integer arguments. The 'bitwise and' is
defined to behave *as if* the integer had a certain representation,
but whether it must actually have this representation is not defined.
The underlying representation might be Roman numerals, in which case
the C compiler would have to implement the '&' operator in a
complicated way, probably as a library subroutine of some sort.
Second, C integers are *not* required to behave as if they were
represented as twos-complement binary numerals. The C standard
specifically allows a ones-complement representation instead.
>(and IEEE floating point representation,
Are you sure there is such a requirement? I find this difficult to believe.
>which is just another form of two's complement binary representation)
Now I am out of nitpick mode. Here you are simply mistaken.
"Twos-complement" has a specific, technical meaning, and IEEE format
is not it. Twos-complement numbers can be added and subtracted
bitwise with appropriate carrying; IEEE numerals cannot. A
twos-complement number can be doubled by left-shifting it one place;
an IEEE numeral cannot. Twos-complement representations are unique,
so that each number is represented by at most one bit-pattern, but one
number may have many representations as an IEEE numeral, and usually
does.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 924
**************************************