[19656] in Perl-Users-Digest
Perl-Users Digest, Issue: 1851 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 1 18:06:06 2001
Date: Mon, 1 Oct 2001 15:05:12 -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: <1001973911-v10-i1851@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 1 Oct 2001 Volume: 10 Number: 1851
Today's topics:
ACM programming contest <bernie@fantasyfarm.com>
Re: Appending to a hash <jurgenex@hotmail.com>
Re: best regular expression <Laocoon@eudoramail.com>
CaSe iNsEnsItiVe pattern matching (James Weisberg)
Re: CaSe iNsEnsItiVe pattern matching <skuo@mtwhitney.nsc.com>
Re: CaSe iNsEnsItiVe pattern matching (John J. Trammell)
Re: CaSe iNsEnsItiVe pattern matching (James Weisberg)
Re: Converting XML::Parser::EasyTree arrays back into w (Eric Bohlman)
DBI/SQL trouble... (martinblack)
Re: Embed Sound into cgi? <gnarinn@hotmail.com>
Re: HELP: /stuff(\d+)|oth(\d+)/;$num=$1 doesn't work? <iltzu@sci.invalid>
IE vs. Netscape problems in perl <dtlinker@u.washington.edu>
IsSpacePerl? <jboes@nexcerpt.com>
Re: IsSpacePerl? (Rafael Garcia-Suarez)
Re: Limitation <sun_tong@users.sourceforge.net>
Re: mime::lite & duplicate emails? <dkoleary@home.com>
Module File::Find and 'prune' variable <bc1@skynet.be>
Offtopic: DMCA and perldoc perlsec (EED)
Re: Offtopic: DMCA and perldoc perlsec (John J. Trammell)
Re: Offtopic: DMCA and perldoc perlsec <mjcarman@home.com>
Re: Offtopic: DMCA and perldoc perlsec (Logan Shaw)
pack() programming question (Alex)
Re: pack() programming question <thomas@baetzler.de>
Re: pack() programming question (Logan Shaw)
Re: perl standard error/output redirection to a file on <novastar@novastar.dtdns.net>
Perl, unix & MS SQL server7 (Seckley)
Re: Perl, unix & MS SQL server7 <ilya@martynov.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 01 Oct 2001 17:23:53 -0400
From: Bernard Cosell <bernie@fantasyfarm.com>
Subject: ACM programming contest
Message-Id: <oinhrt8hlk4flfg6vqhfg9mad0kvthge1n@4ax.com>
I was chatting with a friend and he brought up the story about Perl
being 'banned' from some ACM programming contest because folks were
winning too handily using it.... he tried to find out info about the
contest [and that language exclusion] on the ACM site, but couldn't [I
just tried and the ACM site is basically down]. A quick trip to
perl.com didn't uncover the article with a couple of searches either..
Anyone have a URL or something to this? [and a backref to the actual
ACM contest would be good, too]. THANKS!!!
/Bernie\
------------------------------
Date: Mon, 1 Oct 2001 08:11:07 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Appending to a hash
Message-Id: <3bb8878c@news.microsoft.com>
"linkster" <adwr96@dial.pipex.com> wrote in message
news:mY_t7.29421$uM2.4336069@monolith.news.easynet.net...
> I have what I thought would be a fairly easily requirement, but I simply
> can't find any way to do it.
[...]
> Problem is, I can't find any straightforward way to simply grow the hash
> table - all I can find are ways to append to existing elements.
Just set it:
$myhash{$newkey}=$newvalue;
and all of a sudden %myhash has an additional element (unless $newkey was
actually an old key).
jue
------------------------------
Date: Mon, 1 Oct 2001 22:33:11 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: best regular expression
Message-Id: <Xns912DE6C58737ALaocooneudoramailcom@62.153.159.134>
Alternation
$string =~ /(\D|^)75(\d{8})(\D|$)/;
(note that that stores the number in $2)
------------------------------
Date: Mon, 01 Oct 2001 20:46:37 GMT
From: chadbour@wwa.com (James Weisberg)
Subject: CaSe iNsEnsItiVe pattern matching
Message-Id: <NC4u7.8075$ym4.345666@iad-read.news.verio.net>
Here's a quick question. Is there a cleaner way to write this:
#!/usr/bin/perl -w
my $s1 = shift;
my $s2 = shift;
my $opt = shift || "";
if($opt eq "i") {
print "$s1 matches $s2\n" if $s2 =~ /$s1/i;
} else {
print "$s1 matches $s2\n" if $s2 =~ /$s1/;
}
#############
Assuming $opt is either "i" or "", I would like to say:
print "$s1 matches $s2\n" if $s2 =~ /$s1/$opt;
But this produces an error message because $opt is expected to be an
operator.
Is there a stylistic syntax I am missing here?
--
World's Greatest Living Poster
------------------------------
Date: Mon, 1 Oct 2001 14:05:28 -0700
From: Steven Kuo <skuo@mtwhitney.nsc.com>
Subject: Re: CaSe iNsEnsItiVe pattern matching
Message-Id: <Pine.GSO.4.21.0110011402250.2993-100000@mtwhitney.nsc.com>
On Mon, 1 Oct 2001, James Weisberg wrote:
> Here's a quick question. Is there a cleaner way to write this:
>
> #!/usr/bin/perl -w
>
> my $s1 = shift;
> my $s2 = shift;
> my $opt = shift || "";
>
> if($opt eq "i") {
> print "$s1 matches $s2\n" if $s2 =~ /$s1/i;
> } else {
> print "$s1 matches $s2\n" if $s2 =~ /$s1/;
> }
>
> #############
>
> Assuming $opt is either "i" or "", I would like to say:
>
> print "$s1 matches $s2\n" if $s2 =~ /$s1/$opt;
>
> But this produces an error message because $opt is expected to be an
> operator.
>
> Is there a stylistic syntax I am missing here?
You could consult perlre regarding embedded modifiers:
% perldoc perlre
One way to do what you wanted is:
my ($s1,$s2,$opt) = @ARGV;
$opt = ($opt && ($opt eq 'i'))? 'i' : '';
print "$s1 matches $s2\n" if ($s2 =~ /(?$opt)$s1/);
--
Cheers,
Steve
------------------------------
Date: Mon, 1 Oct 2001 16:11:28 -0500
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: CaSe iNsEnsItiVe pattern matching
Message-Id: <slrn9rhmvv.li0.trammell@haqq.hypersloth.net>
On Mon, 01 Oct 2001 20:46:37 GMT, James Weisberg <chadbour@wwa.com> wrote:
> Here's a quick question. Is there a cleaner way to write this:
>
> #!/usr/bin/perl -w
>
> my $s1 = shift;
> my $s2 = shift;
> my $opt = shift || "";
>
> if($opt eq "i") {
> print "$s1 matches $s2\n" if $s2 =~ /$s1/i;
> } else {
> print "$s1 matches $s2\n" if $s2 =~ /$s1/;
> }
>
> #############
>
> Assuming $opt is either "i" or "", I would like to say:
>
> print "$s1 matches $s2\n" if $s2 =~ /$s1/$opt;
>
> But this produces an error message because $opt is expected to be an
> operator.
>
> Is there a stylistic syntax I am missing here?
[ ~ ] cat foo.pl
my $string = shift;
my $pattern = shift;
my $op = shift || "";
if ($string =~ /(?$op)$pattern/) { print "matches\n" }
[ ~ ] perl -w -Mstrict foo.pl barfoobar foo
matches
[ ~ ] perl -w -Mstrict foo.pl barfoobar FOO
[ ~ ] perl -w -Mstrict foo.pl barfoobar FOO i
matches
[ ~ ]
------------------------------
Date: Mon, 01 Oct 2001 21:56:30 GMT
From: chadbour@wwa.com (James Weisberg)
Subject: Re: CaSe iNsEnsItiVe pattern matching
Message-Id: <iE5u7.8078$ym4.345956@iad-read.news.verio.net>
In article <Pine.GSO.4.21.0110011402250.2993-100000@mtwhitney.nsc.com>,
Steven Kuo <skuo@mtwhitney.nsc.com> wrote:
>On Mon, 1 Oct 2001, James Weisberg wrote:
>> Assuming $opt is either "i" or "", I would like to say:
>>
>> print "$s1 matches $s2\n" if $s2 =~ /$s1/$opt;
>>
>> But this produces an error message because $opt is expected to be an
>> operator.
>>
>> Is there a stylistic syntax I am missing here?
>
>You could consult perlre regarding embedded modifiers:
>
>% perldoc perlre
>
>One way to do what you wanted is:
>
>my ($s1,$s2,$opt) = @ARGV;
>
>$opt = ($opt && ($opt eq 'i'))? 'i' : '';
>
>print "$s1 matches $s2\n" if ($s2 =~ /(?$opt)$s1/);
Of course! Embedded pattern matching modifiers. That's the ticket.
I knew there was some f*****d up syntax that would allow for a variable
modifier. Shame on me for failure to RTFM. To quote from that manual:
A question mark was chosen for this and for the new
minimal-matching construct because 1) question mark is
pretty rare in older regular expressions, and 2) whenever
you see one, you should stop and "question" exactly what
is going on. That's psychology...
Number 2 is particularly insightful. I often stop and "question"
exactly what is going on while reading Perl code.
Thanx for the tip.
--
World's Greatest Living Poster
------------------------------
Date: 1 Oct 2001 21:15:12 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Converting XML::Parser::EasyTree arrays back into wml
Message-Id: <9pamd0$gqr$2@bob.news.rcn.net>
Joonas Paalasmaa <joonas@olen.to> wrote:
> How can I convert this XML::Parser::EasyTree array back to xml.
> The array was created with XML::Parser::EasyTree and dumped with
> Data::Dumper::Dumper.
Write a recursive procedure to walk the tree and output the XML (you might
want to use XML::Writer or XML::Generator for the output so you can
concentrate on tree-walking and not have to worry about character-set or
escaping issues).
BTW, I now suggest that people use a SAX parser like XML::Parser::PerlSAX
and the XML::Handler::EasyTree class from XML::Handler::Trees, since
you're no longer tied to XML::Parser.
------------------------------
Date: 1 Oct 2001 14:01:09 -0700
From: martinblack26@yahoo.com (martinblack)
Subject: DBI/SQL trouble...
Message-Id: <c025943b.0110011301.183a2834@posting.google.com>
Hi, Folks. I'm having trouble with this database addition/appendage
script. I can't even seem to generate an error from this, other than
the old "internal server error". Any help on this matter would be
appreciated. Thanks in advance.
#!/usr/bin/perl
BEGIN {
open (STDERR, ">html/error.txt");
}
### add.cgi
use DBI;
use CGI::Carp qw(fatalsToBrowser carpout);
require "dbsubs.cgi";
use CGI;
$q=new CGI;
# input..................................
$io{'company_id'} = $company_id = $q->param(company_id);
$io{'product_id'} = $product_id = $q->param(product_id);
$io{'title'} = $title = $q->param(title);
$io{'description'} = $description = $q->param(description);
$io{'spex'} = $spex = $q->param(spex);
$io{'price'} = $price = $q->param(price);
$io{'sex'} = $sex = $q->param(sex);
# mainline...............................
print header;
$DBname= "dbi:mysql:username";
$DBhost = "localhost";
$DBusername = "myusername";
$DBpassword = "myPassword";
$dbh = DBI->connect("$DBname:$DBhost", $DBusername, $DBpassword) ||
die "connection problem: ", $dbh->errstr;
$dbh->{'RaiseError'} = 1;
&kaboom;
&print_output;
# subroutines...
sub print_output{
print<<HTML;
<HTML><BODY>
<CENTER><FONT SIZE=5>
Record added to database
<P>
he he he ha ha
</P>
</FONT></CENTER>
</BODY></HTML>
HTML
}
sub kaboom() {
$sth = $dbh->prepare( q[
SELECT company_id, product_id
FROM product
WHERE company_id = ? and
product_id= ?
] ) || die "prep problem: ", $DBI::errstr;
$sth->execute( $company_id, $product_id ) || die "execution problem:
", $DBI::errstr;
&fetch_results;
if (defined $pro) {
$sth = $dbh->prepare( q[
update product set
title = ?,
spex = ?,
description = ?,
price = ?,
sex = ?
WHERE company_id = ? and
product_id = ?
] ) || die "prep problem: ", $DBI::errstr;
$sth->execute( $title, $spex, $description, $price, $sex,
$company_id, $product_id ) || die "problem baby: ", $DBI::errstr;
#&fetch_results;
} else {
#111
$sth = $dbh->prepare( q[
insert into product set
company_id = ?,
product_id = ?,
title = ?,
spex = ?,
description = ?,
price = ?,
sex = ?
] ) || die "prep problem: ", $DBI::errstr;
$sth->execute( $company_id, $product_id, $title, $spex, $description,
$price, $sex ) || die "problem child: ", $DBI::errstr;
#&fetch_results;
}
}
sub fetch_results {
while ($x = $sth->fetchrow_hashref) {
$com = $x->{'company_id'};
$pro = $x->{'product_id'};
$tit = $x->{'title'};
$des = $x->{'description'};
$spe = $x->{'spex'};
$pri = $x->{'price'};
$morf = $x->{'sex'};
$newid = $com ."-".$pro;
}
}
------------------------------
Date: Mon, 1 Oct 2001 20:03:39 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Embed Sound into cgi?
Message-Id: <1001966619.580579004250467.gnarinn@hotmail.com>
In article <joqgrt4juegam6ehk1pknpvdr15ot9gjoi@4ax.com>,
=?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de> wrote:
>On Mon, 01 Oct 2001 11:27:39 GMT, christo <casey1@adelphia.net> wrote:
>>I have a free chat cgi script im running and would like to know if a
>>beep sound can be embeded somehow to advise me when someone logs in to
>>the chat room. any help would be appreciated.
>
>I guess comp.infosystems.www.authoring.cgi would be a better place to
>ask questions like this, because this is less of a Perl and more of a
>CGI question.
>
>There is nothing specific that anybody could say without knowing more
>about your CGI script and your specific needs. I do suspect that you do
>not want a sound played on the web server (unless it is sitting under
>your desk, which I doubt)
actually, i think that *is* what the OP wanted.
in that case, his script, can just call any sound playing external
program with system().
there also may be a module on CPAN that he can use.
gnari
------------------------------
Date: 1 Oct 2001 21:28:02 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: HELP: /stuff(\d+)|oth(\d+)/;$num=$1 doesn't work?
Message-Id: <1001971137.8083@itz.pp.sci.fi>
In article <3bb7eb44.1542$1@news.op.net>, Mark Jason Dominus wrote:
>
>Because $1 is what is in the first pair of parentheses, and $2 what is in
>the second pair of parentheses. If the $line looks like 'oth42', then
>there was nothing in the first pair of parentheses.
It should be noted that the original regex, /stuff(\d+)|oth(\d+)/ may be
rewritten as /(stuff|oth)(\d+)/, so that the digits will now always be
in $2. (You can also test $1 to see which alternative matched.)
It's possible that this may not work for the actual script the OP is
having problems with, but if it does, it's probably the best solution.
>When you get to this stage it's probably easier not to use $1 $2 $3 $4
>directly at all. Instead, use:
>
> @matches = ($line =~ /$pattern/);
>
>Now you just need to scan through @matches until you find what you
>want:
Better yet, just do it like this:
@matches = grep defined, ($line =~ /$pattern/);
This way, @matches will only contain the values of those sets of parens
that did match.
--
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: 1 Oct 2001 21:38:22 GMT
From: David Linker <dtlinker@u.washington.edu>
Subject: IE vs. Netscape problems in perl
Message-Id: <9panoe$1470$1@nntp6.u.washington.edu>
I need some help. I wrote a download logging perl script. It keeps track
of how many times a file has been downloaded, and who did it, in two
separate files. It works perfectly now when accessed from within
Netscape, but when I use Internet explorer, it downloads a link with the
name of the script, and logs two downloads!
Any ideas appreciated!
Thanks,
David Linker
From Netscape, it downloads the file "Test.RTF", as intended.
From IE, it downloads a file called count.cgi (the name of the perl
script), containing:
[InternetShortcut]
URL=http://faculty.washington.edu/dtlinker/Test.RTF
The script is as follows:
#!/usr/local/bin/perl
#-----------------------
# count.cgi
# Ver. 1.0
# 2001-09-30
# ----------------------
# David T. Linker
# dtlinker@u.washington.edu
#-----------------------
$cntfile = "./count.dat";
$logfile = "./count.log";
$downldfile = "http://faculty.washington.edu/dtlinker/Test.RTF";
print "Location: $downldfile\n\n";
open (DATA,"$cntfile");
$count = <DATA>;
close (DATA);
$newcount = $count + 1;
#open and clobber the file to overwrite
open (DATA,"+>$cntfile");
print DATA "$newcount\n";
close (DATA);
#log the access
open (DATA, ">>$logfile");
print DATA "$ENV{'REMOTE_HOST'}\n";
close (DATA);
------------------------------
Date: Mon, 01 Oct 2001 15:46:29 GMT
From: "Jeff Boes" <jboes@nexcerpt.com>
Subject: IsSpacePerl?
Message-Id: <pd0u7.3338$el6.42340@telenews.teleline.es>
What might be causing this error?
Can't locate object method "IsSpacePerl" via
package "main" (perhaps you forgot to load "main"?)
at /usr/local/lib/perl5/5.6.1/utf8_heavy.pl line 30.
--
Jeff Boes vox 616.226.9550
Database Engineer fax 616.349.9076
Nexcerpt, Inc. jboes@nexcerpt.com
------------------------------
Date: 1 Oct 2001 16:00:00 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: IsSpacePerl?
Message-Id: <slrn9rh223.nol.rgarciasuarez@rafael.kazibao.net>
Jeff Boes wrote in comp.lang.perl.misc:
} What might be causing this error?
}
} Can't locate object method "IsSpacePerl" via
} package "main" (perhaps you forgot to load "main"?)
} at /usr/local/lib/perl5/5.6.1/utf8_heavy.pl line 30.
Hard to guess. Can you post a short example of code that causes this
error ?
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
print map substr($_,7).&$_, grep defined &$_, sort values %::;
sub Just {" another "}; sub Perl {" hacker,\n"};
------------------------------
Date: 01 Oct 2001 17:44:35 -0300
From: * Tong * <sun_tong@users.sourceforge.net>
Subject: Re: Limitation
Message-Id: <sa83d533xak.fsf@suntong.personal.users.sourceforge.net>
Kenneth Brody <kenbrody@bestweb.net> writes:
> The key word in the quote (assuming the quote is verbatim) is "only":
>
> On Unix, I am limited _only_ by my knowledge.
>
> Taking that into account, there is no way it interpret any way other
> than "Unix good, Windows bad".
Good point, thanks!
--
Tong (remove underscore(s) to reply)
*niX Power Tools Project: http://xpt.sourceforge.net/
- All free contribution & collection
------------------------------
Date: Mon, 01 Oct 2001 17:34:05 GMT
From: Doug O'Leary <dkoleary@home.com>
Subject: Re: mime::lite & duplicate emails?
Message-Id: <3BB8A8C5.CC4BAAA5@home.com>
Hey;
> I use Mime::Lite. I don't get duplicate mails. But I agree, I think your
> man might be sending the messages twice. Show us the code, preferably
> just the essence.
Thanks for the response. Since the perl script is the primary routing
system for the reservations for a major hotel chain *and* I'm a lowly
consultant, I think my chances of getting permission to post the code
are somewhat remote.
All that being said, I replied to the individual in question with the
data that I had saying that it looked like the perl script was
generating the duplicates. I got a reply a few seconds ago saying they
found the answer.
Thanks for the confirmation of my perspective...
Doug
--
--------------
Douglas K. O'Leary
Senior UNIX Admin/Independent consultant
resume: http://members.home.net/dkoleary/resume.html
--------------
------------------------------
Date: Mon, 01 Oct 2001 20:58:15 +0200
From: "Bruno Costacurta" <bc1@skynet.be>
Subject: Module File::Find and 'prune' variable
Message-Id: <20011001.205814.1186452551.1493@costacurta.org>
Hi All,
I have a question related to File::Find::prune variable which is used as
a boolean to descend or not descend into the directory specified in find
function. Correct ?
I have the following sample code:
Use File::Find;
$File::Find::prune="1";
File::Find::find(\&wanted,'/root/mail/');
sub wanted
{
print "$File::Find::name\n";
}
which unfortunately returns also the directories.
Thanks for any clue,
Bruno
------------------------------
Date: Mon, 01 Oct 2001 17:37:04 +0200
From: "Alexander Farber (EED)" <eedalf@eed.ericsson.se>
Subject: Offtopic: DMCA and perldoc perlsec
Message-Id: <3BB88DA0.FC9864CF@eed.ericsson.se>
Hi,
isn't it strange: hackers complain about legal acts used to
protect insecure encryptions (PDF) / web sites (IIS) / whatever
(and I agree with them), but then the "perldoc perlsec" states
the following:
If you're concerned about people profiting from your code,
then the bottom line is that nothing but a restrictive
licence will give you legal security. License your software
and pepper it with threatening statements like "This is
unpublished proprietary software of XYZ Corp. Your access
to it does not give you permission to use it blah blah
blah." You should see a lawyer to be sure your licence's
wording will stand up in court.
Regards
Alex
------------------------------
Date: Mon, 1 Oct 2001 11:15:12 -0500
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: Offtopic: DMCA and perldoc perlsec
Message-Id: <slrn9rh5kg.ijq.trammell@haqq.hypersloth.net>
On Mon, 01 Oct 2001 17:37:04 +0200, Alexander Farber wrote:
> isn't it strange: hackers complain about legal acts used to
> protect insecure encryptions (PDF) / web sites (IIS) / whatever
> (and I agree with them), but then the "perldoc perlsec" states
> the following:
>
> If you're concerned about people profiting from your code,
> then the bottom line is that nothing but a restrictive
> licence will give you legal security. License your software
> and pepper it with threatening statements like "This is
> unpublished proprietary software of XYZ Corp. Your access
> to it does not give you permission to use it blah blah
> blah." You should see a lawyer to be sure your licence's
> wording will stand up in court.
I think you need to pay better attention to exactly what "hackers" have
been "complaining about" lately -- you're comparing apples and oranges.
------------------------------
Date: Mon, 01 Oct 2001 11:33:13 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Offtopic: DMCA and perldoc perlsec
Message-Id: <3BB89AC9.FB5114BF@home.com>
"Alexander Farber (EED)" wrote:
>
> isn't it strange: hackers complain about legal acts used to
> protect insecure encryptions (PDF) / web sites (IIS) / whatever
> (and I agree with them), but then the "perldoc perlsec" states
> the following:
>
> If you're concerned about people profiting from your code,
> then the bottom line is that nothing but a restrictive
> licence will give you legal security. License your software
> and pepper it with threatening statements like "This is
> unpublished proprietary software of XYZ Corp. Your access
> to it does not give you permission to use it blah blah
> blah." You should see a lawyer to be sure your licence's
> wording will stand up in court.
I don't find it strange at all. Security holes are a result of poor or
buggy software. Hackers take pride in their workmanship, so it's quite
logical that they should detest both of these.
Legal security is something else entirely. Many programmers (especially
those involved in open-source projects such as Perl) believe that
software should be free[1]. Whether or not you agree with this is
irrelevant; the cultural bias is strongly evident amongst the Perl
community.
It's also a pragmatic approach. There is quite simply no technical way
to prevent a determined person from stealing your code, which means that
the best you can do is to send a lawyer after anyone who does.
-mjc
[1] free as in knowledge, not free as in cost.
------------------------------
Date: 1 Oct 2001 16:00:38 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Offtopic: DMCA and perldoc perlsec
Message-Id: <9palhm$q6s$1@charity.cs.utexas.edu>
In article <3BB88DA0.FC9864CF@eed.ericsson.se>,
Alexander Farber (EED) <eedalf@eed.ericsson.se> wrote:
>isn't it strange: hackers complain about legal acts used to
>protect insecure encryptions (PDF) / web sites (IIS) / whatever
>(and I agree with them), but then the "perldoc perlsec" states
>the following:
>
> If you're concerned about people profiting from your code,
> then the bottom line is that nothing but a restrictive
> licence will give you legal security. License your software
> and pepper it with threatening statements
It doesn't seem that strange to me. In both cases, people are
complaining about a use of technology that might give one a false sense
of security.
Also, there is a fundamental difference in the situations. With web
site security, you have two parties trying to communicate without
interference from a third party. It therefore makes sense to keep
secrets (like encryption keys) from the third party.
In the case of Perl source code, if you want someone to be able to run
it on their machine, encryption won't help because they have to be able
to decrypt it to run it. To put it another way, if you sell someone
software and you expect them to be able to use it, they *have* to be
able to decrypt any encryption that has been used.
For what it's worth, anyone who sells information is in the same boat.
In fact, all software is in the same boat. It's just a matter of the
degree of painfulness required to reverse-engineer the software.
- Logan
--
"In order to be prepared to hope in what does not deceive,
we must first lose hope in everything that deceives."
Georges Bernanos
------------------------------
Date: 1 Oct 2001 11:21:07 -0700
From: samara_biz@hotmail.com (Alex)
Subject: pack() programming question
Message-Id: <c7d9d63c.0110011021.2a39368d@posting.google.com>
Hi,
I'm designing a permissions system for the department website. The way
I'm thinking of programming it is: Every element on a webpage has a
code according to what permissions a user has to have to access it.
When a user goes to that webpage, his permissions code is compared to
that of each element on the webpage, and if the user doesn't have
enough permissions to access an element, it is just not displayed.
Examples:
user 100
element 100
------
access allowed
user 100
element 110
------------------------------
Date: Mon, 01 Oct 2001 20:45:03 +0200
From: Thomas Bätzler <thomas@baetzler.de>
Subject: Re: pack() programming question
Message-Id: <4kdhrt864ce2ogr6f97526sod4o0t07vf3@4ax.com>
On 1 Oct 2001 11:21:07 -0700, samara_biz@hotmail.com (Alex) wrote:
>I'm designing a permissions system for the department website. The way
>I'm thinking of programming it is: Every element on a webpage has a
>code according to what permissions a user has to have to access it.
>When a user goes to that webpage, his permissions code is compared to
>that of each element on the webpage, and if the user doesn't have
>enough permissions to access an element, it is just not displayed.
Sunds like a good idea. Now, what was your question? :-)
I'm assuming that you're thinking about using vec() to manage your
permissions and that you're wondering how bits are stored inside the
bit vector. Well, consider this code fragment:
#!/usr/bin/perl -w
use strict;
my $foo = "";
foreach my $bit (127, 63, 31, 15, 7, 0){
print "setting bit $bit: ";
vec( $foo, $bit, 1 ) = 1;
print join(', ',
map { sprintf "%02x", $_ }
unpack "C16", $foo
), "\n";
}
__END__
where each bit ends up is pretty much dependant on your architecture.
But this needs not to concern you as long as you always use vec to set
and read individual bits. For storage, you could convert each byte to
hex and store that - that's the least hassle.
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: 1 Oct 2001 16:26:34 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: pack() programming question
Message-Id: <9pan2a$qb5$1@charity.cs.utexas.edu>
In article <c7d9d63c.0110011021.2a39368d@posting.google.com>,
Alex <samara_biz@hotmail.com> wrote:
>I'm designing a permissions system for the department website. The way
>I'm thinking of programming it is: Every element on a webpage has a
>code according to what permissions a user has to have to access it.
>When a user goes to that webpage, his permissions code is compared to
>that of each element on the webpage, and if the user doesn't have
>enough permissions to access an element, it is just not displayed.
>
>Examples:
>
>user 100
>element 100
> ------
> access allowed
>
>user 100
>element 110
Are there any elements on the web page that more than one user should
be able to access? If so, then having only one ID for each element and
for each user may be a problem.
Imagine this scenario:
element "A": 100
user 1: 100
user 2: 100
Now you want to add element "B", so you do:
element "A": 100
element "B": 110
user 1: 100
user 2: 100
But you want user 1 to be able to access "A" and "B", so do you change
element "B" to 100 or do you change user 1 to 110? There isn't a
satisfactory solution.
The solution that gives you the most flexibility is to draw yourself a
matrix and store a boolean for each square in the matrix. For example:
element A element B
user 1 allowed allowed
user 2 allowed denied
Unfortunately, this isn't really practical, so you'll need to
compromise.
Personally, what I would do is associate a list of IDs with each web
page element. Each user would have its own ID, but you could also have
group IDs so that users could be a member of one or more groups, and
those group IDs would be treated just like user IDs (i.e. they could
either be present or absent in any element's access list).
So, for example, you might have something like this:
element A: can be accessed by IDs 100 and 101
element B: can be accessed by IDs 100 and 104
element C: can be accessed by ID 105
user 1: has ID 100
user 2: has ID 101
user 3: has ID 102
user 4: has ID 103
group 104: includes anything with ID 101, 103
group 105: includes anything with ID 104, 102
In this example, user 1 has ID 100 and can access elements A and B.
User 2 has ID 101, which automatically causes it to have ID 104, which
in turn automatically causes it to have ID 105, so it can access
everything. User 3 has ID 102, which means it also has ID 105, which
means it can access element C. You get the idea.
Well, those are my random thoughts.
- Logan
--
"In order to be prepared to hope in what does not deceive,
we must first lose hope in everything that deceives."
Georges Bernanos
------------------------------
Date: Mon, 1 Oct 2001 23:52:34 +0200
From: "novastar" <novastar@novastar.dtdns.net>
Subject: Re: perl standard error/output redirection to a file on NT??
Message-Id: <9pal2a$mqj$1@usenet.otenet.gr>
Dear,
open (shellcommand, "my_command 2>&1 |") ;
while (<shellcommand>) { print }
close shellcommand;
"SN" <throne7@my-deja.com> wrote in message
news:c2ec2c5b.0110010613.18580b4c@posting.google.com...
> Hi gurus,
>
> I am trying to run some big perl program on NT 4.0, these programs
> were developed priorly on Unix. Lots/tons of error messages are
> generated and it
> scrolls right out of my command console (cmd.exe??) I can't read
> them fast
> enough and so can't fix my program to complete the port to NT. Please
> help me
> how do you make redirection of stderr/stdout work on NT?? I tried
> this
> and it didn't work
>
> perlprog.pl > log.txt DIDNT WORK
> perlprog.pl 2>&1 >log.txt DIDN"T WORK
>
> perlprog.pl >> log.txt DIDN"T WORK
>
> what teh h?ll is going on?
------------------------------
Date: 1 Oct 2001 08:41:37 -0700
From: seckley@lucent.com (Seckley)
Subject: Perl, unix & MS SQL server7
Message-Id: <c96c2f9e.0110010741.2df1b563@posting.google.com>
can anybody point me in the right direction?
here is the question:
I work on a web sight based on a unix system w/MySql as the database
we use perl as the language. we are about to have a large influx of
data. on another server we have SQL Server 7 loaded.
if we put the data in the SQL server how can we access it from the
Unix web server ? what modules would i need? do i need perl loaded on
the NT server?
------------------------------
Date: 01 Oct 2001 19:52:19 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Perl, unix & MS SQL server7
Message-Id: <87y9mvgxxo.fsf@abra.ru>
>>>>> On 1 Oct 2001 08:41:37 -0700, seckley@lucent.com (Seckley) said:
S> can anybody point me in the right direction?
S> here is the question:
S> I work on a web sight based on a unix system w/MySql as the database
S> we use perl as the language. we are about to have a large influx of
S> data. on another server we have SQL Server 7 loaded.
S> if we put the data in the SQL server how can we access it from the
S> Unix web server ? what modules would i need? do i need perl loaded on
S> the NT server?
Google is your friend. For example first link found with search
keywords DBI MsSQL Unix:
http://www.algonet.se/~sommar/mssql/unix.html
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
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 1851
***************************************