[19629] in Perl-Users-Digest
Perl-Users Digest, Issue: 1824 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 26 18:05:46 2001
Date: Wed, 26 Sep 2001 15:05:15 -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: <1001541915-v10-i1824@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 26 Sep 2001 Volume: 10 Number: 1824
Today's topics:
Re: [ASK[ Perl and Windows <skj@iobox.fi>
Re: A pack() question nobull@mail.com
Re: add to: threads <iltzu@sci.invalid>
AoA(LoL) Sorting <jclover@nati.org>
Re: AoA(LoL) Sorting <tsee@gmx.net>
Re: AoA(LoL) Sorting <mjcarman@home.com>
Re: AoA(LoL) Sorting <mjcarman@home.com>
Re: Cannot run perl scripts in Apache when file opened <alan@scotlpuk.com>
Re: emailing contents of text file (Abigail)
Encrypt/Decrypt (J G)
Re: Encrypt/Decrypt <miller5286@usenetserver.com>
Re: Encrypt/Decrypt <tsee@gmx.net>
Re: Encrypt/Decrypt <tsee@gmx.net>
Re: Encrypt/Decrypt (David Wall)
Re: Encrypt/Decrypt <mjcarman@home.com>
Re: exec call | mpack evan.cooch@NOSPAMcornell.edu
Re: exec call | mpack (Abigail)
Re: exec call | mpack evan.cooch@NOSPAMcornell.edu
How do you get the script own name? <julius_mong@hotmail.com>
Re: How do you get the script own name? nobull@mail.com
Re: How do you get the script own name? (David Wall)
Re: How do you get the script own name? (John J. Trammell)
Re: How do you get the script own name? <Thomas@Baetzler.de>
Re: Is there a better way to do this?? (Mark Jason Dominus)
Re: Is there a better way to do this?? <uri@sysarch.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 26 Sep 2001 18:25:03 +0300
From: Sami Jarvinen <skj@iobox.fi>
Subject: Re: [ASK[ Perl and Windows
Message-Id: <MPG.161ad1ef993aa6849896c1@news.yhteys.mtv3.fi>
Subject: Re: [ASK[ Perl and Windows
From: Sami Jarvinen <skj@iobox.fi>
Newsgroups: comp.lang.perl.misc
Bob Walton <bwalton@rochester.rr.com> wrote
> "¤ßÂĊ Dennis" wrote:
> > How can a PERL script only show at tray-icon without text-console?????
>
> but it might. You might also be able to write a C-language stub that
> would fire up Perl without the annoying black window. Or if you put a
> "use Tk;" in your program, the annoying black window will show for only
> a bit. You might also be able to create a shortcut that specifies the
> program be run minimized, and, if it is fired up via that shortcut, it
> would run minimized. There are probably other ways, too.
Indeed there is. ActivePerl comes with a nice program called 'wperl.exe'
which, unlike 'perl.exe', is not a console application, i.e. it won't
create a shell window.
------------------------------
Date: 26 Sep 2001 17:39:15 +0100
From: nobull@mail.com
Subject: Re: A pack() question
Message-Id: <u9u1xpvrd8.fsf@wcl-l.bham.ac.uk>
stanb@panix.com (Stan Brown) writes:
> Could someon explain the following line to me?
>
> my @row = unpack( "w/a*" x $num_of_fields, $rest );>
> I;v looked at the pack() section the O'Rielly "Programing Perl" book, and I
> don see what the "w/" portion does.
There is a property of books that to seem not to know about. This is
that they don't automatically receive updates. The on-line manauals,
on the other hand, get updated whenever you update Perl. So... look
at the pack() section in the on-line manuals to see explainations of
features that post-date the book.
The `/' template character allows packing
and unpacking of strings where the packed
structure contains a byte count followed
by the string itself. You write length-
item`/'string-item.
The length-item can be any `pack' template
letter, and describes how the length value
is packed. The ones likely to be of most
use are integer-packing ones like `n' (for
Java strings), `w' (for ASN.1 or SNMP) and
`N' (for Sun XDR).
The string-item must, at present, be
`"A*"', `"a*"' or `"Z*"'. For `unpack'
the length of the string is obtained from
the length-item, but if you put in the '*'
it will be ignored.
unpack 'C/a', "\04Gurusamy"; gives 'Guru'
unpack 'a3/A* A*', '007 Bond J '; gives (' Bond','J')
pack 'n/a* w/a*','hello,','world'; gives "\000\006hello,\005world"
The length-item is not returned explicitly
from `unpack'.
Adding a count to the length-item letter
is unlikely to do anything useful, unless
that letter is `A', `a' or `Z'. Packing
with a length-item of `a' or `Z' may
introduce `"\000"' characters, which Perl
does not regard as legal in numeric
strings.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 26 Sep 2001 16:52:52 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: add to: threads
Message-Id: <1001522948.21049@itz.pp.sci.fi>
In article <20010926180028.03d3260b.mb@buntstift.at>, Buchleitner Martin wrote:
>
>I read very much about the use of fork.
>But i always found examples with servers.
>
>has somebody an example where fork is used
>with sockets ?
"I read very much about eating popcorn. But I've only read about
popcorn being eaten in movies. Does anyone have examples of popcorn
being eaten off a plate?"
Seriously, your question is too vague, and confuses too many unrelated
things, for us to guess what exactly you're asking about.
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post something,
we discuss its implications. If the discussion happens to answer a question
you've asked, that's incidental." -- nobull in comp.lang.perl.misc
------------------------------
Date: Wed, 26 Sep 2001 14:20:28 -0500
From: "Jonathan Clover" <jclover@nati.org>
Subject: AoA(LoL) Sorting
Message-Id: <tr4a47l8co31b2@corp.supernews.com>
Okay I have the folowing code below that reads in the Log file similar to
that which is also appended below into an array of an array (or list of
list). Now I really want to accomplish the task of sorting this table(of
sorts) by the user column, but am unsure on how to accomplish such a task.
Please help!
Jonathan Clover
NATI
P.S. The actual log file of which will be read in is currently 788 lines and
growing.
########
##CODE##
########
#!/usr/bin/perl -w
use strict;
use Fcntl qw( :DEFAULT :flock);
open (TEMP, "cpg/logs/movement_log.dat") || die("Cannot open temporary
file(1): ".$!);
flock(TEMP, LOCK_EX) || die("Cannot flock movement_log file(1): ".$!);
my (@tmp, @log);
my ($i, $j);
while(<TEMP>) { ###Print out Movement Log###
chomp($_);
@tmp = split /, /, $_;
push @log, [ @tmp ];
}
#######
##LOG##
#######
Time, User, Session, Function, Browser
00:41:27 9/22/101, rcase, 8, get_quiz, Mozilla/4.0 (compatible; MSIE 5.5;
MSN 2.5; Windows 98)
00:43:00 9/22/101, rcase, 8, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
01:29:20 9/22/101, rcase, 8, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
01:30:48 9/22/101, rcase, 8, get_quiz, Mozilla/4.0 (compatible; MSIE 5.5;
MSN 2.5; Windows 98)
01:41:55 9/22/101, rcase, 8, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
01:42:29 9/22/101, rcase, 9, L_Wrng_Sess, Mozilla/4.0 (compatible; MSIE 5.5;
MSN 2.5; Windows 98)
01:42:29 9/22/101, rcase, 9, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
01:44:23 9/22/101, rcase, 8, get_quiz, Mozilla/4.0 (compatible; MSIE 5.5;
MSN 2.5; Windows 98)
02:54:13 9/22/101, rcase, 8, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
02:57:37 9/22/101, rcase, 8, get_quiz, Mozilla/4.0 (compatible; MSIE 5.5;
MSN 2.5; Windows 98)
03:13:16 9/22/101, rcase, 9, L_Wrng_Sess, Mozilla/4.0 (compatible; MSIE 5.5;
MSN 2.5; Windows 98)
03:13:16 9/22/101, rcase, 9, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
13:43:08 9/22/101, rcase, 8, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
13:44:23 9/22/101, rcase, 8, get_quiz, Mozilla/4.0 (compatible; MSIE 5.5;
MSN 2.5; Windows 98)
19:06:30 9/23/101, rcase, 8, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
09:51:28 9/24/101, mvangin, 2, login, Mozilla/4.0 (compatible; MSIE 5.0; AOL
6.0; Windows 95; DigExt)
16:52:57 9/24/101, rcase, 9, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
16:53:28 9/24/101, rcase, 8, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
19:25:52 9/24/101, rcase, 8, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
19:55:20 9/24/101, rcase, 8, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
20:25:02 9/24/101, rcase, 8, quiz_taken, Mozilla/4.0 (compatible; MSIE 5.5;
MSN 2.5; Windows 98)
20:25:11 9/24/101, rcase, 9, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
21:07:18 9/24/101, rcase, 8, quiz_taken, Mozilla/4.0 (compatible; MSIE 5.5;
MSN 2.5; Windows 98)
21:07:21 9/24/101, rcase, 9, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
21:18:30 9/24/101, rcase, 9, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
22:20:09 9/24/101, rcase, 9, get_quiz, Mozilla/4.0 (compatible; MSIE 5.5;
MSN 2.5; Windows 98)
23:20:57 9/24/101, rcase, 9, get_quiz, Mozilla/4.0 (compatible; MSIE 5.5;
MSN 2.5; Windows 98)
21:48:16 9/25/101, rcase, 9, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
22:24:49 9/25/101, rcase, 9, get_quiz, Mozilla/4.0 (compatible; MSIE 5.5;
MSN 2.5; Windows 98)
01:00:02 9/26/101, rcase, 9, get_quiz, Mozilla/4.0 (compatible; MSIE 5.5;
MSN 2.5; Windows 98)
01:03:30 9/26/101, rcase, 10, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
01:14:12 9/26/101, rcase, 10, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
01:17:16 9/26/101, rcase, 10, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
01:18:56 9/26/101, rcase, 11, L_Wrng_Sess, Mozilla/4.0 (compatible; MSIE
5.5; MSN 2.5; Windows 98)
01:18:56 9/26/101, rcase, 11, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
01:19:35 9/26/101, rcase, 9, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
01:23:48 9/26/101, rcase, 10, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
01:26:39 9/26/101, rcase, 10, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
01:45:55 9/26/101, rcase, 10, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
01:51:53 9/26/101, rcase, 10, login, Mozilla/4.0 (compatible; MSIE 5.5; MSN
2.5; Windows 98)
09:26:52 9/26/101, rcase, 10, login, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:36:52 9/26/101, nati, 0, login, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:36:58 9/26/101, nati, , L_Fnsh_Int, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:36:58 9/26/101, nati, 1, login, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:38:56 9/26/101, nati, 9, Wrong Session, Mozilla/4.0 (compatible; MSIE
5.5; Windows NT 5.0)
09:42:08 9/26/101, nati, 1, get_quiz, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:43:49 9/26/101, nati, 2, login, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:44:02 9/26/101, nati, 2, get_quiz, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:44:26 9/26/101, nati, 3, login, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:44:39 9/26/101, nati, 3, get_quiz, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:45:13 9/26/101, nati, 3, get_quiz, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:45:38 9/26/101, nati, 4, login, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:45:56 9/26/101, nati, 4, No quiz, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:46:00 9/26/101, nati, 5, login, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:51:20 9/26/101, nati, 5, get_quiz, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:52:49 9/26/101, nati, 6, login, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:52:59 9/26/101, nati, 6, get_quiz, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:53:37 9/26/101, nati, 7, login, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:53:54 9/26/101, nati, 7, No quiz, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
09:53:57 9/26/101, nati, 8, login, Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0)
------------------------------
Date: Wed, 26 Sep 2001 22:21:30 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: AoA(LoL) Sorting
Message-Id: <9otdcj$inj$01$1@news.t-online.com>
"Jonathan Clover" <jclover@nati.org> schrieb im Newsbeitrag
news:tr4a47l8co31b2@corp.supernews.com...
> Okay I have the folowing code below that reads in the Log file similar to
> that which is also appended below into an array of an array (or list of
> list). Now I really want to accomplish the task of sorting this table(of
> sorts) by the user column, but am unsure on how to accomplish such a task.
[snip]
> #!/usr/bin/perl -w
> use strict;
good. That makes me consider trying to help :)
> use Fcntl qw( :DEFAULT :flock);
>
> open (TEMP, "cpg/logs/movement_log.dat") || die("Cannot open temporary
> file(1): ".$!);
> flock(TEMP, LOCK_EX) || die("Cannot flock movement_log file(1): ".$!);
>
> my (@tmp, @log);
> my ($i, $j);
> while(<TEMP>) { ###Print out Movement Log###
> chomp($_);
> @tmp = split /, /, $_;
> push @log, [ @tmp ];
> }
>
This could rather be:
my @log;
while(<DATA>) {
chomp;
push( @log, [ split( ', ', $_ ) ] );
}
The most important change would be /, / to ', '. Don't use re's where you
don't need them.
[snip]
Data format:
> Time, User, Session, Function, Browser
[snip completely unnecessary loads of data]
Now to your question:
#!perl -w
use strict;
use warnings;
my @log;
while(<DATA>) {
chomp;
push( @log, [ split( ', ', $_) ] );
}
@log = sort { $a->[1] cmp $b->[1] } @log;
# ^^^ ^^^
# compare the second element of the log entry.
foreach ( @log ) { print $_->[1]."\n" }
__DATA__
vaa, dda, asd, aaddd, sadd
faa, bda, asd, caddd, sadd
gaa, cda, asd, aaddd, aadd
faa, ada, asd, aaddd, sadd
Seems to work fine ;)
Umm:
perldoc -f sort
Steffen
------------------------------
Date: Wed, 26 Sep 2001 15:27:03 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: AoA(LoL) Sorting
Message-Id: <3BB23A17.E1D3F7EA@home.com>
Jonathan Clover wrote:
>
> Now I really want to accomplish the task of sorting this table(of
> sorts) by the user column, but am unsure on how to accomplish such
> a task.
Read the FAQ, Luke.
perldoc -q sort
Found in perlfaq4.pod
How do I sort an array by (anything)?
...
> P.S. The actual log file of which will be read in is currently
> 788 lines and growing.
If the file will get large (where "large" is an amount relative to your
system resources) you may want to look into a disk-based sort. i.e. sort
without reading the whole file into memory first.
> Time, User, Session, Function, Browser
> 00:41:27 9/22/101, rcase, 8, get_quiz, Mozilla/4.0 (compatible;
^^^
Looks like somebody failed to read the localtime/gmtime documentation.
-mjc
------------------------------
Date: Wed, 26 Sep 2001 15:47:12 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: AoA(LoL) Sorting
Message-Id: <3BB23ED0.DB6FCB75@home.com>
"Steffen Müller" wrote:
>
> "Jonathan Clover" <jclover@nati.org> schrieb im Newsbeitrag
> news:tr4a47l8co31b2@corp.supernews.com...
> >
> > my (@tmp, @log);
> > while(<TEMP>) { ###Print out Movement Log###
> > chomp($_);
> > @tmp = split /, /, $_;
> > push @log, [ @tmp ];
> > }
> >
>
> This could rather be:
>
> my @log;
> while(<DATA>) {
> chomp;
> push( @log, [ split( ', ', $_ ) ] );
> }
>
> The most important change would be /, / to ', '. Don't use re's
> where you don't need them.
It's still a regex because that's what split() expects. You've just used
a different delimiter.
-mjc
------------------------------
Date: Wed, 26 Sep 2001 16:33:25 +0100
From: "Alan Fleming" <alan@scotlpuk.com>
Subject: Re: Cannot run perl scripts in Apache when file opened via Samba
Message-Id: <7Cms7.8049$L4.1570903@news6-win.server.ntlworld.com>
I've come across a similar problem to this. When I open a file which has
been created on a linux box in notepad, there are no end of line characters,
only unrecognised character symbols (the rectangular box) and the text is
one long line. However, if I open the same file in wordpad, the lines all
look correct and have no unrecognised characters. Could wordpad solve this
problem?
Alan
--
www.ScotLPUK.com
"IICS" <andytolley@hotmail.com> wrote in message
news:1001491129.16583.0.nnrp-10.c1ed7194@news.demon.co.uk...
> Doesnt Windoze use the wrong end of line terminators (\r\n isnt it) and
*nux
> only uses \n
>
> Ive had this problem before and its basically to do with the above. If
you
> open the same file on your linux box and check the end of the line you
might
> find you have got ^M at the end of each line.
>
> There is a way of stripping out the characters from the linux command line
> but you will have to ask one of the linux boffins what it is, other than
> that you could manually remove them using the linux text editor.
>
> Hope this Helps.
>
> IICS
>
> "AcCeSsDeNiEd" <dillon@rm_accessdenied.darktech.org> wrote in message
> news:3bad902e.4418892@news.cyberway.com.sg...
> > On Mon, 17 Sep 2001 15:13:58 GMT, jonadab@bright.net (Jonadab the
> Unsightly One) wrote:
> >
> > >are you using
> > >Notepad or something? (Repeat this mantra: "dontusenotepad")
> >
> > Notepad was just one of them.
> >
> >
> > >Now, if a program opens, reads, and then closes a file
> > >and *then* Apache can't read it, that would have to be
> > >a Samba problem, I think.
> >
> > I can open a file, and close it without saving it, still gives the
> problem.
> > I can even save it and close it, no joy
> >
> > I think it might be a Samba problem.
> > But in the meantime, what I do is copy the file to my local
> > drive, then edit from there. Later copy it to the samba/apache network
> drive.
> > No complaints here.
> >
> > To e-mail me, remove "rm_"
>
>
------------------------------
Date: 26 Sep 2001 21:03:07 GMT
From: abigail@foad.org (Abigail)
Subject: Re: emailing contents of text file
Message-Id: <slrn9r4ghq.l6l.abigail@alexandra.xs4all.nl>
Dave Tweed (dtweed@acm.org) wrote on MMCMXLVIII September MCMXCIII in
<URL:news:3BB1D0C9.17819F9@acm.org>:
?? Garry Williams wrote:
?? > <s_tougard@hotmail.com> wrote:
?? > > open(IN,"<file_email") or die $!;
?? >
?? > Good that you check the result of open. Bad that your error message
?? > will be quite ambiguous.
??
?? Not all that ambiguous; by leaving off the newline, the die will also
?? print the file and line number where it happened. In this case, since
?? the filename is hard-coded, that's all you need.
??
?? I often do something like this during script development, or for quickie
?? one-off scripts. Later, after the script is more polished, I'll go back
?? and add messages (or internal error handling) that make more sense from
?? the user's point of view.
Sounds like a lot of extra work to me, and it makes it easy to miss
some messages.
my $file = "file_email";
open IN, $file or die "Failed to open $file: $!\n";
is a lot less work to type it in correct the first time, then to cut
corners first, and later go in and fix it.
I'd find the line number were the die happens mostly useless in this
case; if the open fails, the problem is most likely with the file,
not the program.
Abigail
--
perl -wle 'eval {die [[qq [Just another Perl Hacker]]]};; print
${${${@}}[$#{@{${@}}}]}[$#{${@{${@}}}[$#{@{${@}}}]}]'
------------------------------
Date: 26 Sep 2001 13:14:05 -0700
From: justin@desertedge.com (J G)
Subject: Encrypt/Decrypt
Message-Id: <dd6675f4.0109261214.262c01b1@posting.google.com>
I need to be pointed to a simple tool that allows me to take simple
text, such as a login and password, and encrypt it (to be stored in a
database.) Then obviously, I'd like to Un-encrypt that information.
Any advise on a a simple perl module for this?
Note: I've been using Unix Crypt, but as you all know, this does not
allow an un-encrypt.
------------------------------
Date: Wed, 26 Sep 2001 16:40:22 -0400
From: "Mike Miller" <miller5286@usenetserver.com>
Subject: Re: Encrypt/Decrypt
Message-Id: <3bb21ef9$1_1@Usenet.com>
"J G" <justin@desertedge.com> wrote in message
news:dd6675f4.0109261214.262c01b1@posting.google.com...
> I need to be pointed to a simple tool that allows me to take simple
> text, such as a login and password, and encrypt it (to be stored in a
> database.) Then obviously, I'd like to Un-encrypt that information.
> Any advise on a a simple perl module for this?
>
> Note: I've been using Unix Crypt, but as you all know, this does not
> allow an un-encrypt.
Try the Cyrpt::Simple module available from CPAN.
http://search.cpan.org/search?dist=Crypt-Simple
-- Mike Miller
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Wed, 26 Sep 2001 22:32:08 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: Encrypt/Decrypt
Message-Id: <9otdvk$l8s$02$1@news.t-online.com>
"J G" <justin@desertedge.com> schrieb im Newsbeitrag
news:dd6675f4.0109261214.262c01b1@posting.google.com...
> I need to be pointed to a simple tool that allows me to take simple
> text, such as a login and password, and encrypt it (to be stored in a
> database.) Then obviously, I'd like to Un-encrypt that information.
> Any advise on a a simple perl module for this?
>
> Note: I've been using Unix Crypt, but as you all know, this does not
> allow an un-encrypt.
Okay. To decrypt something, you'll need the key that you used to encrypt it.
Say the key is 128 bit (which isn't necessarily enough - especially if you
will face dictionary attacks). That means you'll have to store the 128 bit
securely or everybody will be able to decrypt the data.
Why not store the data securely in the first place?
Other than that, I suggest looking at CPAN:
http://search.cpan.org/search?mode=module&query=crypt gives you a buttload
of modules.
Steffen
------------------------------
Date: Wed, 26 Sep 2001 22:52:23 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: Encrypt/Decrypt
Message-Id: <9otf71$lt8$01$1@news.t-online.com>
"David Wall" <darkon@one.net> schrieb im Newsbeitrag
news:Xns9128AA5FCF3B8darkononenet@207.126.101.97...
> So is "buttload" one of those Perl culture terms like JAPH or Schwartzian
> Transform?
Maybe just bad English?
Steffen
------------------------------
Date: Wed, 26 Sep 2001 20:45:35 -0000
From: darkon@one.net (David Wall)
Subject: Re: Encrypt/Decrypt
Message-Id: <Xns9128AA5FCF3B8darkononenet@207.126.101.97>
"Steffen Müller" <tsee@gmx.net> wrote on 26 Sep 2001:
>
> Other than that, I suggest looking at CPAN:
> http://search.cpan.org/search?mode=module&query=crypt gives you a
> buttload of modules.
So is "buttload" one of those Perl culture terms like JAPH or Schwartzian
Transform?
CPAN> install Bundle::Buttload
--
David Wall
darkon@one.net
------------------------------
Date: Wed, 26 Sep 2001 15:39:24 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Encrypt/Decrypt
Message-Id: <3BB23CFC.BBC8101E@home.com>
J G wrote:
>
> I need to be pointed to a simple tool that allows me to take simple
> text, such as a login and password, and encrypt it (to be stored in a
> database.) Then obviously, I'd like to Un-encrypt that information.
> Any advise on a a simple perl module for this?
Abhijit Menon-Sen had a recent article about symmetric cryptography on
Perl.com:
http://www.perl.com/pub/a/2001/07/10/crypto.html
> Note: I've been using Unix Crypt, but as you all know, this does
> not allow an un-encrypt.
This is how you should be encrypting psswords. You don't want people to
be able to decrypt them. If you need to check whether or not a submitted
password is valid, you encrypt the submission and compare it against the
encrypted copy in your database.
-mjc
------------------------------
Date: Wed, 26 Sep 2001 15:29:45 GMT
From: evan.cooch@NOSPAMcornell.edu
Subject: Re: exec call | mpack
Message-Id: <3bb1f442.63121504@newsstand.cit.cornell.edu>
On Wed, 26 Sep 2001 15:00:23 +0200, =?ISO-8859-1?Q?Thomas_B=E4tzler?=
<Thomas@Baetzler.de> wrote:
>On Wed, 26 Sep 2001 12:36:03 GMT, evan.cooch@NOSPAMcornell.edu wrote:
>>I wrote several perl scripts for handling file upoads via a webpage,
>>using an exec function call to mpack to MIME encode the uploaded file
>>before mailing it to me.
>
>Any particular reason why you don't use MIME::Lite and Net::SMTP?
>
>That way, you could set up a valid From: header for the body.
>
Because until your post, I wasn't aware of either! Thanks! I'll check
them out. I'd been using mpack for years - it works fine, with the
noted limit.
------------------------------
Date: 26 Sep 2001 21:04:09 GMT
From: abigail@foad.org (Abigail)
Subject: Re: exec call | mpack
Message-Id: <slrn9r4gjo.l6l.abigail@alexandra.xs4all.nl>
evan.cooch@NOSPAMcornell.edu (evan.cooch@NOSPAMcornell.edu) wrote on
MMCMXLVIII September MCMXCIII in <URL:news:3bb1cafa.52551636@newsstand.cit.cornell.edu>:
|| Grettings -
||
|| I wrote several perl scripts for handling file upoads via a webpage,
|| using an exec function call to mpack to MIME encode the uploaded file
|| before mailing it to me.
||
|| However, I'm not able to figure out an easy way to prevent the mail
|| coming in from 'nobody'. Basically, any process run by the perl script
|| assigns nobody as the owner, and thus any mail mpack sends out from
|| the exec(mpack) call comes in from nobody, which is a pain to
|| reply-to: I end up having to parse the note to find the users real
|| email address (which is a form variable), and then paste that in place
|| manually for the reply.
||
|| Anyone know a simple workaround?
That's why there's a Reply-To header.
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
------------------------------
Date: Wed, 26 Sep 2001 21:51:09 GMT
From: evan.cooch@NOSPAMcornell.edu
Subject: Re: exec call | mpack
Message-Id: <3bb24daf.964555@newsstand.cit.cornell.edu>
On 26 Sep 2001 21:04:09 GMT, abigail@foad.org (Abigail) wrote:
>evan.cooch@NOSPAMcornell.edu (evan.cooch@NOSPAMcornell.edu) wrote on
>MMCMXLVIII September MCMXCIII in <URL:news:3bb1cafa.52551636@newsstand.cit.cornell.edu>:
>|| Grettings -
>||
>|| I wrote several perl scripts for handling file upoads via a webpage,
>|| using an exec function call to mpack to MIME encode the uploaded file
>|| before mailing it to me.
>||
>|| However, I'm not able to figure out an easy way to prevent the mail
>|| coming in from 'nobody'. Basically, any process run by the perl script
>|| assigns nobody as the owner, and thus any mail mpack sends out from
>|| the exec(mpack) call comes in from nobody, which is a pain to
>|| reply-to: I end up having to parse the note to find the users real
>|| email address (which is a form variable), and then paste that in place
>|| manually for the reply.
>||
>|| Anyone know a simple workaround?
>
>That's why there's a Reply-To header.
>
>
>
>Abigail
Not possible with mpack - but apparently with the other alternatives
mentioned. mpack doesn't let you specify a reply to...
------------------------------
Date: Wed, 26 Sep 2001 16:08:37 +0100
From: "Dr Joolz" <julius_mong@hotmail.com>
Subject: How do you get the script own name?
Message-Id: <9osr1u$jvo$1@oyez.ccc.nottingham.ac.uk>
Dear all, I've tried the supposedly global var $PROGRAM_NAME or $O but it
returns nothing, there's nothing useful in %ENV I'm trying to find out the
running Perl script's own filename... any ideas?
Thanks,
Jules
***24 hours in a day...24 beers in a case...coincidence?***
------------------------------
Date: 26 Sep 2001 17:56:48 +0100
From: nobull@mail.com
Subject: Re: How do you get the script own name?
Message-Id: <u9ofnxvqjz.fsf@wcl-l.bham.ac.uk>
"Dr Joolz" <julius_mong@hotmail.com> writes:
> Dear all, I've tried the supposedly global var $PROGRAM_NAME or $O but it
> returns nothing,
It's $0 nt $O. (That's zero not oh).
> there's nothing useful in %ENV I'm trying to find out the
> running Perl script's own filename... any ideas?
PSI::ESP tells me you may also want to see the FindBin module.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 26 Sep 2001 15:40:37 -0000
From: darkon@one.net (David Wall)
Subject: Re: How do you get the script own name?
Message-Id: <Xns912876AB1185Edarkononenet@207.126.101.97>
"Dr Joolz" <julius_mong@hotmail.com> wrote on 26 Sep 2001:
> Dear all, I've tried the supposedly global var $PROGRAM_NAME or $O but
> it returns nothing, there's nothing useful in %ENV I'm trying to find
> out the running Perl script's own filename... any ideas?
$PROGRAM_NAME only works if load the English module with
use English;
first. Unless you create it, there isn't a $O -- what you want is $0.
That's a zero, not the letter O.
--
David Wall
darkon@one.net
------------------------------
Date: Wed, 26 Sep 2001 10:46:47 -0500
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: How do you get the script own name?
Message-Id: <slrn9r3u37.bol.trammell@haqq.hypersloth.net>
On Wed, 26 Sep 2001 16:08:37 +0100, Dr Joolz <julius_mong@hotmail.com> wrote:
> Dear all, I've tried the supposedly global var $PROGRAM_NAME or $O but it
That's $0 (zero), not $O (oh). Did you use English? Show code, please.
--
ultimate_answer_t deep_thought(void) { sleep(years2secs(7500000)); return 42; }
------------------------------
Date: Wed, 26 Sep 2001 17:46:49 +0200
From: =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
Subject: Re: How do you get the script own name?
Message-Id: <ert3rtoqj11nhi6gmeb1i8q6nlpnk81kft@4ax.com>
On Wed, 26 Sep 2001 16:08:37 +0100, "Dr Joolz"
<julius_mong@hotmail.com> wrote:
>Dear all, I've tried the supposedly global var $PROGRAM_NAME or $O but it
>returns nothing, there's nothing useful in %ENV I'm trying to find out the
>running Perl script's own filename... any ideas?
Yes.
perl -w and use strict; would have told you that $O is not a defined
variable. You might have noticed that it's really $0 (in words: zero).
As for $PROGRAM_NAME, let's her it from perlvar:
Nevertheless, if you wish to use long
variable names, you need only say
use English;
That's another undefined variable that warnings would've caught.
HTH,
--
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl
------------------------------
Date: Wed, 26 Sep 2001 17:34:08 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Is there a better way to do this??
Message-Id: <3bb2118f.27f4$28c@news.op.net>
In article <x7zo7i9fus.fsf@home.sysarch.com>,
Uri Guttman <uri@sysarch.com> wrote:
>the OP didn't show the clauses so i assumed one
He did show the clauses.
--
@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: Wed, 26 Sep 2001 21:18:59 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Is there a better way to do this??
Message-Id: <x7r8stabvm.fsf@home.sysarch.com>
>>>>> "MJD" == Mark Jason Dominus <mjd@plover.com> writes:
MJD> In article <x7zo7i9fus.fsf@home.sysarch.com>,
MJD> Uri Guttman <uri@sysarch.com> wrote:
>> the OP didn't show the clauses so i assumed one
MJD> He did show the clauses.
ooops. i didn't go back far enough in the thread.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
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 1824
***************************************