[24605] in Perl-Users-Digest
Perl-Users Digest, Issue: 6781 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 9 03:05:36 2004
Date: Fri, 9 Jul 2004 00:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 9 Jul 2004 Volume: 10 Number: 6781
Today's topics:
Chains of ties <ahamm@mail.com>
Looping through hash for match and replacement strings <betsamaarcra@mindspring.com>
Re: Problem with Archive::Tar <Joe.Smith@inwap.com>
Secure Database Systems <sarahtanembaum@yahoo.com>
Re: what do you call funct ( funct()) <ken_sington@nospam_abcdefg.com>
Re: what do you call funct ( funct()) <josef.moellers@fujitsu-siemens.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 9 Jul 2004 16:11:10 +1000
From: "Andrew Hamm" <ahamm@mail.com>
Subject: Chains of ties
Message-Id: <2l6r82F9h097U1@uni-berlin.de>
Hi Folks,
This is interesting phenomenom I've originally posted to comp.lang.perl.tk,
but I think it merits a wider canvassing* of opinion.
* That's a Perl/Tk joke.
I've often wondered if you can chain ties, and the apparent tying used by
the -textvariable option in Tk has led me to experiment with it since I want
to bind tied variables to Tk::Entry fields. The following is very
interesting:
#!/usr/bin/perl
use strict;
use warnings;
package Up;
sub TIESCALAR {
my $class = shift;
my $thing = shift;
return bless \$thing, $class;
}
sub FETCH {
my $self = shift;
return "up:$$self";
}
sub STORE {
my $self = shift;
my $value = shift;
warn "Up::STORE $value\n";
return $$self = $value;
}
package Down;
sub TIESCALAR {
my $class = shift;
my $thing = shift;
tie $thing, 'Up';
return bless \$thing, $class;
}
sub FETCH {
my $self = shift;
return "down:$$self";
}
sub STORE {
my $self = shift;
my $value = shift;
warn "Down::STORE $value\n";
return $$self = $value;
}
package main;
tie my $kangaroo, 'Down'; # sport
$kangaroo = 1;
print "kangaroo = $kangaroo\n";
__END__
Which means that you can indeed chain ties, although the 2nd tie needs to
cooperate - I'll work on a trick for that next...
So, who has any interesting thoughts on this subject? Has it been used in
other software? Are there any known caveats in this technique?
Thanks in advance for any edifying discussion.
------------------------------
Date: Fri, 09 Jul 2004 03:56:35 GMT
From: "Driver" <betsamaarcra@mindspring.com>
Subject: Looping through hash for match and replacement strings
Message-Id: <THoHc.12895$yy1.7237@newsread2.news.atl.earthlink.net>
With the included code, I'm trying to:
-- parse a mif file
-- match the left side string of the %op hash (index) with occurances of
that string in the mif file
-- replace the matched string with the string on the right side of the %op
hash (keys)
I started with "foreach" to control the looping through the %op hash, but
found a ref to the
while (($st, $hx) = each (%op)) function and gave that a shot -- nothing.
NOTE: if I remove the "while (($st, $hx) = each (%op))" function and match
and replace just a unique pair, it works fine, but of course that's a bit
limiting.
help?
%op = (
BGBCJHFE => FNC4T001,
BGBFEJGH => FNC4T002,
BGBCCCIE => FNC4T003,
CACFCDIG => FNC4T004,
CACBBJCA => FNC4T005,
CACEAIJB => FNC4T006,
CACEJGAG => FNC4T007,
CACCJIED => FNC4T008,
CACCHCIJ => FNC4T009,
BGBEBHJF => FNC4T010,
BGBDHGAF => FNC4T011,
CHDJJGJC => FNC4T012,
BABEDDFA => FNC4T013,
CACDHDJC => FNC4T014,
CACHACHA => FNC4T015,
CACDFJBG => FNC4T016,
CACFCHAF => FNC4T017,
CACJADHB => FNC4T018,
CACCBJAF => FNC4T019,
CACGFBBG => FNC4T020,
CACJIJFI => FNC4T021,
BGBGCFDG => FNC4T022,
BGBFFFJG => FNC4T023,
BGBDHEGC => FNC4T024,
BGBEAGCI => FNC4T025,
BGBJDIAI => FNC4T026,
BGBDBDBE => FNC4T027,
BGBDCEBG => FNC4T028,
BGBBDIDH => FNC4T029,
CACBEIHF => FNC4T030,
CACGHCHB => FNC4T031,
CACBIJJC => FNC4T032,
CACGJGHJ => FNC4T033,
CACBCBHG => FNC4T034,
CACHJCBF => FNC4T035,
BGBCHGAI => FNC4T036,
BGBJGDFD => FNC4T037,
);
while (($st, $hx) = each (%op)) {
$l="new";
while ($nextname = <anyfile.mif>){
open (HTM,"$nextname") || die " could not open $nextname";
open (HTML,">$nextname$l") || die " could not open $nextname";
while (<HTM>){
#print $_;
if ($_ =~ m/$st/) { s/$st/$hx/; print HTML "$_"; }
else {print HTML "$_";}
}
} # closes the inside while loop
close (HTML);
close (HTM);
rename ("$nextname$l","$nextname");
}
------------------------------
Date: Fri, 09 Jul 2004 05:36:03 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Problem with Archive::Tar
Message-Id: <39qHc.45610$a24.23611@attbi_s03>
Mark Newman wrote:
> The problem occurs when I try to create some sort of directory structure
> inside of the tar file (so that I can grab files from multiple devices,
> and file them say by IP address). Every attempt that I have made to get
> Archive::Tar to accept a nested file name is ignored. Here is sample code:
>
> for(my $i= 0; $i < scalar(@deviceTemplate); $i += 2)
> {
> print "$deviceTemplate[$i] -> $deviceTemplate[$i+1] \n";
> if(!$www->doURLQuery("http://$hostName/$deviceTemplate[$i+1]"))
> {
> print "ERROR: $hostName = " . $www->getErrorMessage() . "\n";
> } else {
> $tar->add_data("dir1/$deviceTemplate[$i+1]",$www->httpResponse());
> }
> }
>
> The various webpages are successfully grabbed and stored in a .tar file,
> but the "dir1/" path is ignored. All files are in the root directory.
I would have expected one of doURLQuery or add_data to use
$deviceTemplate[$i] instead of $deviceTemplate[$i+1] both places.
Anyway, it works for me.
linux% cat tar.pl
#!/usr/bin/perl
use Archive::Tar;
my $tar = Archive::Tar->new;
foreach (1 .. 5) {
$tar->add_data("dir1/$_.txt", 'xxxxx' x $_);
}
$tar->write('files.tar');
system "tar tvf files.tar";
linux% perl tar.pl
-rw-r--r-- jms/jms 5 2004-07-08 22:27:02 dir1/1.txt
-rw-r--r-- jms/jms 10 2004-07-08 22:27:02 dir1/2.txt
-rw-r--r-- jms/jms 15 2004-07-08 22:27:02 dir1/3.txt
-rw-r--r-- jms/jms 20 2004-07-08 22:27:02 dir1/4.txt
-rw-r--r-- jms/jms 25 2004-07-08 22:27:02 dir1/5.txt
linux% tar xvf files.tar
dir1/1.txt
dir1/2.txt
dir1/3.txt
dir1/4.txt
dir1/5.txt
-Joe
------------------------------
Date: Fri, 9 Jul 2004 02:41:37 -0400
From: "Sarah Tanembaum" <sarahtanembaum@yahoo.com>
Subject: Secure Database Systems
Message-Id: <2l6tsgF9fs6dU1@uni-berlin.de>
I was wondering if it is possible to create a secure database system
using RDBMS(MySQL, Oracle, SQL*Server, PostgreSQL etc) and web
scripting/programming language(Perl, PHP, Ruby, Java, ASP, etc) combination?
I have the following in mind:
I wanted to store all my( and my brothers and sisters) important
document
information such as birth certificate, SSN, passport number, travel
documents, insurance(car, home, etc) document, and other important
documents
imagined in the database.
The data will be entered either manually and/or scanned(with OCR). I
need to
be able to search on all the fields in the database.
We have 10 computers(5bros, 4sisters, and myself) plus 1 server with I
maintained. The data should be synchronize/replicate between those
computers.
Well, so far it is easy, isn't it?
Here's my question:
a) How can I make sure that it secure so only authorized person can
modify/add/delete the information? Beside transaction logs, are there
any
other method to trace any transaction(kind of paper trail)?
Assuming there are 3 step process to one enter the info e.g:
- One who enter the info (me)
- One who verify the info(the owner of info)
- One who verify and then commit the change!
How can I implement such a process in RDBMS and/or PHP or any other web
language?
b) How can I make sure that no one can tap the info while we are
entering
the data in the computer? (our family are scattered within US and
Canada)
c) Is it possible to securely synchronize/replicate between our
computers
using VPN? Does RDBMS has this functionality by default?
d) Other secure method that I have not yet mentioned.
Anyone has good ideas on how to implement such a systems?
Thanks
------------------------------
Date: Thu, 08 Jul 2004 21:53:43 -0400
From: Ken Sington <ken_sington@nospam_abcdefg.com>
Subject: Re: what do you call funct ( funct())
Message-Id: <i_adncp7NLQPZ3DdRVn_iw@speakeasy.net>
Josef Moellers wrote:
> Ken Sington wrote:
...
...
>
> orthogonality?
>
I almost dismissed it. never knew there was such a word.
I looked it up in the dictionary:
...sum of two products...
then google.com, and found lots of references to mathmatics.
then passed it around to my peers; almost no one had a clue.
the one who had a clue once again steered towards mathmatics.
and of course, to comp.sci.
> This means that there are rules that describe what you can do and there
> are very few (down to "no") exceptions to these rules.
> Like: "a function can return a value and this value can be used in an
> expression" and "the condition of a conditional operator is an expression".
------------------------------
Date: Fri, 09 Jul 2004 09:01:01 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: what do you call funct ( funct())
Message-Id: <cclfmo$2ul$1@nntp.fujitsu-siemens.com>
Ken Sington wrote:
> Josef Moellers wrote:
>=20
>> Ken Sington wrote:
>=20
> ...
>=20
> ...
>=20
>>
>> orthogonality?
>>
> I almost dismissed it. never knew there was such a word.
>=20
> I looked it up in the dictionary:
> ...sum of two products...
>=20
> then google.com, and found lots of references to mathmatics.
Yes, in mathematics I'd read it as being "at right angles" or whatever=20
linear algebra makes out of that. It then also bears the notion of two=20
vectors being independent of each other so they span a plane where you=20
can construct points out of both vectors independently, which probably=20
led to the adoption of this term in CS:
>> This means that there are rules that describe what you can do and=20
>> there are very few (down to "no") exceptions to these rules.
>> Like: "a function can return a value and this value can be used in an =
>> expression" and "the condition of a conditional operator is an=20
>> expression".
I.e. what you can construct an expression of is one vector and what you=20
can put into a condition is another.
I've seen this term used very often in describing the architecture of=20
processors. There it e.g. refers to the addressing modes where some=20
processors allow arbitrary sources and destinations (e.g. PDP11, VAX,=20
M68K, NS32K) while others just allow certain combinations only.
The former call themselves "orthogonal".
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 6781
***************************************