[10097] in Perl-Users-Digest
Perl-Users Digest, Issue: 3690 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 11 10:17:13 1998
Date: Fri, 11 Sep 98 07:15:44 -0700
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, 11 Sep 1998 Volume: 8 Number: 3690
Today's topics:
<input type="file" ... maxlength=100000 accept="image/* <buck@writeme.com>
Re: <input type="file" ... maxlength=100000 accept="ima (Mads Toftum)
accesing MSAccess Database.... <cabustos@ibague.cetcol.net.co>
Re: accesing MSAccess Database.... <john.drummond@guest.com>
Re: Authentication <gnangoma@echelon.ca>
Building Perl 5.005_51 on Digital Unix 4.0b <sxdjd@ts.sois.alaska.edu>
Code explanation (cs - Elton Kong)
Re: Code explanation <jdf@pobox.com>
Re: Have problem with import of global variables <jdf@pobox.com>
Help with writing log functions (Drew Dowling)
Re: Help with writing log functions <J.D.Gilbey@qmw.ac.uk>
Re: Help with writing log functions (Drew Dowling)
Re: Help with writing log functions <john.drummond@guest.com>
How to do metatcharacter interpretation? <john.drummond@guest.com>
Re: How to do metatcharacter interpretation? <jdf@pobox.com>
Re: Looking for example code that does modem communicat (Bbirthisel)
Re: MD5 & Base 64 <aas@sn.no>
Re: Password Checking Program <sneaker@sneex.fccj.org>
Re: Perl & Java - differences and uses (David Cantrell)
Re: Perl & Java - differences and uses (Jeffrey R. Drumm)
perl5 + DBI + DBD for winNT rfranco@my-dejanews.com
Re: Redirect output to perl variable dave@mag-sol.com
Regular expression question <mikec@jump.net>
Re: Regular expression question <jdf@pobox.com>
Re: require statement broken traktion@my-dejanews.com
Re: Search/Replace but Not under certain conditions. HO <J.D.Gilbey@qmw.ac.uk>
Re: Stripping out 'bad' HTML <jgoldberg@dial_put-a-decimal-here_pipex.com>
SYBPERL install hassles - help!!!! <malcolm.stevens@fnbinvest.co.za.remove_nospam>
Uploading & Downloading <r.navalinskas@omnitel.net>
warning: accept failed (Protocol error) <maen@g-ol.com>
Re: While loop with regex as condition? (Andre L.)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 11 Sep 1998 13:02:01 +0200
From: Stefan Buck <buck@writeme.com>
Subject: <input type="file" ... maxlength=100000 accept="image/*">
Message-Id: <35F90328.6CFA6BB6@writeme.com>
I did some file uploading with perl, using the cgi_lite module. This
works out pretty good, the only problem is big files. Users can upload
any size they want. I implemented the maxlength option in the input tag,
but it doesn't work (using netscape 4.05):
<input type="file" name="file_upload" size=50 maxlength=100000
accept="image/*">
The browser transmits big files and doesn't care about the maxlenth
option.
why is netscape ignoring maxlength, something wrong with the sytax?
any suggestion how to control file size transmission from within the
perl script?
Stefan Buck
------------------------------
Date: Fri, 11 Sep 1998 11:50:12 GMT
From: mt@dev.null (Mads Toftum)
Subject: Re: <input type="file" ... maxlength=100000 accept="image/*">
Message-Id: <35f90e59.1816081@news.inet.tele.dk>
On Fri, 11 Sep 1998 13:02:01 +0200, Stefan Buck <buck@writeme.com>
wrote:
>why is netscape ignoring maxlength, something wrong with the sytax?
>any suggestion how to control file size transmission from within the
>perl script?
use cgi-lib.pl
------------------------------
Date: Fri, 11 Sep 1998 07:09:54 -0500
From: "Cesar" <cabustos@ibague.cetcol.net.co>
Subject: accesing MSAccess Database....
Message-Id: <6ta0ot$mfg1@ibague.cetcol.net.co>
How can I accesing a MBD Databse... with Perl...
is Possible?
Thanks for Your Help
------------------------------
Date: Fri, 11 Sep 1998 16:34:59 +0300
From: "John Drummond" <john.drummond@guest.com>
Subject: Re: accesing MSAccess Database....
Message-Id: <6tb8vc$qto$1@maple.cgin.us-md.citicorp.com>
>How can I accesing a MBD Databse... with Perl...
Two routes I know of and have got to work on NT using activestate's
distribution are using the WIN32::ODBC module and WIN32::OLE to get at the
ole objects
Have a look at http://www.roth.net/odbc/
and http://language.perl.com/CPAN/doc/FAQs/nt/Perl_for_Win32_FAQ.html
------------------------------
Date: Fri, 11 Sep 1998 07:06:30 -0400
From: Godfrey Nang'oma <gnangoma@echelon.ca>
Subject: Re: Authentication
Message-Id: <35F90436.905268FD@echelon.ca>
You can use ENV{REMOTE_USER} to get the username
of the person who requested the authenticated page.
I hope it will help you, if you have problem let me know
Brian L. Silva wrote:
> I am using Apache to require password authentication for a CGI system I've
> coded in PERL. I was hoping someone could explain how I can retrieve the
> username of the person who has been authenticated in PERL. Thanks!
>
> - Brian
>
------------------------------
Date: Thu, 10 Sep 1998 13:05:23 -0800
From: "David J. DeWolfe" <sxdjd@ts.sois.alaska.edu>
Subject: Building Perl 5.005_51 on Digital Unix 4.0b
Message-Id: <35F83F13.FBD7B22E@ts.sois.alaska.edu>
Greetings all;
I'm attempting to install Perl 5.005_51 on a DEC Alpha 3000 running
Digital Unix 4.0b (tried it on 3.2g as well) and the make step is
failing. The output from the make is attached at the end of this post.
It's dealing with unicode stuff of which I have very little knowledge. I
do currently have Perl 5.004_04 on this system but notice that there
does not appear to be unicode specific code in that distribution. I
continue to research this but any pointers to docs, ideas, suggestions
would be most welcome. Apologies for line wraps, and TIA......
`sh cflags libperl.a utf8.o` utf8.c
CCCMD = cc -DPERL_CORE -c -std -D_INTRINSICS
-I/usr/local/include -D__LANGUAGE_C__ -O4
cc: Error: utf8.c, line 483: In this declaration, the type of
"Perl_to_utf8_upper" is not compatible with th
e type of a previous declaration of "Perl_to_utf8_upper" at line number
644 in file proto.h.
to_utf8_upper(U8 *p)
^
cc: Error: utf8.c, line 494: In this declaration, the type of
"Perl_to_utf8_title" is not compatible with th
e type of a previous declaration of "Perl_to_utf8_title" at line number
645 in file proto.h.
to_utf8_title(U8 *p)
^
cc: Error: utf8.c, line 505: In this declaration, the type of
"Perl_to_utf8_lower" is not compatible with th
e type of a previous declaration of "Perl_to_utf8_lower" at line number
643 in file proto.h.
to_utf8_lower(U8 *p)
^
*** Exit 1
Stop.
---
David J. DeWolfe
Systems Programmer
Statewide Office of Information and Network Services
University of Alaska
907.474.7399
sxdjd@ts.sois.alaska.edu
------------------------------
Date: 11 Sep 1998 07:58:14 GMT
From: cselton@hkp.hk (cs - Elton Kong)
Subject: Code explanation
Message-Id: <6tal6m$3sk13@hkpa05.polyu.edu.hk>
Hi!
I'm a perl newbie and in the process of learing it. Could anyone
tell me what the below code means?
# string = &rand_pass(length)
sub rand_pass {
my @chars = ('A'..'Z', 'a'..'z', '0'..'9');
join "" => @chars[map rand @chars => 1 .. shift]
}
Thanks,
Elton
--
-|-
.-'~~~`-. IN MEMORY OF..
.' `.
| R I P | Elton Kong
| | mailto:cselton@polyu.edu.hk
| | http://www.acad.polyu.edu.hk/~cselton/
\\| |// ICQ:8990973
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
------------------------------
Date: 11 Sep 1998 14:55:22 +0200
From: Jonathan Feinberg <jdf@pobox.com>
To: cselton@hkp.hk (cs - Elton Kong)
Subject: Re: Code explanation
Message-Id: <m390jqq05h.fsf@joshua.panix.com>
cselton@hkp.hk (cs - Elton Kong) writes:
> I'm a perl newbie and in the process of learing it. Could anyone
> tell me what the below code means?
>
> sub rand_pass {
> my @chars = ('A'..'Z', 'a'..'z', '0'..'9');
> join "" => @chars[map rand @chars => 1 .. shift]
> }
In brief: given a number, that subroutine constructs a string of
random characters as long as that number.
Which elements of that code are throwing you off? I can help you
learn about them by guiding you to the docs.
sub rand_pass { ... }
Declaring or defining a subroutine. That's perlsub.
my @chars
That creates a lexically scoped array variable. For issues of scoping
you may see the entries in perlfunc for my() and local(). perlsub
also has detailed sections on my() and local(). Perlfaq 7 also deals
with this.
To learn about arrays, you should read perldata and perlfaq4.
my @chars = ( ... );
This is a list assignment, also covered in perldata.
'A'..'Z'
That's an application of the range operator, as documented in perlop.
join
You'll find documentation for join() in perlfunc.
=>
That's a synonym for a comma operator, with the difference that it
forces a bareword to its left to be interpreted as a string. perlop.
@chars[ ... ]
That's an array slice; perldata.
map
map() builds a list by applying some code or expression to another
list. It's documented in perlfunc.
rand @chars
The rand() function, documented in perlfunc, takes a single scalar
argument. An array variable in scalar context (in this case, @chars
as the argument to a function that expects a scalar value) evaluates
to the number of elements in the array.
shift
Documented in perlfunc(). In this case, a fancy way of getting at the
first argument passed to the function. You'll need to study perlsub,
too.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 11 Sep 1998 14:29:04 +0200
From: Jonathan Feinberg <jdf@pobox.com>
To: "Alex Litvak" <alitvak@shrike.depaul.edu>
Subject: Re: Have problem with import of global variables
Message-Id: <m3btomq1db.fsf@joshua.panix.com>
"Alex Litvak" <alitvak@shrike.depaul.edu> writes:
> The problem is that when I use this module in other scripts I import
> the variables with no value.
> print $MYVAR; gets me nothing at the output.
> What am I doing wrong?
It would be very helpful if you could provide a brief but complete
example of this problem. Since we don't *see* what you're doing
wrong, it's impossible to help you.
Have you followed the template given in perlmod?
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Fri, 11 Sep 1998 13:00:06 GMT
From: dowling@netcom.com (Drew Dowling)
Subject: Help with writing log functions
Message-Id: <dowlingEz4Es6.FK0@netcom.com>
Keywords: Help logs
I've got the following equasion:
x^log2(y)=z
It describes a discount rate and produces the numbers I expect.
However I am trying to plug it into a perl script. Perl does have a log
function, but it's only log base e, where in I need to write log base 2.
Perhaps this has a math solution, or perhaps it has a perl code solution.
Any help/pointers are appreciated.
--
Drew Dowling Drewhead /\
dowling@netcom.com 69 WWW / \Alpha Phi Omega
Concord, North Carolina Nimat Apatschin/ \ Gamma Lambda
CLEMSON UNIVERSITY ALUMNI CTC(www.ctc.net) /______\
TIGER BAND! http://www.drewhead.org
This account protected by spamguard(TM). Use keyword "Tiger" in subject line.
------------------------------
Date: Fri, 11 Sep 1998 14:08:11 +0100
From: Julian Gilbey <J.D.Gilbey@qmw.ac.uk>
Subject: Re: Help with writing log functions
Message-Id: <35F920BB.6C57B608@qmw.ac.uk>
Drew Dowling wrote:
>
> I've got the following equasion:
> x^log2(y)=z
> It describes a discount rate and produces the numbers I expect.
> However I am trying to plug it into a perl script. Perl does have a log
> function, but it's only log base e, where in I need to write log base 2.
> Perhaps this has a math solution, or perhaps it has a perl code solution.
> Any help/pointers are appreciated.
Math theorem:
log_a(b) = log_c(b) / log_c(a)
So log2(y) = log(y)/log(2).
HTH,
Julian
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Julian Gilbey Email: J.D.Gilbey@qmw.ac.uk
Dept of Mathematical Sciences, Queen Mary & Westfield College,
Mile End Road, London E1 4NS, ENGLAND
-*- Finger jdg@goedel.maths.qmw.ac.uk for my PGP public key. -*-
------------------------------
Date: Fri, 11 Sep 1998 13:34:54 GMT
From: dowling@netcom.com (Drew Dowling)
Subject: Re: Help with writing log functions
Message-Id: <dowlingEz4GE6.IGB@netcom.com>
Julian Gilbey <J.D.Gilbey@qmw.ac.uk> writes:
>Drew Dowling wrote:
>>
>> I've got the following equasion:
>> x^log2(y)=z
>> It describes a discount rate and produces the numbers I expect.
>> However I am trying to plug it into a perl script. Perl does have a log
>> function, but it's only log base e, where in I need to write log base 2.
>> Perhaps this has a math solution, or perhaps it has a perl code solution.
>> Any help/pointers are appreciated.
>Math theorem:
>log_a(b) = log_c(b) / log_c(a)
>So log2(y) = log(y)/log(2).
>HTH,
> Julian
Bingo, Right on.
Thanks Julian
--
Drew Dowling Drewhead /\
dowling@netcom.com 69 WWW / \Alpha Phi Omega
Concord, North Carolina Nimat Apatschin/ \ Gamma Lambda
CLEMSON UNIVERSITY ALUMNI CTC(www.ctc.net) /______\
TIGER BAND! http://www.drewhead.org
This account protected by spamguard(TM). Use keyword "Tiger" in subject line.
------------------------------
Date: Fri, 11 Sep 1998 16:51:24 +0300
From: "John Drummond" <john.drummond@guest.com>
Subject: Re: Help with writing log functions
Message-Id: <6tb9u2$rhk$1@maple.cgin.us-md.citicorp.com>
e^ln(x) == x
similarly
2^log2(x) == x
take ln of both sides
gives
log2(x) * ln(2) == ln(x)
unless my maths from ages ago is completely up the spout.
Drew Dowling wrote in message ...
>
>I've got the following equasion:
> x^log2(y)=z
>It describes a discount rate and produces the numbers I expect.
>However I am trying to plug it into a perl script. Perl does have a log
>function, but it's only log base e, where in I need to write log base 2.
------------------------------
Date: Fri, 11 Sep 1998 13:51:27 +0300
From: "John Drummond" <john.drummond@guest.com>
Subject: How to do metatcharacter interpretation?
Message-Id: <6tavcm$lkg$1@maple.cgin.us-md.citicorp.com>
i.e. (I'm actually getting $delimiter from a text file and might be any
character as it will be a
user definable output field separator)
$delimiter = '\t';
print $delimiter ; #it prints the character \ and the character t which is
fair enough
what do I need to do to print an actual tab?
e.g.
@items = ('item1','item2');
print join $delimiter, @items ; #gives item1\titem2 when I want item1
item2
Many thanks for any thoughts - I have looked through the camel book faq's
and documentation
but to no avail so far.
John
------------------------------
Date: 11 Sep 1998 15:07:53 +0200
From: Jonathan Feinberg <jdf@pobox.com>
To: "John Drummond" <john.drummond@guest.com>
Subject: Re: How to do metatcharacter interpretation?
Message-Id: <m367eupzkm.fsf@joshua.panix.com>
"John Drummond" <john.drummond@guest.com> writes:
> $delimiter = '\t';
> print $delimiter ; #it prints the character \ and the character t which is
> fair enough
>
> what do I need to do to print an actual tab?
Here's one approach.
$delimiter =~ s/(\\[tnbr])/ qq("$1") /ee;
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 11 Sep 1998 13:02:02 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: Looking for example code that does modem communication.
Message-Id: <1998091113020200.JAA02889@ladder03.news.aol.com>
Hi Zailong:
>What I need the perl script to do is:
>
> connect to the modem;
> dial a number;
> wait a few sec(for tone)
> dial some numbers
> hang up.
You don't mention OS, but this has been reported before on linux.
>It won't dial at all.
>
>I can do this by minicom:
>
> ath1<enter>
> atdt123344444;<enter>
> atdt12312312313123123123123131;<enter>
> ath0<enter>
As I recall, minicom runs suid. It also manages the lock file. And
issues the appropriate "stty" commands to permit the OS to chat
with the modem. There are three reasons that hint at permission
or setup problems.
>I don't know perl very well. Anyone can give me some hints?
Minicom has an embedded script language and allows you to start
a script from the command line. For what you want to do, that is
probably the quickest solution. I'm on the wrong OS at the moment
for looking up the exact sequence - but the man pages were easy
to follow.
Good luck. And ask if you need more help.
-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)
------------------------------
Date: 11 Sep 1998 11:07:01 +0200
From: Gisle Aas <aas@sn.no>
Subject: Re: MD5 & Base 64
Message-Id: <m3sohzt3uy.fsf@furu.g.aas.no>
fauseyr@mccc.edu (Rob Fausey TA CompSci) writes:
> Is it possible for MD5 to create a check sum in base64 instead of the
> default hex format ? If so is there an example of this.
$ echo -n "some string to hash" |
perl -0777 -MMD5 -MMIME::Base64 -e 'print encode_base64(MD5->hash(<>))'
ta1TwIXw1AIzRokQE1HYQg==
--
Gisle Aas
------------------------------
Date: Fri, 11 Sep 1998 07:24:02 -0400
From: Bill 'Sneex' Jones <sneaker@sneex.fccj.org>
Subject: Re: Password Checking Program
Message-Id: <35F90852.AC1E3BD4@sneex.fccj.org>
Sean Rooney wrote:
>
> Can anyone advise me of a UNIX program that will enable me to create a list
> of words that will be refused should a user attempt to use one of them as a
> password.
>
> Any advice would be much appreciated.
>
> Regards, Sean.
Try this:
#!/usr/bin/perl -w
#
# Perl script to make a passwd, but not one is LIST...
#
# Written by Sneex, FCCJ Webmaster 9/11/98 @ 07:00...
#
use strict;
use diagnostics;
# PATH to & Filename of easily guessed passwords
# NOT allowed for use by User:
my $notAllowed = 'deniedwords.txt';
# Digit Place...
my $first;
my $second;
my $pw = '';
# General Counters...
my $w = 0;
my $x;
my $y = '';
my $z = '';
# Test Password
$pw = shift || rand(time); # Or user supplied...
open (FILE, "$notAllowed") ||
die "OOPS! Can't open $notAllowed: $!";
while (<FILE>) {
chomp();
if ($pw eq $_) {
print "The word entered: $pw, is not allowed\n";
exit;
}
}
close (FILE) || die "OOPS! Can't close $notAllowed: $!";
# OK, good word found, let's make a password :]
while(1) {
$first = (((rand(time)) >> (11 + 1 - 8)) & ~(~0 << 7));
$second = (((rand(time)) >> (11 + 1 - 8)) & ~(~0 << 7));
last if ($x++ > (16*((2**31)-1))); # Loop millions...
# print "$first $second\n";
next unless chr($first) =~ /[a-zA-Z0-9]/;
next unless chr($second) =~ /[a-zA-Z0-9]/;
$pw = chr($first) . substr(rand(time), 0, 6) . chr($second);
# crypt w/two letter seed...
$z = crypt($pw, ("".chr($first).chr($second).""));
print " - Found match: $z - Total: ++$w" if (index($y, $z) > -1);
$y .= " " . $z;
print "\nLooking \@ Plain: $pw, Crypt: $z : Try: $x.";
1; # Done, for now :]
}
### Example of data file, without the '#' in front... ###
#
#bill
#sex
#god
#goddess
#biteme
#ass
#etc
Enjoy!
-Sneex-
__________________________________________________________________
Bill Jones | FCCJ Webmaster | http://webmaster.fccj.org/Webmaster
__________________________________________________________________
We are the CLPM... Lower your standards and surrender your code...
We will add your biological and technological distinctiveness to
our own... Your thoughts will adapt to service us...
...Resistance is futile...
------------------------------
Date: Fri, 11 Sep 1998 09:43:44 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: Perl & Java - differences and uses
Message-Id: <35f9ee1e.58850662@thunder>
On Thu, 10 Sep 1998 17:10:26 GMT,
George Reese <borg@imaginary.com> enlightened us thusly:
>In comp.lang.java.programmer David Cantrell <NukeEmUp@ThePentagon.com> wrote:
>
>: On Thu, 10 Sep 1998 16:35:21 GMT,
>: George Reese <borg@imaginary.com> enlightened us thusly:
>
>:>Perl can do things in fewer keystrokes than probably any other
>:>language on Earth. That is exactly its problem. People actually use
>:>that feature! Now, while both of the above are about as readable as
>:>doign the task in question can get, in most cases Perl shortcuts are
>:>just an inch away from line noise.
>
>: However, your assertion has been proven wrong. And _why_ is being
>: concise a problem? If you actually look at production perl code, it
>: doesn't appear anything like Obfuscated Perl Contest winners.
>
>Your thesis resist on the premise that fewer keystrokes is better.
I merely asked a question. I advanced no theory or hypothesis. And I
did not mention keystrokes. And even if I had, your assertion has
STILL been proven incorrect.
>That is false.
Correct. Fewer keystrokes does not necessarily mean better.
Conciseness, however, IS better.
>And you are right. Production perl code does not look anything like
>obfuscated perl. And a beautiful troll looks nothing like an ugly
>troll--but they are still both trolls.
ROFL! Of course, perl is perl is perl. Your point? If you're still
banging on about perl being difficult to read and unmaintainable then
you've be shown to be wrong already.
--
David Cantrell, part-time NT/java/SQL techie
full-time chef/musician/homebrewer
http://www.ThePentagon.com/NukeEmUp
------------------------------
Date: Fri, 11 Sep 1998 10:59:39 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Perl & Java - differences and uses
Message-Id: <35f9fec8.229545318@news.mmc.org>
On Fri, 11 Sep 1998 00:51:50 GMT, George Reese <borg@imaginary.com> wrote:
>In comp.lang.java.programmer Matt Knecht <hex@voicenet.com> wrote:
>: Oh, and there's an even simpler Perl solution to the tab problem. Use a
>: builtin module:
>
>: use Text::Tabs;
>: @expanded_lines = expand(@lines_with_tabs);
>
>: It doesn't get much easier than that. A **LOT** can be trivially
>: accomplished in Perl with the use of modules. I invite you to check out
>: your nearest CPAN.
>
>Well, shit, I can do that with Python:
>
>import tabfix;
>
>expanded_lines = tabfix.fixTabs(line_with_tabs);
I'm nearly completely ignorant of Python, so bear with me. Are those two
constructs truly equivalent? With the Perl construct, it's obvious (at least to
someone that's spent 5 minutes with a Llama) that the argument to expand() and
its resulting assignment are arrays. The same is not obvious from the Python
example. Since maintainability is one of the issues under discussion, the Perl
snippet would seem to give the maintainer a better understanding of the actual
manipulation involved.
I'm no Perl expert either, but I've written some fairly large (and quite a few
small) applications in Perl and have had little difficulty figuring out what I
was trying to do when I've gone back to them (of course, I have scratched my
head a couple of times wondering why I decided to do it just *that* way). I do
tend to comment liberally, though, and feel strongly that documentation is the
single most important aspect of maintainability regardless of the language's
"self documenting" features.
I daresay that most of my Perl scripts could be maintained by someone with a
rudimentary knowledge of C . . . once they stop laughing, of course.
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: Fri, 11 Sep 1998 12:41:32 GMT
From: rfranco@my-dejanews.com
Subject: perl5 + DBI + DBD for winNT
Message-Id: <6tb5pr$bfj$1@nnrp1.dejanews.com>
Hi,
I'm not getting success to put perl5 + DBI + DBD up and running for winNT
using Oracle 8.
I got binary stuffs from perl.com (gurusamy sarathy's) and it seems to have
internal incompatibility when we try to compile DBD.
"error: unresolved external "GetVersion" referenced from module c0ntd.ASM"
and there are lots of consecturive errors following this...
In another alternative I got perl from active state and also DBI and DBD
modules installed with perl package manager, but when I try to run anything
the only thing I get is:
"install_driver(Oracle) failed: DBI/DBD internal version mismatch (DBI is
v94/s10 8, DBD Oracle.xsi expected v93/s108) you probably need to rebuild
the DBD driv er (or possibly the DBI). at
e:\activeperl\site\5.00502\lib/Oraperl.pm line 58" BEGIN failed--compilation
aborted.
Did anybody come thru similar situation? where do I get trustable perl5 +
DBI + DBD packages?
thanks in advance,
Ricardo Franco (Brasil)
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 11 Sep 1998 11:18:38 GMT
From: dave@mag-sol.com
Subject: Re: Redirect output to perl variable
Message-Id: <6tb0uf$5cr$1@nnrp1.dejanews.com>
In article <6tajrt$m4u$1@nnrp1.dejanews.com>,
kuhnerts@my-dejanews.com wrote:
> Hello,
>
> I want to redirect an output from a system command to a perl variable.
>
> system ( "echo Hello" );
>
> How do I get the output "Hello" into a perl variable ?
$var = qx/echo hello/;
hth,
Dave...
--
dave@mag-sol.com
London Perl M[ou]ngers: <http://www.mag-sol.com/London.pm/>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 11 Sep 1998 06:58:25 -0500
From: Sherry Coldsmith or Mike Christie <mikec@jump.net>
Subject: Regular expression question
Message-Id: <35F91061.30F8@jump.net>
I am new to perl and am trying to write a program to solve cryptograms,
as an exercise. A cryptogram is an English sentence with a random
substitution of letters. For example "Hello, there" might be encrypted
as "Jkpps, mlkqk". The letter relationships remain constant from word
to word.
I have a working program, but I would like to speed it up by only
reading in words from the dictionary I am using that match the target
words by pattern. I keep an array of candidate words in memory for each
word in the crypt. For "mlkqk" I don't need all 5 letter words in my
dictionary in that array; I only need ones with the fifth and third
letters the same and all the rest different.
My question is: given an array of all five letter words, and a given
crypt word like "mlkqk", what is the best way to filter the array down
to only those words that might match? The only way I can see to do it
is a long and laborious process of building one regexp after another for
every possible case--impossibly tedious. And it would have to be done
again for every different length of word--I need to do this for every
word length from 2 to 25.
Thanks in advance for any help.
Mike Christie
------------------------------
Date: 11 Sep 1998 15:48:33 +0200
From: Jonathan Feinberg <jdf@pobox.com>
To: mikec@jump.net
Subject: Re: Regular expression question
Message-Id: <m33e9ypxou.fsf@joshua.panix.com>
Sherry Coldsmith or Mike Christie <mikec@jump.net> writes:
> My question is: given an array of all five letter words, and a given
> crypt word like "mlkqk", what is the best way to filter the array down
> to only those words that might match?
The "best" way I'll leave to mjd, Abigail, and tchrist. Here's a
reasonable way. It's fast enough on my box.
#!/usr/bin/perl -w
use strict;
use vars '@dict';
open(DICT, '</usr/dict/words') || die "/usr/dict/words: $!\n";
chomp(@dict = <DICT>);
close DICT;
sub match_crypto {
my @pattern = split //, $_[0];
my (@letters,%slots,@matches);
WORDS:
foreach my $word (@dict) {
next unless length $word == @pattern;
@letters = split //, $word;
%slots = ();
for (my $i = 0; $i < @letters; ++$i) {
next WORDS if $letters[$i] eq $pattern[$i];
if (exists $slots{$pattern[$i]}) {
next WORDS unless $slots{$pattern[$i]} eq $letters[$i];
}
else {
$slots{$pattern[$i]} = $letters[$i];
}
}
push @matches, $word;
}
@matches;
}
my @aloha = match_crypto('zabcz');
print join("\n",@aloha),"\n";
my @babbage = match_crypto('abqqcdy');
print join("\n",@babbage),"\n";
__END__
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Fri, 11 Sep 1998 13:24:42 GMT
From: traktion@my-dejanews.com
Subject: Re: require statement broken
Message-Id: <6tb8ap$eo2$1@nnrp1.dejanews.com>
I've been having exactly the same problems and it is VERY irritating :)
Anyway, I've still not found a proper way around it, but a quick fix is to use
the 'use' command. If you put 'user /yourdirname' at the top of the script, it
finds all the files.
Like I said, it is only a quick fix as you have to do this to all your
scripts, which sucks. If anyone has a better way of doing it, PLEASE tell us
:)
Regards,
Paul Green
In article <x6FE1.387$J3.9229953@nnrp2.ni.net>,
"Erik Knepfler" <erik@zeno.com> wrote:
> Running on NT Server, latest ActivePerl build. My statement of:
>
> require 'someotherfile.pl';
>
> ..used to work fine before installing ActivePerl. Now it says that it can't
> find it in @INC, yet @INC contains the "." directory, so it should work. I
> even tried:
>
> push (@INC, "d:\\mydir\\wherethe\\fileis");
> require 'someotherfile.pl';
>
> ..but even after that, the resulting error doesn't seem to have caught that
> push command (this used to work too). Unforunately I have a million scripts
> with these sorts of requires, and I don't want to move them into a valid
> @INC dir - how can I fix this?
>
> Erik
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 11 Sep 1998 14:02:14 +0100
From: Julian Gilbey <J.D.Gilbey@qmw.ac.uk>
Subject: Re: Search/Replace but Not under certain conditions. HOW?
Message-Id: <35F91F56.3279A0E2@qmw.ac.uk>
Ron Bennett wrote:
>
> I've read the groups, faqs, etc and am still mystified as to how to do this:
>
> $body =~ s|(http://\S+)|<a href="$1">$1</a>|g;
>
> Converts all strings begining with 'http://' to actual hypertext links and
> works fine.
>
> BUT how do I code it so it does NOT match if the http://whatever address
> contains any '@' characters in it??
How about:
$body =~ s|(http://[^\s@]+)\s|<a href="$1">$1</a>|g;
Does that work?
Julian
P.S. comp.lang.perl no longer exists officially. Use
comp.lang.perl.misc
or c.l.p.moderated instead....
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Julian Gilbey Email: J.D.Gilbey@qmw.ac.uk
Dept of Mathematical Sciences, Queen Mary & Westfield College,
Mile End Road, London E1 4NS, ENGLAND
-*- Finger jdg@goedel.maths.qmw.ac.uk for my PGP public key. -*-
------------------------------
Date: Fri, 11 Sep 1998 14:28:38 +0100
From: "Jeremy Goldberg" <jgoldberg@dial_put-a-decimal-here_pipex.com>
Subject: Re: Stripping out 'bad' HTML
Message-Id: <6tb8gm$9g$1@plug.news.pipex.net>
Abigail wrote in message <6t3nt6$p40$1@client3.news.psi.net>...
>Jeremy Goldberg (jgoldberg@dial.pipex.com) wrote on MDCCCXXXIII September
>MCMXCIII in <URL: news:6t06kf$q3p$1@plug.news.pipex.net>:
>++ Does anyone have a decent algorithm (or a module, hint, hint) to take
text
>++ and strip out 'bad' HTML e.g. "3 < 5" (which should be written as "3
<
>
>What is bad about "3 < 5"?
>
>++ 5") without stripping 'good' HTML e.g. "<b>3 is less than 5</b>"? It
would
>++ be good to allow users to put in HTML (in news articles, say, or message
>++ board articles) without letting them wreck their HTML utterly.
>
>I can't parse this. If they put in HTML, then what's wrong with that?
'Bad' html as in the user inputting information possibly not having a clue.
I didn't mean legal or illegal HTML, I meant picking out innocent mistakes -
like the "3 < 5" above - from deliberate HTML. Actually, of course, most
browsers will accept "3 < 5" (does the syntax explicitely ignore a '<'
followed by a number?)... but what about:
a < b
a < b < c
Price: <no data>
Mail me at <a href="mailto:ditto@diggity.com">ditto@diggity.com</a>
Only the last is meaningful HTML. You see what I'm getting at? I'd rather
remove the idiot users ability to mess up their text without preventing them
from putting in tags altogether. Certainly, I can write my own, but I was
asking if anyone else had already made public code for this.
------------------------------
Date: Fri, 11 Sep 1998 14:25:06 +0200
From: "Mal" <malcolm.stevens@fnbinvest.co.za.remove_nospam>
Subject: SYBPERL install hassles - help!!!!
Message-Id: <6tb4tg$1uk$1@hermes.is.co.za>
Hi
I am trying to install perl and sybperl on a solaris box.
I have compiled perl 5.004_04 and vanilla perl works well.
I then untarred sybperl into it's own directory and followed the
instructions in the README file.
"make" runs fine.
"make test" ran fine one I added ".././blib/arch/auto/Sybase/CTlib" and
".././blib/arch/auto/Sybase/DBlib" to my LD_LIBRARY_PATH.
In a sample app I have:
#!/usr/local/bin/perl
use Sybase::DBlib;
This falls over with:
Can't locate Sybase/DBlib.pm in @INC (@INC contains: /usr/local/lib/perl5
/usr/local/lib/perl5 /usr/local/lib/perl5 .) at ...
I have created a softlink to some of the sybperl pm modules etc in
/usr/local/lib/perl5 where my perl modules are but this is not mentioned in
the sybperl installation guide and really doesn't seem right to me. Should I
be doing this?
My questions are thus:
1. Do I have to recompile the perl binary after installing sybperl?
2. What environment variables must be set for sybperl?
3. Does the sybperl installation try to link itself to perl when installing
sybperl?
4. What exactly is happening with the sybperl installation?
thanx
Malcolm
------------------------------
Date: Fri, 11 Sep 1998 13:58:09 +0200
From: Ramunas Navalinskas <r.navalinskas@omnitel.net>
Subject: Uploading & Downloading
Message-Id: <35F91051.F78DC39E@omnitel.net>
Hello !
I need any hints about managing uploading files through forms. Also, is
there a possibility to send to the client(browser) any file, which is
"600". I need this for the .zip files (binary transfer mode), e.g.: user
enters username and passw., Perl script checks it and if they're
correct, it must send a file. I don't need complete program written,
just any suggestions how to do this, if it's possibel. Thank you.
--
Ramunas Navalinskas
E-mail: r.navalinskas@omnitel.net
------------------------------
Date: Fri, 11 Sep 1998 13:11:16 +0200
From: Maen Suleiman <maen@g-ol.com>
Subject: warning: accept failed (Protocol error)
Message-Id: <35F90554.FD59998F@g-ol.com>
Hi guys ..
i am running a Netscape Fasttrack 2.01 server .. recently i am getting
this error :
[11/Sep/1998:12:56:09] warning: accept failed (Protocol error)
when calling a cgi script written in perl by more than a one client ! ..
the script is about 770 lines ! and it seems working without any
problems before .. and when one client call it !! .. but when two
clients call it in the same time ( automaticlly loads ) it gives the
above error .. any onw have an idea of thre problem ..
i will be gratefull for any help
thanx in advance
--
----------------------------------------------------------------
Maen Suleiman , Email: maen@g-ol.com
NTS - New Technology Solutions LTD/Galilee On Line -ISP
Tel:972-6-6456996, Fax:972-6-6550793,http://www.g-ol.com
------------------------------
Date: Fri, 11 Sep 1998 04:13:45 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: While loop with regex as condition?
Message-Id: <alecler-1109980413450001@dialup-575.hip.cam.org>
I'm half asleep, so maybe there's a better WTDI; at least this gets rid of
the superfluous while loop and of one variable.
$script = '/cgi-bin/myscript.pl';
$_ = "See abc(1), def(14), and ghi(49).\n";
s{(\w+)\((\d+)\)}
{ $page = $1;
$page =~ s/\S\010//g; # are you sure about this?
$sec = $2;
$sec =~ s/\S\010//g;
"<A HREF=\"$script?manpage=$page§ion=$sec\">$page($sec)<\/A>"
}ge;
print;
HTH,
Andre
============================
In article <6tab3s$sp2@ds2.acs.ucalgary.ca>, Matt Hughes
<mhughe@acs.ucalgary.ca> wrote:
> Can you use a regular expression as the condition for a while loop?
>
> Code Snip:
> while (/((\S+)\((\S+)\))/) {
> $str = $1;
> $page = $2;
> $sec = $3;
> $page =~ s/\S\010//g;
> $sec =~ s/\S\010//g;
> s/\Q$str/<A
> HREF="$script\?manpage=$page§ion=$sec">$page($sec)<\/A>/g;
> }
>
> This snippet is from a man page to HTML converter on a linux box.
> The input is formatted by nroff, and most of the script converts it to
> html. This looks for words that are imediatly followed by parentesis
> with a number indicating the section the man page is in. Ex. gcc(1). It
> converts this to a hyperlink. If the while is replaced with an if, only
> the first such pattern is matched and made into a hyperlink, but it does
> work. The while produced no output at all. Note that the line is printed
> a little later in the program.
>
> Thanks in advance for the help!
>
> Matt Hughes
> mhughe@ucalgary.ca
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3690
**************************************