[6436] in Perl-Users-Digest
Perl-Users Digest, Issue: 61 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 6 08:15:27 1997
Date: Thu, 6 Mar 97 05:00:37 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 6 Mar 1997 Volume: 8 Number: 61
Today's topics:
Re: 10 commandments (was re: Which one is the best (pat <dbenhur@egames.com>
Re: [Q] Extract a regex <pmh@edison.ioppublishing.com>
ARGUMENTS - HELP <X.Coulon@herts.ac.uk>
Comm.pl vers 1.6 (John Nielsen)
Count how many time the file has been downloaded. (Mon-Sen Yang)
DB_File and flock() (Jon Drukman)
Re: DBD/DBI Oracle (John D Groenveld)
delete some lines in a doc <lmdtlb@lmd.ericsson.se>
Re: flock quandary <pmh@edison.ioppublishing.com>
Re: How to create 666 file from www perl cgi? (Charlie Stross)
Re: Knowing the pid of a fork()'ed child, really <joer@mo.net>
Re: LOAN <jcoffin@cs.pdx.edu>
Re: perl man pages (Sitaram Chamarty)
perl religion (was: Re: Which one is the best (pattern (E.)
Re: PERL SendMail Function (Charlie Stross)
Problem with installing Perl Modules (Mark Strivens)
Re: Public domain DES and other crypto code in Perl? <billstewart@mail.att.net>
Re: question of perl experts (Tad McClellan)
Re: Random Temp File in Perl 5.002 <monte@conchas.nm.org>
Re: Redirect compilation messages? <dbenhur@egames.com>
Re: Stumped by Syntax Error!!! <dbenhur@egames.com>
Re: Stumped by Syntax Error!!! <jcoffin@cs.pdx.edu>
Re: Time and Date via Win95 Perl? <jwilson@ic.ac.uk>
TN5250 module for perl... <monte@conchas.nm.org>
Re: Win32::ODBC INSERT INTO <Access Database> fails,? R <ceklof@vt.edu>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 05 Mar 1997 21:12:45 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
Subject: Re: 10 commandments (was re: Which one is the best (pattern matching))
Message-Id: <331E524D.7CC3@egames.com>
Jeff Stampes wrote:
> the ten commandments:
>
> 1) Thou shall use -w
> 2) thou shall not ask cgi programming questions
> 3) Thou shall RTFM
> 4) Thou shall not try to validate e-mail addresse
> 5) Thou shall not use perl4
> 6) Thou shall heed the latro warning
> 7) Thou shall have a bible handy at all times (Programming Perl, 2nd Ed)
> 8) Thou shall not write obfuscated code for others to maintain
> 9) Thou shall check return stati of functions
> 10) Thou shall use -w
11) Thou shall use use strict;
12) Thou shall use -T if thou's script can be run by someone
who is not thou.
13) Thou shall try use Benchmark whenever thou needs
to ask 'which method is faster?'
14) Thou shall use CPAN before re-inventing wheels
1.1) Thou shall not make modules which don't run clean with -w
10.1) Thou shall not put modules which don't run clean with
-w in CPAN :-(
--
Devin Ben-Hur <dbenhur@egames.com>
eGames.com, Inc. http://www.egames.com/
eMarketing, Inc. http://www.emarket.com/
"Sometimes you just have to step in it and see if it stinks" O-
-- Sonia Orin Lyris
------------------------------
Date: Thu, 6 Mar 1997 11:21:11 +0000
From: Peter Haworth <pmh@edison.ioppublishing.com>
Subject: Re: [Q] Extract a regex
Message-Id: <ML-2.2.857647271.7515.pmh@edison>
> I would like to "move" the matching pattern from a regex in
> a string to a new variable.
>
> Lets use the three first random cahacters as an example ( /^.{3}/ ).
> $OrgStr="1234567890";
> $NewStr="";
> In this example I would like the result to be:
> $OrgStr="4567890";
> $NewStr="123";
>
> This is just an example. I after a solution that does this with
> any regex. (Not only /^.{3}/.)
How about:
$OrgStr='1234567890';
$OrgStr=~/^(.{3})/;
$newStr=$1;
Peter
--
Peter Haworth pmh@edison.ioppublishing.com
Their fundamental design flaws are completely hidden by their
superficial design flaws.
-- Douglas Adams on Microsof, er, the Sirius Cybernetics Corporation
------------------------------
Date: Thu, 06 Mar 1997 10:25:45 +0000
From: Coulon <X.Coulon@herts.ac.uk>
Subject: ARGUMENTS - HELP
Message-Id: <331E9BA9.7BA@herts.ac.uk>
Hello,
I would like to write a Perl script what gets command line arguments,
but I don't know how to do it. Is it stored in a variable/array ?
Thanks for your help.
Xavier Coulon
X.Coulon@herts.ac.uk
------------------------------
Date: 6 Mar 1997 07:35:22 -0500
From: jnielsen@chemistry.mps.ohio-state.edu (John Nielsen)
Subject: Comm.pl vers 1.6
Message-Id: <5fmdma$3k1@chemistry.ohio-state.edu>
I have been switching my tcl based expect code to perl using Comm.pl (I wish
I would have known this existed earlier, perl is much nicer than tcl for
my purposes).
Eric Arnold recently posted a Comm.pl example using version 1.6, but
I can't find that version on CPAN anywhere. And the ftp site:
ftp://ftp.sterling.com/programming/languages/perl/authors/Eric_Arnold
refuses connection.
Is there somewhere else I should be looking?
Thanks,
john
------------------------------
Date: Thu, 06 Mar 1997 11:03:24 GMT
From: batmon@abico.com.tw (Mon-Sen Yang)
Subject: Count how many time the file has been downloaded.
Message-Id: <331ea3f0.38362281@netnews.hinet.net>
Hi,
Is there a way I can write a PERL script so that it will count how
many times the file has been downloaded by users, and show it on the
web page? Like, "this file has been download xxxx times."
Best Regards,
7()s>K!]batmon!^
batmon@abico.com.tw
Ability Enterprise Co., Ltd.
Part of ABiCO Group
------------------------------
Date: 4 Mar 1997 18:56:41 GMT
From: jsd@cyborganic.com (Jon Drukman)
Subject: DB_File and flock()
Message-Id: <5fhr99$mc9$1@its.hooked.net>
I've been trying to use DB_File and flock() to get some sort of
database consistency, but I had no luck with my program. So I copied
and pasted the example program from the DB_File perldoc and that
doesn't work either! It runs fine but it creates a zero-length file.
Subsequent runs fail on the tie() because the file is of inappropriate
type (no surprise).
I can create files fine with DB_File using tie if I ignore the flock()
stuff. This is on FreeBSD 2.1.6 in case that matters.
Any clues appreciated.
-j-
------------------------------
Date: 5 Mar 1997 22:44:32 -0500
From: groenvel@tholian.cse.psu.edu (John D Groenveld)
Subject: Re: DBD/DBI Oracle
Message-Id: <5flej0$p6k@tholian.cse.psu.edu>
In article <331DE2C1.2D61@lds.com>, Michael Shannon <mshannon@lds.com> wrote:
>Any and all help will be greatly appreciated,
I'll try to help you help yourself. To learn more about Perl modules, you
should take a look at http://www.perl.org/CPAN/modules/00modlist.long.html.
Once you download the latest DBI and DBD modules, you should read the
README's. The README's and module list point you to the dbi-users mailing list
or further help. Also, the mailist is archived at the below URL's so you might
want to check if your question has been asked and answered.
http://www.rosat.mpe-garching.mpg.de/mailing-lists/
http://www.coe.missouri.edu/~faq/lists/dbi.html
Good luck,
John
groenvel@cse.psu.edu
------------------------------
Date: Thu, 06 Mar 1997 07:57:25 +0100
From: LMD/T/KR <lmdtlb@lmd.ericsson.se>
Subject: delete some lines in a doc
Message-Id: <331E6AD5.41C67EA6@lmd.ericsson.se>
HI
To all the PERL experts, I am new in the PERL lang. But I have to
make a little script to remove some lines in a document. I have reach
the point where I can open the file and and print the lines I would like
to delete.
1. have do I delete the line(s) ?
The lines looks like this : .* { 1.1.1 }
.* { 1.1.2 }
.* { 1.2 }
.* { 1.2.1 }
.* { 2 }
2. have do make/save the new file ? ( could it be the same file ? )
Thanks
Regards Thomas Albrink
e-Mail: lmdtlb@lmd.ericsson.se
------------------------------
Date: Thu, 6 Mar 1997 11:33:51 +0000
From: Peter Haworth <pmh@edison.ioppublishing.com>
Subject: Re: flock quandary
Message-Id: <ML-2.2.857648031.1051.pmh@edison>
On Wed, 5 Mar 1997, James L. McGill wrote:
>
> Ah thank you guru. __
> I remember something you wrote about GDBM_File..
> That there is no way to lock these. Do you have a
> recommendation? The way I am working arond it now
> is to open a file and attempt to lock it, then open
> the dbm. I wish I could lock the dbm itself...
GDBM_File locks files for you. Shared locks when opened for reading, exclusive
locks when opened for writing.
Peter
--
Peter Haworth pmh@edison.ioppublishing.com
Applications programming is a race between software engineers,
who strive to produce idiot-proof programs, and the Universe
which strives to produce bigger idiots.
-- software engineers' saying
So far the Universe is winning.
-- applications programmers' saying
------------------------------
Date: Thu, 6 Mar 1997 09:52:07 +0000
From: charlie@antipope.org (Charlie Stross)
Subject: Re: How to create 666 file from www perl cgi?
Message-Id: <slrn5ht4u7.2sk.charlie@antipope.demon.co.uk>
<BLINK>Don't read news via web browser<FONT FACE="WingDings"><FONT SIZE="+3">
Geoffrey Hebert<soccer@microserve.net> wrote (in article <5fidsl$1p8$1@news3.microserve.net>):
>I want to create a file with a perl cgi script that is initiated from
>the web.
>
>If I create the file as the owner with 666 permissions from my telnet
>account, everything works fine. I can then open with ">filename"
>
>Open works only if I created the file! I want the cgi to create the
>file. Seems as though security is stopping me.
Very probably.
Assuming you're running on a UNIX system ...
CGI scripts are frequently executed by the web server with a UID of 'nobody',
specifically as a security precaution against scripts written by people
who haven't read the WWW security FAQ. Thus, you can't create a file in
a directory unless the directory itself is world-executable and world-
writable. (You can confirm this, if you're running Apache or NCSA httpd,
by looking in the httpd.conf file of your server. If it's not mentioned,
it may well default to whatever's compiled in ...)
Solutions:
a) make the directory your CGI script wants to create files in world-writable,
or
b) make your CGI script set-UID root. (Deprecated.)
--
Charlie Stross charlie @ antipope.org http://www.antipope.org/
------------------------------
Date: Wed, 05 Mar 1997 14:33:57 -0800
From: Joe Rabinoff <joer@mo.net>
Subject: Re: Knowing the pid of a fork()'ed child, really
Message-Id: <331DF4D5.167E@mo.net>
Elliott McCrory wrote:
>
> perl 5.0003 qeustion under Solaris 2.4/2.5 (SPARC).
>
> fork() returns the pid of the child to the parent. I need the pid for a
> status file which I must maintain for similar processes. The trouble is
> that exec() does not *always* make the process run under the same pid #
> as what the fork returns. For example, if you do `exec("some-process
> 2>errorlog")` (which is exactly the sort of thing I need to do,
> otherwise the STDERR messages from some-process get spewed around the
> system), exec() recognizes the ">" shell metacharacter and says "sh -c
> some-process 2>errorlog" (in this case), creating a new pid number.
> MOST of the time, the pid is "fork() + 1", but some of the time it is
> "fork()+2", and some (rarer) time, "fork()+3", and probably so on.
>
> How can I deal with this so that the parent process really knows what
> the pid of the process is that I need? I have a workaround now that
> when "fork()+1" is not found, it tries "fork()+2", but is still fails if
> the pid goes to "fork()+3".
Elliot,
As a stopgap measure at least, the fork'ed process could write its PID
into a file that the parent can read. It might be messy, but I don't
know of a better way.
I hope this helps.
Joe Rabinoff
------------------------------
Date: 06 Mar 1997 00:41:21 -0800
From: Jeff Coffin <jcoffin@cs.pdx.edu>
Subject: Re: LOAN
Message-Id: <m2ybc1pg3y.fsf@cs.pdx.edu>
>>>>> "SIDHU" == SIDHU <sidhu1@home.com> writes:
SIDHU> I need a scrip that takes a monthly income and can tell me how
SIDHU> much loan i can have. This is for a project. Real Estate
SIDHU> type.
Go and get (buy or borrow, libraries are good for this, at least until
they get shut down in favor of new prisons) two books, "Learning Perl"
by Randal Schwartz and "Personal Finance for Dummies" by Eric Tyson.
Use what you glean from the former to translate what you will find on
page 179 of the latter, into Perl code.
This isn't free code land. Make us think you tried, at least a
little, before you post asking for help.
Thanks
-jeff
------------------------------
Date: Thu, 06 Mar 1997 05:36:21 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: perl man pages
Message-Id: <331e5756.143683333@news.diac.com>
SRI <ss51@columbia.edu> wrote:
>I installed perl5.003 on a HP 9000/712. I did a 'man perl' and it shows
>
>PERL(1)
>PERL(1)
> Release 4.0 Patchlevel 36
>.......
>
>This seems to be for the 4.0 version. But I checked /usr/local/man/man1
>and /usr/local/lib/perl5/man/man3 and they all are brand new. Where are
>the old man pages hiding? Also there are two executables 'perl' and
>'perl5.003' in /usr/local/bin. Are they the same?
Dont know about the perl version, but old man pages sometimes hide in
the "cat" directories (which saves the nroff step for frequently
referred man pages). I've been bitten by this before - look under the
/usr/local dir for "*cat*perl*".
If you find it delete it. Next "man perl" will force a fresh "nroff"
etc.
HTH
Sitaram
------------------------------
Date: 5 Mar 1997 16:54:02 -0700
From: erisson@kallisti.sw-tech.com (E.)
Subject: perl religion (was: Re: Which one is the best (pattern matching))
Message-Id: <slrn5hs1qu.634.erisson@kallisti.sw-tech.com>
Tom Phoenix <rootbeer@teleport.com> wrote:
> On 4 Mar 1997, Dylan Northrup wrote:
>
> > alt.religion.perl anyone?
>
> bless $you;
my ($child);
-E
--
PGP Public Key Fingerprint: BE FC C5 FB 30 47 E5 5C DC DF C3 C0 AD A5 27 17
Homepage: http://www.primenet.com/~fnargle/erisson/ PGP Key available here
"Every day is like burning paper." --Slimebard
"You have *not* 'plonked' me!" --Mario1
------------------------------
Date: Thu, 6 Mar 1997 10:00:01 +0000
From: charlie@antipope.org (Charlie Stross)
Subject: Re: PERL SendMail Function
Message-Id: <slrn5ht5d1.2sk.charlie@antipope.demon.co.uk>
<BLINK>Don't read news via web browsers<FONT FACE="WingDings"><FONT SIZE="+3">
DByersII<dbyersii@aol.com> wrote (in article <19970304233300.SAA01658@ladder01.news.aol.com>):
>Can anyone give me some help on using the SendMail function? I've
>attempted to use it in an HTML page and it doesn't function properly. Is
>there a special .dll file that must be resident on my NT Web Server? Any
>help with syntax and background would be greatly appreciated.
sendmail is a UNIX mail transport agent. Unless you've got a rather
heavily modified copy of NT, you simply don't have sendmail.
If you've got access to a remote UNIX box with an open SMTP port, you
can use the IO::Socket module to open a socket to the remote system
on port 25, then talk SMTP direct to it; or you can do it the easy
way via the Net::SMTP module. For help with syntax, see the documentation
that comes with the relevent modules; for information about sendmail,
see the book 'Sendmail' (by Bryan Costales, with Eric Allman and Neil
Rickert, pub. O'Reilly and Associates -- 2nd edition out now).
NB: from the phrasing of your question I'm not sure this advice will be
too helpful. (You've got a lot of learning ahead of you.) You'll find
a lot of this stuff easier (or at least, more consistent) if you give up
on Microsoft OS's in general and put an operating system like NetBSD,
Linux, or Plan 9, on your PC.
--
Charlie Stross charlie @ antipope.org http://www.antipope.org/
------------------------------
Date: Thu, 06 Mar 1997 12:31:22 +0000
From: mark@har.mrc.ac.uk (Mark Strivens)
Subject: Problem with installing Perl Modules
Message-Id: <331EB91A.3165@har.mrc.ac.uk>
I have been trying to install a number of Perl modules needed by
libwww, which are :
IO-#.## (bundled with perl5.004 and better)
libnet-#.##
MD5-#.##
So I dutifully went off to get these from CPAN and tried to install
them on my system (Sun SPARC 5 running Solaris 2.5.1)....
However I keep coming accross the same error messages...
1) perl Makefile.PL
this seems to go aheaperl Makefile.PL
> Checking if your kit is complete...
> Looks good
> Your perl and your Config.pm seem to have different ideas about the
> architecture
> they are running on.
> Perl thinks: []
> Config says: [sun4-solaris]
> This may or may not cause problems. Please check your installation of
> perl if you have problems building this extension.
> Writing Makefile for MD5
I'm not sure what the error about architecture means as I've not had
any problems before and everything was compiled and installed on the
same machine...
2) Run the make command and I get no errors until:
> Running Mkbootstrap for MD5 ()
> chmod 644 MD5.bs
> LD_RUN_PATH="" gcc -o blib/arch/auto/MD5/MD5.so -G -L/usr/local/lib
> -L/opt/local/lib MD5.o md5c.o
> gcc: Internal compiler error: program ld got fatal signal 8
> *** Error code 1
> make: Fatal error: Command failed for target `blib/arch/auto/MD5/
> MD5.so'
Any ideas? I've not had any problem with gcc or Perl before, as far
I'm aware... I could just install the latest version of Perl,
but I'd rather fix the problem with my current installation if
possible..
Many thanks for your time
Mark Strivens
--------------------
system info:
Summary of my perl5 (5.0 patchlevel 2) configuration:
Platform:
osname=solaris, osver=2.5, archname=sun4-solaris
uname='sunos jerry 5.5 generic sun4m sparc sunw,sparcstation-4 '
hint=recommended, useposix=true
Compiler:
cc='gcc', optimize='-O', gccversion=2.7.2
cppflags='-I/usr/local/include -I/opt/local/include'
ccflags ='-I/usr/local/include -I/opt/local/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=true
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=8, usemymalloc=y, randbits=15
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib -L/opt/local/lib'
libpth=/usr/local/lib /opt/local/lib /lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags=' '
cccdlflags='-fpic', lddlflags='-G -L/usr/local/lib -L/opt/local/lib'
@INC: /usr/local/lib/perl5/sun4-solaris/ /usr/local/lib/perl5
/usr/local/lib/perl5/site_perl/sun4-solaris
/usr/local/lib/perl5/site_perl /usr/local/lib/perl5/sun4-solaris .
--------------------------------------------------------------------
Mark Strivens Telephone : 01235-824 536 (direct line)
Informatics Group, 01235-834 393 (switchboard)
MRC, Harwell, email : mark@har.mrc.ac.uk
United Kingdom.
====================================================================
------------------------------
Date: Wed, 05 Mar 1997 22:44:51 -0800
From: Bill Stewart <billstewart@mail.att.net>
Subject: Re: Public domain DES and other crypto code in Perl?
Message-Id: <331E67E3.5850@mail.att.net>
Aviel Rubin wrote:
> We would like to be able to have a self-contained program where each
> user has all of the code, including the crypto, locally. So, are
> there any packages WRITTEN IN PERL for DES, etc.?
http://www.dcs.ex.ac.uk/~aba/rsa/ has Adam Back's page about
RSA in n lines of Perl, where n is now down to 2 for perl5, 3 for perl4.
There are short implementations of RC4, RC5, SHA, MD5, IDEA, OTP,
and a one-line Unix password cracker.
Steve Reid wrote a Prime Number Generator in perl,
and an RC4/SHA-1 based crypto program that's at
http://www.edmweb.com/steve/arcfour (It's about two pages long, but
much
more readable than the fewer-lines-of-perl-than-ever-before hacks.)
There's enough that someone who wants to put together the pieces
can easily enough do a one-page PGP-replacement;
maybe not with PGP-compatible data structures or syntax, but at least
with full-scale public-key encryption, symmetric encryption, and
signatures.
Easy to fax to your friends, and probably fits in half a page.
If you can trust RC4-based hashes (which is iffy), it's even shorter.
Another section from the page includes:
----------------------------------------------------------
Other diminutive crypto hacks
RSADSI's RC4 symmetric key stream cipher in 3 lines of PERL
Two versions of RC4 in C
RSADSI's RC5 symmetric key block cipher in 6 lines of PERL
RSADSI's MD5 message digest algorithm in 8 lines of PERL5 by John
Allen <allen@grumman.com>
The SHA SHA message digest algorithm in 8 lines of PERL5 by John
Allen <allen@grumman.com>
Diffie-Hellman key exchange in 10 lines of C an anonymous poster
Diffie-Hellman in 2 lines of perl (inspired by anonymous's C code)
Andrew Kuchling wrote a Python: RSA-in-4-lines-Python
IDEA in 448 bytes of 80x86 by Fauzan Mirza
<fauzanm@jumper.mcc.ac.uk>
One Time Pad in perl and C
Crack in 1 line of perl by Alec Muffett
-----------------------------------------------------------
Here's Steve Reid's prime number generator:
-----BEGIN PGP SIGNED MESSAGE-----
I've completed my Perl/dc RSA key generation program. The compacted
13-line version is below. A commented version can be found at
http://www.edmweb.com/steve/rsagen.txt
#!/usr/local/bin/perl
$k=768;$e=sprintf'%X',65537;print"Please enter a LOT of random junk.\n"
;$a=<STDIN>;print"Working. This may take a while.\n";for(1..(length($a)-
1)){$b[$_&31]^=unpack('C',substr($a,$_,1));$b[$_&31]=(($b[$_&31]<<5)|($b
[$_&31]>>3))&255;}for(0..255){$c[$_]=$_;}$a=$d=$f=0;for(0..255){$a=($a+
$c[$_]+$b[$a&31])&255;($c[$_],$c[$a])=($c[$a],$c[$_]);}open(F,'|dc');
select F;print"16dio[$e+]sa";for(1..50){for(1..$k/32){printf'%02X',&g;}
print"Sr";}for(1,2){printf'%02X',&g|128;for(2..$k/16){printf'%02X',&g;}
print"d$e%-2+d2%0=aSP";}print"[d2%SA2/d0<X+d*LA1=ZlP%0]sX[lR*]sZ[1+Q]sQ[
la1+sa0sc]sA[lAxlb1+sb]sB[ld1+sdLrddSssR1lP1-2/lXx+1+lP%99scd0=A2=Bclcla
+32>C]sC[LsSrld1-dsd0<D]sD[le1+se0ddsasbsdlCxlDxlP2 $e*+sPlc99=Elb32=ElP
2 $e*-led1>QQ]sE_1selExsq_1seLPlExsp[p=]Plpp[q=]Plqp[n=]P*p[e=]P$e p1-lp
1-lq1-**1+$e/[d=]Pp\n";close(F);sub g{$d=($d+1)&255;$f=($f+$c[$d])&255;(
$c[$d],$c[$f])=($c[$f],$c[$d]);return($c[($c[$d]+$c[$f])&255]);}
I'm sure this can be compacted further. I haven't put a lot of work into
compacting it; I really just want to get it out.
Run the program, type in a LOT of random gibberish (several lines at
least) and press enter. Then wait. Eventually it will output your p, q,
n,
e and d in hexadecimal.
p and q: Prime numbers, congruent to 2 mod e. They can usually be
discarded, but they should never be revealed.
n: Your public modulus
e: Your public encryption exponent (usually 10001 hex)
d: Your private decryption exponent
By default the program generates a 768-bit public modulus and a public
exponent of 10001 hex (65537 decimal). These can be changed by adjusting
the numbers in the first line. A 1024-bit modulus would be better, but
for
some reason generation takes a LOT longer than a 768-bit modulus.
Fortunately key generation doesn't need to be done very often.
Timings on a 100 MHz Pentium running FreeBSD:
Size of n Time
512-bit: 4-5 minutes
768-bit: 8-9 minutes
1024-bit: 35-80 minutes (ack!)
I've had some difficulty generating 1024-bit keys, but it seems to be
working now. Let me know if you see any problems generating large keys
other than the obvious problem with the time spent.
Disclaimer: This program seems to work, but your milage may vary.
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv
iQEVAwUBMqID5dtVWdufMXJpAQE14AgApqOI2MMPe0V74cKI0vc3bDw8hfDW723c
QKqVleH0MTIv4F792bf7ItekM81RbQiaB+AhSigFFFb679ZgdCV7XpPOwhkE3SD4
vJy1xU4HdZ6TbSrfzzZn8Peqd5K5zZdY7CpXbxW30TZWFNX5lqdDAAbvM77h36QC
h/jwK1nWMzrTDupbhBwemkpZKaFmk5uAms5Y94Ckezh66+sOcWmvf7smyn8RJg4q
zad6OVrclso22NBp/Pa0nf2+IdgFnhEfHgHxsI0t+awSokfr6WlZ8WAScxv40kJO
KfcdBX1DXg4spl8kXgoQOrrA3VIUJKWXFfpnTt2nAKr/P4XfbpyFQw==
=CY5F
-----END PGP SIGNATURE-----
------------------------------
Date: Thu, 6 Mar 1997 06:03:24 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: question of perl experts
Message-Id: <cqbmf5.lj.ln@localhost>
Patrick Quinn (patrick_quinn@mail.amsinc.com) wrote:
: My name is Patrick Quinn and I work for American Management Systems in
: Fairfax, Virginia and currently I am coding a real-time overall testing
: program. I have ran into a barrier while coding my test program. I two
: perl source files. A main, and a source file containing nothing but
: subroutines. My question is how to have my main program calls the
: subroutines not in the main program but in the second subroutine file
: for both Unix and NT development. If anyone has answers to this
: question, please let me by responding to this news message or by
: emailing directly and patrick_quinn@mail.amsinc.com.
Patrick,
If you don't want to be ignored, you should take the time to
put an actual subject in your Subject:
Nearly *every* post here is a question. Yours _certainly_ does
not require an "expert" to answer either.
There is an article posted regularly to this newsgroup on how
to pick good Subject lines.
If you don't want to be ignored, you should *not* post the same
question individually three times with different subjects.
Since you have the _two_ breaches of usual Usenet etiquette above,
I assume that you are a new user of Usenet. You are in luck! There
is a newsgroup specifically designed to help new folks know how
things are done here. To avoid appearing rude again, you might want
to monitor that newsgroup for a few weeks:
news.announce.newusers
Look up 'use' and 'require' in the perlfunc man page.
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Wed, 05 Mar 1997 17:01:37 -0700
From: Monte Mitzelfelt <monte@conchas.nm.org>
Subject: Re: Random Temp File in Perl 5.002
Message-Id: <331E0961.7D26@conchas.nm.org>
Mark Thompson wrote:
> I need to make a random temporary file, sortof like tmpnam() in C.
> Does Perl offer this functionality? If not, any suggestions on how to
> implement something like this?
You could try something like:
$tmp = 'aaaa' ;
$tmp++ while -e ( $tempfile = "/tmp/XXX$tmp" ) ;
open FILE, "> $tempfile" or die "Can't open $tempfile: $!" ;
Perl will increment the file name "automagically" and the while modifier
will keep doing this as long as a file with that name exists.
------------------------------
Date: Wed, 05 Mar 1997 20:56:32 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: ataide@planetarium.com.br
Subject: Re: Redirect compilation messages?
Message-Id: <331E4E80.4EE5@egames.com>
[courtesy reply emailed]
Efigenio Ataide wrote:
> How do I redirect compilation messages to a file?
The compilation messages are written to STDERR.
Redirecting stderr does the trick.
--
Devin Ben-Hur <dbenhur@egames.com>
eGames.com, Inc. http://www.egames.com/
eMarketing, Inc. http://www.emarket.com/
"Sometimes you just have to step in it and see if it stinks" O-
-- Sonia Orin Lyris
------------------------------
Date: Wed, 05 Mar 1997 23:25:41 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: Rand Simberg <simberg@interglobal.org>
Subject: Re: Stumped by Syntax Error!!!
Message-Id: <331E7175.5987@egames.com>
Rand Simberg wrote:
> Can anyone see what's wrong with this piece of code? I pulled it out
yep
> } 7#
> ############Syntax Error Shows Up Right Here!!!!
> close(WISH);
look at the line just above where you wrote
"############Syntax Error Shows Up Right Here!!!!"
Try:
} #7
instead. :)
HTH
--
Devin Ben-Hur <dbenhur@egames.com>
eGames.com, Inc. http://www.egames.com/
eMarketing, Inc. http://www.emarket.com/
"Sometimes you just have to step in it and see if it stinks" O-
-- Sonia Orin Lyris
------------------------------
Date: 06 Mar 1997 00:31:26 -0800
From: Jeff Coffin <jcoffin@cs.pdx.edu>
Subject: Re: Stumped by Syntax Error!!!
Message-Id: <m2zpwhpgkh.fsf@cs.pdx.edu>
>>>>> "Rand" == Rand Simberg <simberg@interglobal.org> writes:
Rand> Can anyone see what's wrong with this piece of code? I pulled
You're gonna hate to hear this, epsecially if you have(n't?) figured
it out already...
else { #13
print WISH "$wishline\n";
} #13
} 7# #
Here ^^
Should be #7 not 7#, but it's late and I know how you feel.
-jeff
------------------------------
Date: 6 Mar 1997 10:36:10 GMT
From: "Jeff Wilson" <jwilson@ic.ac.uk>
Subject: Re: Time and Date via Win95 Perl?
Message-Id: <01bc2a1a$34d7b780$1d34c69b@leicester.cc.ic.ac.uk>
You have to use localtime, i.e.,
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
--
Jeff Wilson
CCS ~ Imperial College ~
London UK
Jeff Dilcher <dilcher@mindspring.com> wrote in article
<331ec503.9084663@news.mindspring.com>...
> On Unix, I used to get date and time information by calls to the
> system:
>
> $time1 = `TZ=EST5EDT;export TZ;/bin/date '+%A %B %d, %Y.'`;
> $time2 = `TZ=EST5EDT;export TZ;/bin/date '+%H:%M %p EST.'`;
>
> However, with my Perl now running on a Windows box, I am unsure
> how to easily acquire the date and time. Seems like it should be
> simple, but I am stumped.
>
> Anyone give me a clue?
> Thanks!
>
> Jeff Dilcher
>
>
------------------------------
Date: Wed, 05 Mar 1997 17:29:04 -0700
From: Monte Mitzelfelt <monte@conchas.nm.org>
Subject: TN5250 module for perl...
Message-Id: <331E0FD0.77DF@conchas.nm.org>
I'm in the progress of writing a TN5250 module for perl. It's presently
functional enough to emulate a 5250 client and an http server for a
5250-via-the-web type function. The protocol is not entirely
implemented by any stretch of the imagination. If anyone is interested
in it, knows of an existing body of work (in C would even work),
understands IBM protocols in any way shape or form, etc, I'd be very
interested in talking to you. Please reply via email.
Thanks,
Monte Mitzelfelt
New Mexico Technet, Inc.
------------------------------
Date: Wed, 05 Mar 1997 23:52:16 -0400
From: Carl <ceklof@vt.edu>
Subject: Re: Win32::ODBC INSERT INTO <Access Database> fails,? Read-Only? <fwd>
Message-Id: <331E3F70.E8C@vt.edu>
> What about posting the Perl code that uses the above SQL INSERTs? Plus
> any error messages found by error checks after each Win32::ODBC request.
Sorry everyone if you read my posting and felt that you wasted your time
because I did not include enough information. I know I see that a lot.
So here are some Re:'s with my code and output!
There is <obviously> a calling routine, but it only calls ExecuteSQL
with the name of the database and the SQL INSERT command:
<code>
INSERT INTO [MyTable] ( [Date Listed], [Last Name], [First name] )
VALUES ('15-Jan-1997', "Eklof", "Carl");
</code>
as previously stated.
Thank you to everyone who posts helps!
-Carl
Here is what another very kind soul had to say, and my code:
And I quote:
<quote>
=================================================================
Mr Niceguy wrote:
> I'm unsure about your nomenclature. If your columns are actually
> called [First Name], and so on, then the SQL will fail because the
> column names need to have no spaces.
Oh, please god tell me you are joking or something! There are about 40+
fields with spaces! I am not sure what changing the names would do to
the rest of the database...(queries & such).
My field names are actually:
First name
Are you sure that putting the [] does not fix the problem with spaces in
the field names? I have been doing hundreds of queries successfully with
the [] around the field names.
Here is my code:
======================================================================
<code>
###########################################################
# ExcecuteSQL()
#
# This routine opens the given database and executes the
# sql statment given as the second parameter. Then CLOSES THE
# DATABASE.
#
# Example: ExcecuteSQL("mydatabase", "DELETE * FROM [mytable]");
###########################################################
sub ExecuteSQL {
$dataBase =
$_[0]; #
Accept a string as the first parameter of
two
$sqlStatement = $_[1]; # Accept a
string as the first and only
parameter
local( $rc );
if (!($db = new Win32::ODBC("VTOCH"))){ # OPEN A CONNECTION
print "Failure to open database. \n\n";
return
0;
# if not opened do not proceed
}
else {
print "Executing sql statement!<br>\n";
}
$rc = $db->Sql( $sqlStatement ); # Connected,
execute sql
# die qq(SQL failed "$stmt": ), $db->Error(), qq(\n) if $rc;
if(defined($rc))
{
($ErrNum, $ErrText, $ErrConn) = $db->Error();
@cause = $db->Error();
print "SQL Failed with cause: @cause<br>\n";
print "SQL Failed with CODES: ($ErrNum, $ErrText,
$ErrConn)<br>\n";
} else {
print "SQL excecuted successfully\n<br>";
}
$db->Close();
}
======================================================================
My output is:
F:\website\cgi-shl>perl -w todbc.pl
Content-type: text/html
<html>
<head>
<title>Insert Results</title>
</head>
<body>
<h1>Insert Results</h1>
<H1>Your Insertion was....</H1><BR>
Executing sql statement!<br>
SQL Failed with cause: 1 INSERT INTO [Need place] ( [Date Listed], [Last
Name],
[First name] ) SELECT '15-Jan-1997', "Eklof", "Carl" 1<br>
SQL Failed with CODES: (1, INSERT INTO [Need place] ( [Date Listed],
[Last Name]
, [First name] ) SELECT '15-Jan-1997', "Eklof", "Carl", 1)<br>
</body>
</html>
======================================================================
</code>
> Additionally, I've found that even if your table
> name in Access is mixed caps, it needs to be all caps in SQL.
As you can see, my table name has spaces and is in mixed caps. But,
agian this has been fine for queries!?
> If you can give the ODBC error code, it may help things along a bit in
> determining where the error is.
What I have given above is all of my output with some extra html that
gets spit out from the calling routine. All I get is "1" with my sql
statement spit back at me!?
Please let me know if the spaces are the problem! If not, what is! And
if you happen to know off hand how to get a meaningful error code, that
would be really helpful.
THANK YOU VERY, VERY MUCH for helping!!! REALLY.
-Carl
======================================================================
</quote>
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.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 61
************************************