[16226] in Perl-Users-Digest
Perl-Users Digest, Issue: 3638 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 12 14:11:04 2000
Date: Wed, 12 Jul 2000 11:10:29 -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: <963425429-v9-i3638@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 12 Jul 2000 Volume: 9 Number: 3638
Today's topics:
Creating an ordered HoH <mjcarman@home.com>
Re: Creating an ordered HoH <lauren_smith13@hotmail.com>
Re: Crypt() authentication not working for me... mexicanmeatballs@my-deja.com
Crypt() not working for me <egberts@mac.com>
Re: cwd() for DOS <laura@hvcomputer.com>
Email Attachments in Perl (no modules) <mdubreu@atos-group.com>
Re: Embedding Logo (images) in Email generated by Perl <jboes@eoexchange.com>
Re: executing system commands via cgi? <kjetilskotheim@iname.com>
fork function <Y17507@qub10.mot.com>
hashes & variables andrei@unforgettable.com
Re: HELP! Problem with warning on filehandle <ed@nospam.com>
Re: HELP! Problem with warning on filehandle <ed@nospam.com>
hohoh:how create & do I really need? ollie_spencer@my-deja.com
Re: hohoh:how create & do I really need? (Andrew Johnson)
Re: include my sub in @INC <lsloan@umich.edu>
Re: Intercept MSDOS messages (Malcolm Dew-Jones)
Killing a called program (Phil Tomson)
Re: Method to obfuscate or disguise Perl source code? <jboes@eoexchange.com>
Re: Method to obfuscate or disguise Perl source code? (Greg Snow)
metrics <nkh@cpen.com>
Re: multidimensional associative arrays <iltzu@sci.invalid>
Re: multidimensional associative arrays (Tad McClellan)
Re: multidimensional associative arrays <bart.lateur@skynet.be>
Re: Never satisfied (M.J.T. Guy)
Re: perl cookie <AgitatorsBand@yahoo.com>
perl parsing java <samay1NOsaSPAM@hotmail.com.invalid>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 12 Jul 2000 11:53:02 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Creating an ordered HoH
Message-Id: <396CA26E.97B75F3E@home.com>
Greetings, all.
I have an project where I need to preserve the key order of a hash. For
a simple hash Tie::IxHash works great, but I never do anything simple. I
have a multi-level hash (a HoHoL, actually), and it's the order of the
inner keys I want to preserve.
A little experimenting revealed that Tie::IxHash doesn't flow down. That
would be fine, but I couldn't tie my dereferenced inner key either. e.g.
tie %{$hash{somekey}}, "Tie::IxHash";
didn't preserve the order when I started adding
$hash{somekey}{innerkey}.
So apparently Tie::IxHash needs a real variable, not a (de)reference.
Bummer. Does anyone have a way to do this? My alternatives are building
several arrays of keys and sorting them or keeping a copy of the each
set of keys in an array as I add them, and I'm not particularly enthused
by either.
-mjc
------------------------------
Date: Wed, 12 Jul 2000 10:25:35 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Creating an ordered HoH
Message-Id: <8ki9nq$8gc$1@brokaw.wa.com>
Michael Carman <mjcarman@home.com> wrote in message
news:396CA26E.97B75F3E@home.com...
> Greetings, all.
> I have an project where I need to preserve the key order of a hash. For
> a simple hash Tie::IxHash works great, but I never do anything simple. I
> have a multi-level hash (a HoHoL, actually), and it's the order of the
> inner keys I want to preserve.
>
> A little experimenting revealed that Tie::IxHash doesn't flow down. That
> would be fine, but I couldn't tie my dereferenced inner key either. e.g.
>
> tie %{$hash{somekey}}, "Tie::IxHash";
>
> didn't preserve the order when I started adding
> $hash{somekey}{innerkey}.
Hashes are used for storage and naturally unordered. What does it buy you
to know the internal representation of your data?
What is the difference between a hash that looks like this:
-----------------------
|a|b|c|d|e|f|g|h|i|j|k|
-----------------------
| | | | | | | | | | |
9 8 7 6 5 4 3 2 1 0 A
And a hash that looks like this?
-----------------------
|b|g|k|j|a|c|e|i|d|f|h|
-----------------------
| | | | | | | | | | |
8 3 A 6 9 7 5 1 6 4 2
>
> So apparently Tie::IxHash needs a real variable, not a (de)reference.
> Bummer. Does anyone have a way to do this? My alternatives are building
> several arrays of keys and sorting them or keeping a copy of the each
> set of keys in an array as I add them, and I'm not particularly enthused
> by either.
Have you looked at the MLDBM module?
Lauren
------------------------------
Date: Wed, 12 Jul 2000 15:58:25 GMT
From: mexicanmeatballs@my-deja.com
Subject: Re: Crypt() authentication not working for me...
Message-Id: <8ki4ip$m88$1@nnrp1.deja.com>
In article <396C2771.B83FBA8@mac.com>,
Bert <egberts@mac.com> wrote:
>
> if (crypt($guess, $pass) eq $pass) {
> #guess is correct
> }
>
> so I have done it like the book says, BUT... why doesn't it work?
>
Just an observation, but crypt($guess, "") eq "", maybe
you're getting a blank $pass from somewhere?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 12 Jul 2000 13:26:18 +0800
From: Bert <egberts@mac.com>
Subject: Crypt() not working for me
Message-Id: <396C017B.51AF0ABE@mac.com>
Hi,
I've checked thru the code and don't seem to see anything drastically
wrong with it but it no longer works, ie, it used to work... (did it??)
sub authenticate {
my($self, $user, $passwd) = @_;
my($table, $userfield, $passwdfield) = split ':',
'tablename:userfield:passwordfield';
tie my %DB, 'Tie::DBI', {
'db' => 'mysql:mydb',
'table' => $table, 'key' => $userfield,
'user' => 'dbusername', 'password' => 'dbuserpassword',
} or return (undef, "couldn't open database");
return (undef, "You don't seem to have registered, please
register!") unless $DB{$user};
my $saved_passwd = $DB{$user}->{$passwdfield};
if (crypt($passwd,$saved_passwd) eq $saved_passwd) {
return (1, ""); ##This always seem to get thru##
} else {
return (undef, "Did you type the password correctly?");
##This never gets thru even if I type in the wrong password##
}
}
What actually happens when this chunk of code is executed is that as
long as the USER exists in the database, NO MATTER what the dang
password I type in, he gets authenticated and is let in.....
Are there any circumstances where crypt() doesn;t work? I dont get error
messages of any sort. & the rest of the code seem to be in order.
I appreciate any help recieved!
Thanks in advance
Bert
egberts@mac.com
------------------------------
Date: Wed, 12 Jul 2000 17:46:58 GMT
From: Laura Brody <laura@hvcomputer.com>
Subject: Re: cwd() for DOS
Message-Id: <396CAFB3.F645D114@hvcomputer.com>
Nnickee wrote:
>
> On Wed, 12 Jul 2000 04:13:07 GMT, someone claiming to be Laura Brody
> <laura@hvcomputer.com> said:
>
> >I'm looking for a more portable solution to getting the current
> >working directory than
>
> >system "cd"; #current drive and directory on DOS
>
> have you tried the Cwd module?
I thought that I tried it (correctly), but I guess something wasn't
right. I just tried it again and it worked as advertised. (I hate
when that happens <g>).
Thanks for the help.
--
Laura Brody, Publisher of the "filePro Developer's Journal"
+------------- Hudson Valley Computer Associates, Inc ----------+
| PO Box 859 120 Sixth Street http://www.hvcomputer.com |
| Verplanck, NY 10596-0859 Voice mail: (914) 739-5004 |
+------ PC repair locally, filePro programming globally --------+
------------------------------
Date: Wed, 12 Jul 2000 17:21:23 +0200
From: Dubreu Mathieu <mdubreu@atos-group.com>
Subject: Email Attachments in Perl (no modules)
Message-Id: <F4A464A67567D311AAF400C04F2A2CC6020F4E5B@grp-nt4.segin.com>
Is there any way to attach a file to a mail only with the SMTP package ?
I have encoded a file in Base64, but the SMTP package put the file in
the body of my mail.
Thanks
Math
> -----Message d'origine-----
> De : eryq@zeegee.com [mailto:eryq@zeegee.com]
> Publié à : vendredi 7 juillet 2000 18:48
> Publié dans : misc
> Conversation : Email Attachments in Perl (no modules)
> Objet : Re: Email Attachments in Perl (no modules)
>
>
> I have placed directions for you on the MIME::Lite homepage:
>
> http://www.zeegee.com/code/perl/MIME-Lite
>
>
> In article <8k0dll$u59$1@nnrp1.deja.com>,
> joekind@my-deja.com wrote:
> > I can't access my perl directory and I have no clue as to
> install the
> > module.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
------------------------------
Date: Wed, 12 Jul 2000 12:04:49 -0400
From: Jeff Boes <jboes@eoexchange.com>
Subject: Re: Embedding Logo (images) in Email generated by Perl Script
Message-Id: <396c9859$0$1499$44a10c7e@news.net-link.net>
t0873 wrote:
> I have email system written in Perl which generates text messages using
> Text Template and sends out email. If I want to embed a logo or any gif
> in these message , how do I do that. I do not want to attach the GIF
> file.
> When the user/customer recieves email, it should have logo/gif images
> in the body of the email message.
Setting aside the issue of whether this is a good idea (are you sure
that all recipients can view the image? Do they want to accept an extra
10k, 50k, or 100k when they get your mail?), you probably want to look
at MIME::Lite or MIME::Tools, I forget which. Basically, you need to
construct your message as a MIME document, and part of it will be plain
text, while the other is HTML. (If you just include the graphic file as
an attachment, it won't be likely to be displayed, but just available as
an attachment.)
--
Jeff Boes |Computer science is no more about
|jboes@eoexchange.com
Sr. S/W Engineer |computers than astronomy is about |616-381-9889 ext
18
Change Technology|telescopes. --E. W. Dijkstra |616-381-4823 fax
EoExchange, Inc. |
|www.eoexchange.com
------------------------------
Date: Wed, 12 Jul 2000 16:12:33 +0200
From: Kjetil Skotheim <kjetilskotheim@iname.com>
To: pkey@sghms.ac.uk
Subject: Re: executing system commands via cgi?
Message-Id: <396C8AE1.5C74C234@iname.com>
pkey@sghms.ac.uk wrote:
> I want a user to have access to their disc quota info via the web.
>
> The script is posted their user name and then executes the quota
> command:
>
> $quota1 = `quota -v $user`;
>
> The problem is that the 'quota' command needs to be run by root.
...or by the user itself. A user can its one quota, but only root
can see all users.
> The cgi is attempting to run the script as the user who entered their
> name (I think) as I get the following message:
Probably not. Try system("touch touchfile") in your cgi, and then do
"ls -l touchfile" to see who created it. Maybe the "nobody" user did?
> user (uid 123456): permission denied
>
> I set the script permission to:
>
> chmod 4755 my.cgi
hmm. no.
> and quota still won't execute.
>
> Also, another thing - I do a ypmatch on the user to see if they exist
> before doing the quota:
>
> if (system("ypmatch $test_user passwd")==0)
>
> now, the output from the ypmatch command gets displayed in the web
> browser. Why is this? I thought it went to stdout and as it doesn't
> have backticks around it the web browser should not be sent the
> output?
But stdout = "the output" i CGIs !!!
>
> How do I sort the above out?
Run a cronjob as root, set it up to run once per hour maybe:
@allusers=`awk -F: '{print $1}' /etc/passwd`;
for $user (@allusers){system("quota -v $user > quota.$user")}
In your cgi, just output the quota.$user file.
--
Kjetil Skotheim
kjetilskotheim@iname.com
------------------------------
Date: Wed, 12 Jul 2000 11:20:21 -0400
From: "Gregory Vainberg" <Y17507@qub10.mot.com>
Subject: fork function
Message-Id: <8ki2bn$9bu$1@schbbs.mot.com>
I am writting a perl code in a windows environment. I dont have a unix
machine.
I always get the message, when I try to use fork that this function is not
supported, is that becuase I am using windows, if not what is the problem
and if so is there a windows counterpart to this function.
------------------------------
Date: Wed, 12 Jul 2000 17:46:25 GMT
From: andrei@unforgettable.com
Subject: hashes & variables
Message-Id: <8kiata$rq2$1@nnrp1.deja.com>
Hi,
I am not good at perl so forgive me if it´s to simple:
I have this code and I need to asign the values from %result to other
variables let´s say $var1, $var2 etc.
In the hash are about 1g5 values, I know the keys.
Any ideas ?
if ( $resp->is_success ) {
my @arr = split ('&', $resp->content);
for (@arr) {
/^(.+)=(.*)$/;
if ( defined($1) && defined($2) ) {
$result{$1} = $2;
$result{$1} =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack "C", hex($1)/eg;
}
}
}
return %result;
}
Thank you !
Andrei Gologan
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 12 Jul 2000 16:58:58 GMT
From: "Ed Foy" <ed@nospam.com>
Subject: Re: HELP! Problem with warning on filehandle
Message-Id: <mt1b5.54097$NP5.1710608@newsread2.prod.itd.earthlink.net>
Thoren Johne wrote in message <8kho1h$c0m$18$1@news.t-online.com>...
>Ed Foy <ed@nospam.com> wrote in message
>news:qRYa5.53418$NP5.1695094@newsread2.prod.itd.earthlink.net...
>
>> my ($To,$From,$Subject,$Body) = @_;
>
>> When the above subroutine is called, Perl gives the following
warning:
>>
>> "Use of uninitialized value at EMAIL.pl line 13."
>>
>> Perl is complaining about the "print SENDMAIL..." line.
>
>Perl is complaining about one of the values that are used in the print
>statement. one/some of them is/are uninitialized.
>
>i think your funktion "SendMail" is not called with 4 initialized
arguments.
>
>check that out.
Bingo! Right on target. I ignored the fact that Perl sees the here
document as one "line"...duh...
Thanks!
------------------------------
Date: Wed, 12 Jul 2000 17:45:39 GMT
From: "Ed Foy" <ed@nospam.com>
Subject: Re: HELP! Problem with warning on filehandle
Message-Id: <792b5.54316$NP5.1715743@newsread2.prod.itd.earthlink.net>
Tad McClellan wrote in message ...
>On Wed, 12 Jul 2000 11:43:18 GMT, Ed Foy <ed@nospam.com> wrote:
>
>>Subject: HELP! Problem with warning on filehandle
> ^^^^^
> ^^^^^
>
>You might want to avoid doing that in the future, as it likely
>*reduces* the number of people that will read your article.
Thanks Tad. I've started doing Perl about 3 months ago, although I've
been programming for 30 years. Yet another 'protocol' to add to the
list. <g>
>>Environment: Perl 5.00404 on UNIX.
>>
>>My 12-year-old daughter has decided to learn Perl.
>
>
>Way cool!
Sure is! Her own idea and until now she's been working on her own. Hey,
she's a 'big girl' now and can do things for herself. Can't argue that.
In three short weeks and basically on her own she has gone from knowing
nothing about computer programming to having created a simple website
(doing all the HTML coding herself) and writing some elementary CGI
scripts. This is the first time she has ask for any programming help.
Amazing.
>use strict; # teach her to put on her seat belt!
>
>(though you may already have this in the main program)
She already has in main. Actually, she bugs me about it because I don't
put it in my code first thing. Horror of horrors, I'll write code then
add strict later but before I compile. She finds this unacceptable. I
think she need to take up watching television...<g>
>> open (SENDMAIL, "|/usr/lib/sendmail -oi -t") or die "Cannot open
>>mail program: $!\n";
>
>
>Your diagnostic message is a little misleading there.
>
>If the die() executes, it will NOT be anything related to the
>program that you are trying to invoke.
Hahaha...yes, I know. But from my daughters point of view it is quite
simple - mail didn't get sent.
>You should have shown us the _call_, that may show where the >problem
is...
I thought about it but I was trying to keep the clutter down. The
semantics of the call were what would be expected so it didn't really
contribute anything. It turns out the problem was, in fact, one of the
variables being undefined. The variables are initialized in main some
distance away from the actual call to the subroutine so that it would
not have been helpful to have shown a call that was semantically
correct.
>>Perl is complaining about the "print SENDMAIL..." line.
>
>
>Which includes all of the here-doc too (parsers just make
>their "best guess" when giving line numbers).
This is the part I overlooked. I focused on the lexical line and not the
semantic line and so overlooked the embedded variables. It happens, not
often, but sometimes...->
>>The filehandle SENDMAIL is initialized.
>
>
>Filehandles do not generate that warning message, variables do.
Now that is some very useful info! Thanks, I'm still ramping up on
Perl. My biggest headache is that Perl is enough like, and different
enough from, the C and UNIX shells that I'm so familiar with that it
gets me into trouble quite readily...especially when doing C, Perl, and
shells concurrently. Ouch!
>>There are no variables in the main program that have either the >>name
SENDMAIL or EndOfMail.
>
>First, neither of those are variables (variables start with a
>"funny character": $, @, %).
Yes, I know. Somewhere in the Camel book I read something about
filehandles possibly colliding with variables which is why I made this
reference. Off the top of my head I can't remember exactly what the book
said on the subject.
>Have you looked up what the authors of the message have to say
>about their message?
>
> perldoc perldiag
Yup, got the perldocs online locally. But as it goes...some days the
brainfarts win...<g>
Thanks, Tad, for taking the time to provide a good overview. I'm passing
it along to my daughter.
If you would be so kind as to take a look at another post I put here
with one of those aweful subject lines, "HELP: Bizarre BEGIN block
problems" it would be much appreciated. I'm sure the cause of the
problem is obvious as I've been fighting with it for two weeks. I just
haven't been able to get the beans out of the brain to get into the
obvious mode.
Thanks again!
Ed
------------------------------
Date: Wed, 12 Jul 2000 16:45:02 GMT
From: ollie_spencer@my-deja.com
Subject: hohoh:how create & do I really need?
Message-Id: <8ki7a8$oiv$1@nnrp1.deja.com>
I have data that I am trying to read into an hohoh, to the present
all futile. I include the relevant code snippet below:
commented lines there represent some attempts.
$Wafer changes slowly, $ChipCoord changes faster: $TestName is key and
$Testvalue is value of the data in the "real hash" which has some 500
data pairs.
I earlier assumed the line:
$TestData{$Wafer}{$ChipCoord}{$TestName=>$TestValue}
actually created the hohoh, mainly because I could read back the
key-value pairs $TestData{Wafer} and the result as espected was a
reference. I doubt even that now, since I have not been able to resolve
that reference! I have searched the O'Reilly books at my
disposal and through various search engines on the internet for perl
hash info. I found lots of hits, but only one to hohoh's, and that was
botched up- The example code didn't run for me - it was riddled with
syntax errors!
Can someone help?
Thanks in any case for reading the message.
Please post to this forum or e-mail me: ollie.spencer@lmco.com
Ollie Spencer
=====> BEGIN SNIPPET
# $NumOfTests=0;$kk=0;$l=""
#######################################################################
# A line in DEFECTS (except the first) has the pattern:
# 9|2/7|PAD|PADPCK0708|.2268E-0003
#######################################################################
while (<DEFECTS>){
chop();
if (!/^\s*\w/){$headline=$_; next;};
next if /^\s*$/; #skip blank lines
($Wafer,$ChipCoord,$TestMacro,$TestName,$TestValue)=split(/\|/);
# $Tests{$TestName}= $TestValue;
# $TestData{$Wafer}{$ChipCoord){$TestName}->$TestValue;
# $TestData{$Wafer=>{$ChipCoord=>{$TestName=>$TestValue } } };
$TestData{$Wafer}{$ChipCoord}{$TestName=>$TestValue} ;
if($kk++>45285){print "$kk:
$Wafer<>$ChipCoord<>$TestName<>$TestValue<\n";};
if($kk>45290){print "$kk: $Testdata{$TestData=>$Wafer} \n";};
}
# while(($k,$v) = each %Tests) {print "$k = $v\n"};
# while(($k,$v) = each %Tests) {printf(OUTFILE "%s = %#7.5E4\n",
$k, $v)}
for $key1(keys %TestData) {
$key2=$TestData{$key1};
print "$key1 $key2\n"; #gives correct $Wafer and a reference
# for $key2(keys(%($TestData->$key1)) ) {
# print "$key1 $key2\n";
# }
}
====>END SNIPPET
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 12 Jul 2000 17:59:48 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: hohoh:how create & do I really need?
Message-Id: <om2b5.7550$k5.94338@news1.rdc1.mb.home.com>
In article <8ki7a8$oiv$1@nnrp1.deja.com>,
ollie_spencer@my-deja.com <ollie_spencer@my-deja.com> wrote:
> I have data that I am trying to read into an hohoh, to the present
> all futile. I include the relevant code snippet below:
> commented lines there represent some attempts.
[snip]
> I earlier assumed the line:
> $TestData{$Wafer}{$ChipCoord}{$TestName=>$TestValue}
Well, without reading any further -- I think you the
following is more what you had in mind:
$TestData{$Wafer}{$ChipCoord}{$TestName} = $TestValue;
Check out the perlref and perldsc manpages for further
examples (although none may be exactly the same as your
example, they should help).
regards,
andrew
--
Andrew L. Johnson http://members.home.net/andrew-johnson/
They're not soaking, they're rusting!
-- my wife on my dishwashing habits
------------------------------
Date: Wed, 12 Jul 2000 12:11:09 -0400
From: Lance E Sloan <lsloan@umich.edu>
Subject: Re: include my sub in @INC
Message-Id: <396C989D.ABB4C5FE@umich.edu>
Yuandan wrote:
> Hi,
> I have some subroutines under a dir (eg /user/my/require/), the perl is
> installed at somewhere else (eg /usr/bin/perl). My question is how can I
> include my subroutines in the array @INC? so I can use require to access
> them.
> Thanks,
>
> Yuadan
I have a similar question. At my office, I'm required to build perl to
live in
a filesystem that's shared between many machines, /usr/shared/perl. When
I build it, @INC ends up with various subdirectories under
/usr/shared/perl/lib.
That's great.
However, we also have a directory where other modules will be installed,
/usr/local/perl/lib. Contents of that directory will vary by machine. How
can
I get that directory compiled into the perl binary? The INSTALL document
said that I could set otherlibdir in config.sh. I tried that and it didn't
work.
I don't know if this is one of those variables that MakeMaker currently
doesn't
use or not.
------------------------------
Date: 12 Jul 2000 10:32:11 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Intercept MSDOS messages
Message-Id: <396cab9b@news.victoria.tc.ca>
Sébastien Cottalorda (sebastien.cottalorda1@libertysurf.fr) wrote:
: Hi all,
: I'm looking for the way to intercept MSDOS messages when I execute a .BAT
: program from a perl script.
: On Linux, I use to do that :
: $command='ls -l';
: $result=qx{$command};
: But it doesn't work on Win95 (MsDos), the $result variable is empty, even if
: the executed $command produce something on the screen.
Try using "command.com /c" as the first part of your command. That's
what's required to redirect a non-NT .BAT file on the command line. I
haven't tried it in the way you descibe.
------------------------------
Date: 12 Jul 2000 10:20:16 -0700
From: ptkwt@user2.teleport.com (Phil Tomson)
Subject: Killing a called program
Message-Id: <8ki9cg$2au$1@user2.teleport.com>
I've got a script that runs some external programs which need to be killed
if they run too long. Here's the code snippet:
use POSIX;
FORKTAIL:{
if($pidxt=fork){
#parent stuff
print "First: ID is $pidxt\n";
}elsif (defined $pidxt){
#child stuff
print "Second: ID is: $pidxt\n";
`xterm -sb -ls -vb -e tail -f $0`;
POSIX::exit(0);
undef $pidxt;
}else { die "Can't fork!\n"}
}
eval{
local $SIG{ALRM} = sub { print "id in kill is: $pidxt\n";
kill &POSIX::SIGTERM, $pidxt;
waitpid($pidxt,0); die "alarm\n" };
alarm 15;
waitpid($pidxt,0);
alarm 0;
};
In this case I start an xterm and I want to kill the xterm after 15
seconds (not the real program or time, but it works as an example).
The timer seems to work OK, but the xterm doesn't get killed. A 'ps'
command reveals that after the 'kill' the parent of the xterm process is
'1' (init). Is there any way to kill the xterm in this case?
Phil
------------------------------
Date: Wed, 12 Jul 2000 11:58:53 -0400
From: Jeff Boes <jboes@eoexchange.com>
Subject: Re: Method to obfuscate or disguise Perl source code?
Message-Id: <396c9601$0$1501$44a10c7e@news.net-link.net>
I'd just like to take a moment to point out that most of the
light-hearted 'responses' to this thread have been just as off-topic
(perhaps more so!) than
"How do I use Perl to set a cookie from a web page?"
At least we're likely to see a Perl snippet or two in that. Most of
what's been spouted in this thread has had to do with legal issues,
copyrights, patents, and the like. Practice what you preach! Take it to
email!
--
Jeff Boes |Computer science is no more about
|jboes@eoexchange.com
Sr. S/W Engineer |computers than astronomy is about |616-381-9889 ext
18
Change Technology|telescopes. --E. W. Dijkstra |616-381-4823 fax
EoExchange, Inc. |
|www.eoexchange.com
------------------------------
Date: 12 Jul 2000 17:11:31 GMT
From: snow@statsci.com (Greg Snow)
Subject: Re: Method to obfuscate or disguise Perl source code?
Message-Id: <8ki8s3$u1g$1@junior.statsci.com>
In article <slrn8mmpda.nq.siliconcowboy@erato.bigredrockeater.com>,
Silicon Cowboy <siliconcowboy@home.com> wrote:
[snip]
>And I also looked at the Perl Filter module that could be used to
>self-encrypt Perl source code and decrypt it into memory when it's run.
>The module uses some XS code that must be compiled for each platform
>on which it is to be run. But I'd rather have a more portable method
>since I don't even have a C compiler for some platforms I want my
>programs to run on (like Windows/NT).
If I read the docs correctly, XS is one option to use with Filter, but you
can also write your filter completely in Perl. You might want to go back
and reconsider this option.
Getting a clear text version may be as simple as:
perl -MO=Deparse yourscript.pl
but it would keep someone from "accedentally" seeing your code and they
would have less of a defense in legal cases (provide a good licence also)
if they had to have explicitly decrypted it.
>
>My purpose is to protect some proprietary algorithms in the source code
>of a commercial Perl program. I realize the futility of protecting code
>against reverse engineering by determined programmers, but I do want to
>make at least some effort.
--
-------------------------------------------------------------------------------
Gregory L. Snow | Inertia makes the world go round,
(Greg) | Love makes the trip worth taking.
gsnow@splus.mathsoft.com |
------------------------------
Date: Wed, 12 Jul 2000 19:40:57 +0200
From: "Nadim Khemir" <nkh@cpen.com>
Subject: metrics
Message-Id: <396cadaa.0@d2o68.telia.com>
Can someone point me to some metric scripts ?
MacCabbe
halstead
....
thanks
------------------------------
Date: 12 Jul 2000 15:21:12 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: multidimensional associative arrays
Message-Id: <963414809.2407@itz.pp.sci.fi>
In article <396C6C63.7D7AE5EA@ioip.com>, Philip Rennert wrote:
>Am I not stating this clearly? With a non-associative array, you can specify the
>values of any indices you want, and vary the others, like $a[4][$j][6][$k], inside
>loops on $j and $k.
You've stated the problem quite clearly. You just haven't thought
clearly anough about Agibail's answer.
>How do you do the same thing for associative arrays? What you showed me I think
>works only on the first index, because how can Perl know that in $a{Fred} you mean
>Fred to be in the third index, say...
Of course it works:
foreach my $j (keys %{ $a{foo} }) {
foreach my $k (keys %{ $a{foo}{$j}{bar} }) {
print $a{foo}{$j}{bar}{$k}, "\n";
}
}
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method." -- Abigail
Please ignore Godzilla and its pseudonyms - do not feed the troll.
------------------------------
Date: Wed, 12 Jul 2000 10:21:03 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: multidimensional associative arrays
Message-Id: <slrn8movmf.6cq.tadmc@magna.metronet.com>
On Wed, 12 Jul 2000 09:02:27 -0400, Philip Rennert <phil.rennert@ioip.com> wrote:
>I don't know what you mean by "Jeopardy style".
It is when you put your comment before the quoted text that
you are commenting on (most often coupled with quoting the
_entire_ article, don't do that either).
So the followup is in "reverse chronological" order.
It has the second thing first and the first thing second.
It is called Jeopardy style after the popular TV game show where
the answer comes *before* the question.
Some people make killfile entries for Jeopardists, so it is
best to not use that style.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 12 Jul 2000 18:27:32 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: multidimensional associative arrays
Message-Id: <e07pms0mted76bjhprbcf092vpb9uujsrp@4ax.com>
Philip Rennert wrote:
>I don't know what you mean by "Jeopardy style".
You must be using one of those "news browsers" that quote the whole
article by default, without you noticing it.
Damn those things!
You know the TV game Jeopardy? You get the answer, and the candidate
must find the question. That's what posts like yours look like to us.
--
Bart.
------------------------------
Date: 12 Jul 2000 17:00:55 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Never satisfied
Message-Id: <8ki887$5bq$1@pegasus.csx.cam.ac.uk>
In article <396c3d98@news.telinco.net>, John <john@nomailplease> wrote:
>However chuffed I am that my code below works I would appreciate it if
>someone would show me how it could be done a bit better.
>I'm sure it could be done in two lines by not destroying the RHS but am
>stumped.
>
>Thanks, JohnShep
>
> $alpha = $numeric = $string_in;
> $alpha =~ s/[\W]|[\d]//g; # remove any non letters
> $numeric =~ s/[\D]//g; # remove any non digits
The standard paradigm for "make a copy and update it" is
($alpha = $string_in) =~ s/[\W\d]//g
($numeric = $string_in) =~ s/\D//g;
Mike Guy
------------------------------
Date: Wed, 12 Jul 2000 16:18:55 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: perl cookie
Message-Id: <PT0b5.22$y5.3527@news.shore.net>
John Gold <gold@kr8.com> wrote:
: Hi Drew,
: thanks for the usefull information, obviously all the code I have written is
: make believe!
If you posted some of the code you're having trouble with, you might have
better luck getting help.
Try using the CGI module. It does all the "dirty work" needed to write
hashes to the user's cookie.
--Art
------------------------------
Date: Wed, 12 Jul 2000 09:04:37 -0700
From: Samay <samay1NOsaSPAM@hotmail.com.invalid>
Subject: perl parsing java
Message-Id: <260e0c45.a470b012@usw-ex0104-031.remarq.com>
Hi, I am looking for any perl program which disects the Java
file... Example: Getting all the methods, used in the program..
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3638
**************************************