[19948] in Perl-Users-Digest
Perl-Users Digest, Issue: 2143 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 16 14:05:59 2001
Date: Fri, 16 Nov 2001 11:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1005937508-v10-i2143@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 16 Nov 2001 Volume: 10 Number: 2143
Today's topics:
Re: array ref. and splice nobull@mail.com
Re: Best language for low IQ programmers? nospam@nospam.com
Re: Best language for low IQ programmers? (Greg Comeau)
Binary stuff <mds@wam.umd.edu>
Re: Binary stuff (Anno Siegel)
Re: Can someone tell me what i am doing wrong. Unix soc nobull@mail.com
Re: CGI-Mysql question <cpryce@pryce.net>
Re: CGI-Mysql question <stevoarnold@yahoo.co.uk>
Re: CGI-Mysql question <cpryce@pryce.net>
Compilation error (Houda Araj)
Re: Compilation error <cpryce@pryce.net>
html2txt (HTML to Text) without using lynx (Anand Ramamurthy)
Parse::RecDescent suitability question <bhemphill@concord.com>
Re: Perl generating JavaScript problem nobull@mail.com
Perl on Windows <aaron@bosssystems.com>
Re: Perl on Windows <jessica.bull@broadwing.com>
Re: Perl on Windows <tsee@gmx.net>
Re: Perl on Windows <camerond@mail.uca.edu>
Re: Personal ad script? <jessica.bull@broadwing.com>
Re: ranged arrays <tsee@gmx.net>
Re: relinquishing group permissions nobull@mail.com
slicing multi dimensional arrays <tsee@gmx.net>
Re: slicing multi dimensional arrays (Anno Siegel)
Re: specific array items, loop iterator (Mark Jason Dominus)
Re: URL To Text (url2txt) (Grod)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 Nov 2001 09:18:57 -0800
From: nobull@mail.com
Subject: Re: array ref. and splice
Message-Id: <4dafc536.0111160918.13dc3ff3@posting.google.com>
"Louis Halie" <lhalie@areyna.etrade.nl> wrote in message news:<9t2tgu$al7$1@azure.nl.gxn.net>...
> In the Perl programming book of Larry Wall and co, they state that in order
> to change the size of an array, a subroutine needs a reference of that array
> as an argument (or typeglob). (perl 5 , second edition page 116)
>
> But if i look at the function splice, which also changes the size of an
> array, its first argument is just an array.
> Can somebody perhaps mail me how this is possible?
1) A builtin function is not a subroutine. Some builtin functions
(but not splice) have semantics that would not be possible in a
subroutine.
2) A subroutine can get a reference without an explicit \ in the call
using a prototype.
3) Post here, read here.
------------------------------
Date: Fri, 16 Nov 2001 14:23:18 +0000 (UTC)
From: nospam@nospam.com
Subject: Re: Best language for low IQ programmers?
Message-Id: <9t37gm$oth$1@flood.xnet.com>
Learn COBOL. You won't have to worry about any GUI and
the language is more English like.
In comp.lang.perl.misc Brian Metc <BrianMetc@aol.com> wrote:
> I would like to get into the programing field. My problem is that I have low IQ due to
> early childhool learning deprivation and TV overdose. Simply said I am stuped, I am
> pretty good amongst my friends, but not solving problems. You know what I
> mean. Anyways, I want to go into computor programing because of money
> issue. I now need to choose languege for programming, simple enough
> for me.
> My friend wh does C plus plus recommended that I learn either Visual Basic or Eiffel.
> My ex girlfriend who is a sys admin who did perl, sugested that I learn Ada because
> it has "serious type system" which is fool proof.
> She dis couraged me from using Eiffel because itr was a language going out of the
> market, no longer used by any serious corporation, She said the same thing for Ada.
> Java is simple compared to c plus plus but a scam language, based on hype.
> This only leaves visual basic. Especally because it is used under Windows, Microsoft
> stuff is always easier.
> Would any one sugest the best language for me.
> Brian
------------------------------
Date: 16 Nov 2001 10:04:40 -0500
From: comeau@panix.com (Greg Comeau)
Subject: Re: Best language for low IQ programmers?
Message-Id: <9t39u8$4o3$1@panix3.panix.com>
In article <3BF4AA25.A72DC4BB@nyc.rr.com>, no <pulse@nyc.rr.com> wrote:
>Frances Klein wrote:
>> Java? I love to drink java at the end of a good meal. Can anyone recommend
>> a nice kosher restaurant in the southern half of Manhattan, full of
>> atmosphere and lots of choices beyond the usual?
>
>KATZ's
2nd Avenue Deli, at 10th St I think. Once upon a time a bunch
of C++ geeks used to go and eat there, perhaps they still do at times
(see http://www.cppsig.org).
--
Greg Comeau export ETA: December See our Oct 31st special
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
------------------------------
Date: Fri, 16 Nov 2001 05:30:10 -0500
From: "Mike Schmitt" <mds@wam.umd.edu>
Subject: Binary stuff
Message-Id: <9t2pu4$o7i$1@hecate.umd.edu>
I'm having a rather nasty problem with hybrid ascii/binary files.
I'm trying to process a large file with equal parts ascii (html, with very
few line returns), and binary (actual data files stored between <data> tags
in the HTML).
If you're curious, what I'm trying to do is chew up the super-huge AIM log
files, which dump every logged chat session (including drag-and-dropped
data) into one large HTML (now 100 megs on my system). It's going great,
except I'm finding no good way of reading the binary properly.
Thanks.
~Mike
------------------------------
Date: 16 Nov 2001 15:17:45 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Binary stuff
Message-Id: <9t3amp$s1q$2@mamenchi.zrz.TU-Berlin.DE>
According to Mike Schmitt <mds@wam.umd.edu>:
> I'm having a rather nasty problem with hybrid ascii/binary files.
> I'm trying to process a large file with equal parts ascii (html, with very
> few line returns), and binary (actual data files stored between <data> tags
> in the HTML).
> If you're curious, what I'm trying to do is chew up the super-huge AIM log
> files, which dump every logged chat session (including drag-and-dropped
> data) into one large HTML (now 100 megs on my system). It's going great,
> except I'm finding no good way of reading the binary properly.
Perl's basic tools for data conversion are pack and unpack. You can look
them up via "perldoc -f (un)pack". Of course you will have to know
what format your binary data is in.
Anno
------------------------------
Date: 16 Nov 2001 09:22:23 -0800
From: nobull@mail.com
Subject: Re: Can someone tell me what i am doing wrong. Unix sockets
Message-Id: <4dafc536.0111160922.25204354@posting.google.com>
"Scott" <thechile@ntlworld.com> wrote in message news:<pu6J7.457$yV.205257@news6-win.server.ntlworld.com>...
> $paddr = accept(Client,Server);
> my $buf = <$paddr>;
Surely you mean <Client> ?
------------------------------
Date: Fri, 16 Nov 2001 09:04:32 -0600
From: cpryce <cpryce@pryce.net>
Subject: Re: CGI-Mysql question
Message-Id: <B81A8720.3058%cpryce@pryce.net>
in article 9t2p1f$e3s$1@pheidippides.axion.bt.co.uk, Steve at
stevoarnold@yahoo.co.uk wrote on 11/16/01 4:12 AM:
> I have created a cgi script using perl and it connects to a mysql database
> on my server to retrieve data and print it to the screen in various manners.
> The script needs to run 2 sql queries and at the moment it follows this type
> of pattern:
>
> connect to db;
> run query1;
> close db;
> print results1;
> connect to db;
> run query2;
> close db;
> print results2;
[ snip ]
> connect to db;
> run query1;
> print results1;
> run query2;
> print results2;
> close database;
Question like these are better answered on the DBI mailing list.
There is a Perlish component to your question. If I understand correctly,
you're asking whether it's okay to leave a connection to the database
active, and run multiple queries to the same database. The answer is yes.
There is a performance benefit to connecting only once, and running multiple
queries. The docs suggest this as well, while discussing the connect
function. Perhaps taking a minute to peruse 'perldoc DBI' would be
beneficial. There is even more information on the DBI authors' Web site.
See http://dbi.symbolstone.org/ which has loads of information and a link to
subscribe to the dbi mailing list.
--
cp
------------------------------
Date: Fri, 16 Nov 2001 15:26:59 -0000
From: "Steve" <stevoarnold@yahoo.co.uk>
Subject: Re: CGI-Mysql question
Message-Id: <9t3bev$q0k$1@pheidippides.axion.bt.co.uk>
Thanks very much cpryce, thats a great help.
To Bernard - please re-read the very first line of my post -
I am hoping someone on this group has some advice, if not, you may like to
point me in the right direction.
You dont have to be so rude.
"cpryce" <cpryce@pryce.net> wrote in message
news:B81A8720.3058%cpryce@pryce.net...
> in article 9t2p1f$e3s$1@pheidippides.axion.bt.co.uk, Steve at
> stevoarnold@yahoo.co.uk wrote on 11/16/01 4:12 AM:
>
> > I have created a cgi script using perl and it connects to a mysql
database
> > on my server to retrieve data and print it to the screen in various
manners.
> > The script needs to run 2 sql queries and at the moment it follows this
type
> > of pattern:
> >
> > connect to db;
> > run query1;
> > close db;
> > print results1;
> > connect to db;
> > run query2;
> > close db;
> > print results2;
>
> [ snip ]
>
> > connect to db;
> > run query1;
> > print results1;
> > run query2;
> > print results2;
> > close database;
>
> Question like these are better answered on the DBI mailing list.
>
> There is a Perlish component to your question. If I understand correctly,
> you're asking whether it's okay to leave a connection to the database
> active, and run multiple queries to the same database. The answer is yes.
> There is a performance benefit to connecting only once, and running
multiple
> queries. The docs suggest this as well, while discussing the connect
> function. Perhaps taking a minute to peruse 'perldoc DBI' would be
> beneficial. There is even more information on the DBI authors' Web site.
>
> See http://dbi.symbolstone.org/ which has loads of information and a link
to
> subscribe to the dbi mailing list.
>
> --
> cp
>
------------------------------
Date: Fri, 16 Nov 2001 12:21:41 -0600
From: cpryce <cpryce@pryce.net>
Subject: Re: CGI-Mysql question
Message-Id: <B81AB555.3085%cpryce@pryce.net>
in article 9t3bev$q0k$1@pheidippides.axion.bt.co.uk, Steve at
stevoarnold@yahoo.co.uk wrote on 11/16/01 9:26 AM:
> Thanks very much cpryce, thats a great help.
>
> To Bernard - please re-read the very first line of my post -
> I am hoping someone on this group has some advice, if not, you may like to
> point me in the right direction.
> You dont have to be so rude.
Please take this in the helpful spirit it is intended. It's not a flame.
1) Read the FAQs[1] for a news group before you post. The FAQs for this
newsgroup outline what is an what is not considered on topic.
2) Please don't be offended when some one points out that you are off-topic.
It's considered helpful if you get ANY response, even a gruff one. Most
posters simply ignore off-topic questions entirely. The original response to
your post was, IMHO not rude. Your opinion differs, and I respect that.
3) Please trim your posts to quote the least amount of the previous response
as is necessary. Please place your response AFTER the text you are quoting.
If some one flames you for posting Jeopardy style, it's because you have
posted an answer before the question.
Again. My goal here is to help you post better questions, so that, in the
future, you get the answers that you need.
[1] http://mail.augustmail.com/~tadmc/clpmisc.shtml
For more information about netiquette in general, see the "Netiquette
Guidelines" at:
http://andrew2.andrew.cmu.edu/rfc/rfc1855.html
------------------------------
Date: 16 Nov 2001 10:01:19 -0800
From: Houda.araj@cogmedia.com (Houda Araj)
Subject: Compilation error
Message-Id: <36cd2dbf.0111161001.266e10e@posting.google.com>
This script code every source.txt every word he find in file Phrases.txt.
There is a compilation eror. Any help ?
#!/usr/bin/perl
use strict;
use diagnostics;
use CGI qw/:standard/;
use CGI::Carp 'fatalsToBrowser';
my $regex;
{
my $phrase_file = 'phrases.txt';
open PHRASES, $phrase_file or die "$phrase_file: $!";
chomp( my @phrases = <PHRASES> );
$_ = "(?:$_)" foreach @phrases;
$regex = join '|', @phrases;
}
my $paragraph;
{
my $source_file = 'source.txt';
open PHRASES, $phrase_file or die "$phrase_file: $!";
chomp( my @source = <PHRASES> );
$paragraph = join ' ', @source;
}
$paragraph =~ s/($regex)/b($1)/ige;
print p($paragraph);
__END__
------------------------------
Date: Fri, 16 Nov 2001 12:28:13 -0600
From: cpryce <cpryce@pryce.net>
Subject: Re: Compilation error
Message-Id: <B81AB6DD.3089%cpryce@pryce.net>
in article 36cd2dbf.0111161001.266e10e@posting.google.com, Houda Araj at
Houda.araj@cogmedia.com wrote on 11/16/01 12:01 PM:
> #!/usr/bin/perl
> use strict;
> use diagnostics;
> use CGI qw/:standard/;
> use CGI::Carp 'fatalsToBrowser';
>
> my $regex;
> {
> my $phrase_file = 'phrases.txt';
> open PHRASES, $phrase_file or die "$phrase_file: $!";
> chomp( my @phrases = <PHRASES> );
> $_ = "(?:$_)" foreach @phrases;
> $regex = join '|', @phrases;
> }
>
> my $paragraph;
> {
> my $source_file = 'source.txt';
Hint: ^^^^^^^^^
> open PHRASES, $phrase_file or die "$phrase_file: $!";
^^^^^^^^^^^^ ^^^^^^^^^^^^^
> chomp( my @source = <PHRASES> );
> $paragraph = join ' ', @source;
> }
>
> $paragraph =~ s/($regex)/b($1)/ige;
> print p($paragraph);
>
> __END__
Diagnostics TELLS you what is wrong, and it tells you WHAT LINE to Fix! Did
you run this from the command line and get your error message??
--
cp
------------------------------
Date: 16 Nov 2001 06:44:56 -0800
From: anand_ramamurthy@yahoo.com (Anand Ramamurthy)
Subject: html2txt (HTML to Text) without using lynx
Message-Id: <761041e6.0111160644.7f4c462c@posting.google.com>
I am looking for a html2txt script (without using lynx).
My main concern is handling tables correctly.
------------------------------
Date: Fri, 16 Nov 2001 19:52:06 +0100
From: Barry Hemphill <bhemphill@concord.com>
Subject: Parse::RecDescent suitability question
Message-Id: <31oavtclm3suuq3e72rol0gebqo2bdbko3@4ax.com>
I would like to create a parser for a report definition language with
the format shown below. Before I started writing from scratch I
thought I'd look at some modules which might help, and
Parse::RecDescent certainly looked to be the thing. It also looks to
have a fairly steep learning curve, and unfortunately I don't have any
yacc experience, so before I put a lot of time in going down the wrong
path, I'm wondering if anyone could give me an idea if RecDescent
would be suitable. Here's a quick overview of the format:
Basically, we have 3 types of assignments:
- simple
keyword value
- complex
keyword {
keyword value
}
- complex with tagname
keyword tagname {
keyword value
}
A sample of the code:
chartStyles {
chartStyle stdChartNoLegendTemplate {
xAxis {
drawOffset 0.0
maxSize 2.0
tickTextStyle stdAxisTick
}
etc...
}
}
The keywords are all simple strings (no spaces, no quotes), and the
values can have quoted strings, embedded commas, escaped quotes within
strings ( \" ), etc. Also the complex statements can be nested many
levels deep. Just starting from scratch I can see I'd have a good bit
of work ahead, so I'm hoping RecDescent might be of help.
Incidentally, if anyone could point me at some samples of any kind of
similar task using Parse::RecDescent I'd appreciate it. I had a look
through the demos directory but none of the tasks seem very similar.
Anyway, thanks in advance,
Barry
----
Barry Hemphill
bhemphill@concord.com
Course Developer/Instructor
"Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so."
-- Douglas Adams, Last Chance to See
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
Check out our new Unlimited Server. No Download or Time Limits!
-----== Over 80,000 Newsgroups - 19 Different Servers! ==-----
------------------------------
Date: 16 Nov 2001 09:47:40 -0800
From: nobull@mail.com
Subject: Re: Perl generating JavaScript problem
Message-Id: <4dafc536.0111160947.239bc70d@posting.google.com>
aneely@softouch.on.ca (Amer Neely) wrote in message news:<331f54ba.0111151729.34ab614c@posting.google.com>...
> I'm writing some CGI with Perl and want to include a JavaScript
> library I have. When I include the JS source code in a Perl 'here'
> document, everything works fine. But when I try to import the JS from
> an external file, I get server errors.
This sounds very unlikely to be related to Perl in any way.
This sounds like the 'go jump in the lake'[1] problem to me.
> I've tried defining the external file like this:
> my $SCRIPT_SRC = "mycd.js";
>
> and like this:
> my $SCRIPT_SRC = "http://127.0.0.1/cgi-bin/sql/mycd.js";
Have you checked that a GET request issued by the browser to that URL
actully gets the Javascript source? If not then your problem has
nothing whatever to to with Perl.
Note: 127.0.0.1 means that you are instructing the browser to load the
script from a web server running on the same machine as is running the
browser. Is that really what you meant. This has nothing to do with
Perl.
Note also that many web servers are configured by default to treat
stuff the (virtual) directory /cgi-bin as CGI. This has nothing to do
with Perl.
> What am I missing here.
Most likey the fact that this has nothing whatever to do with Perl.
[1] FYI: The 'go jump in the lake' problem:
> Hi, I've written the following Perl program:
>
> #!/usr/lib/perl
>
> print "Go jump in the lake\n";
>
> __END__
>
> It doesn't work. When a user runs the program they just sit there. What
> is wrong with my Perl?
------------------------------
Date: Fri, 16 Nov 2001 11:02:46 -0500
From: "Aaron Hartley" <aaron@bosssystems.com>
Subject: Perl on Windows
Message-Id: <aLaJ7.11963$V9.1342751@news.direcpc.com>
Hello,
How do you run a perl program on windows (specifically win 2000)? I not
talking about an editor, just the basic requirements for running from
command line a simple program done in a text editor.
Thanks,
Aaron
------------------------------
Date: Fri, 16 Nov 2001 17:17:47 GMT
From: "Jessica Bull" <jessica.bull@broadwing.com>
Subject: Re: Perl on Windows
Message-Id: <%SbJ7.5770$dk.250495@bin1.nnrp.aus1.giganews.com>
the program has to have the extension .pl
perl must be installed from the pc you are running it on (activestate perl
is best. you can download for free)
from command line..cd to directory where file is.
simply type in name of file
cmd> sample.pl
"Aaron Hartley" <aaron@bosssystems.com> wrote in message
news:aLaJ7.11963$V9.1342751@news.direcpc.com...
> Hello,
>
> How do you run a perl program on windows (specifically win 2000)? I not
> talking about an editor, just the basic requirements for running from
> command line a simple program done in a text editor.
>
> Thanks,
> Aaron
>
>
>
------------------------------
Date: Fri, 16 Nov 2001 18:52:14 +0100
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: Perl on Windows
Message-Id: <9t3jn2$7tm$00$1@news.t-online.com>
"Jessica Bull" <jessica.bull@broadwing.com> schrieb im Newsbeitrag
news:%SbJ7.5770$dk.250495@bin1.nnrp.aus1.giganews.com...
| the program has to have the extension .pl
| perl must be installed from the pc you are running it on (activestate perl
| is best. you can download for free)
| from command line..cd to directory where file is.
| simply type in name of file
Or, if the file doesn't have that extension, type
perl file.ext<ENTER>
--
$_=q;0cb212c210b0bb010c0113bb0c410c0b516c0bb3d212c2b0b0b016b6cb2b2c21010c0
b41110b3bba0e0c0d2c4b2b6bc013d2c0d0b01012b0b0;;s/\n//g;s/(\d)/$1<2?$1:'0'x
$1/ge;s/([a-f])/'1'x(ord($1)-97)/ge;$o=$_;push@o,substr($o,$_*8,8) for(0..
24);for(@o){print"\0"x(26-$i).chr(oct('0b'.($_)))."\r";$i++};print"\n"#stm
------------------------------
Date: Fri, 16 Nov 2001 12:01:48 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Perl on Windows
Message-Id: <3BF5548C.FCA4AFF6@mail.uca.edu>
(Jeopardized quoting corrected)
Jessica Bull wrote:
>
> "Aaron Hartley" <aaron@bosssystems.com> wrote in message
> news:aLaJ7.11963$V9.1342751@news.direcpc.com...
> > Hello,
> >
> > How do you run a perl program on windows (specifically win 2000)? I not
> > talking about an editor, just the basic requirements for running from
> > command line a simple program done in a text editor.
> >
> > Thanks,
> > Aaron
> >
> >
> >
> the program has to have the extension .pl
BRAACCCK! No, you can call it anything you want, even .exe, although
this might confuse others. With a random extension you have to call it
with
perl foo.ext
instead of your suggestion below. However, .pl is customary, and is
installed by default with ActivePerl, as you suggest getting (which I
would suggest, too).
> perl must be installed from the pc you are running it on (activestate perl
> is best. you can download for free)
> from command line..cd to directory where file is.
> simply type in name of file
>
> cmd> sample.pl
This only works if you have the extension mapped on your system to
perl.exe, see above.
Cameron
--
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu
------------------------------
Date: Fri, 16 Nov 2001 17:07:16 GMT
From: "Jessica Bull" <jessica.bull@broadwing.com>
Subject: Re: Personal ad script?
Message-Id: <8JbJ7.10539$8q.433046@bin2.nnrp.aus1.giganews.com>
Specific details of what you want the script to do would be helpful.
"1" <kfisher@nyc.rr.com> wrote in message
news:8N1J7.88877$XA5.15352122@typhoon.nyc.rr.com...
> Hello. I am looking for a personal ad script to power a free matchmaking
> website, of a quality approaching match.com.
>
> I have found a few scripts on the web for free, and many for a fee (Such
as
> e-personals). I have not found a good free one yet, and though I really
> don't mind paying for a script, I am not sure which ones are good. (I have
a
> very small budget, so I would much prefer a free one or a try and buy.)
>
> Does anyone have or know where I can find a good, customizable
> personals/classified ad script? Php or Perl are what I need.
>
> I will be back to this board to check, but if you would e-mail me a reply,
I
> would really appreciate it.
>
> Thanks,
>
> Ken
>
> kenneth@fisher-net.com
>
>
>
>
>
>
>
------------------------------
Date: Fri, 16 Nov 2001 17:11:05 +0100
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: ranged arrays
Message-Id: <9t3dq4$v7c$03$1@news.t-online.com>
"Steffen Müller" <tsee@gmx.net> schrieb im Newsbeitrag
news:9t16p9$g9f$00$1@news.t-online.com...
| Slices in the way you suggested should be implemented next.
Done. In the 'frisky' way ;)
$obj->get( [-1 .. 1], 3, [1, 3] );
Gives:
-1,3,1 -1,3,3
0,3,1 0,3,3
1,3,1 1,3,3
However, it does use the range op.
I'll mail the code to anybody who's interested, but I don't want to post the
whole source. Feel free to either mail me directly or post into this thread.
Steffen
--
$_=q;0cb212c210b0bb010c0113bb0c410c0b516c0bb3d212c2b0b0b016b6cb2b2c21010c0
b41110b3bba0e0c0d2c4b2b6bc013d2c0d0b01012b0b0;;s/\n//g;s/(\d)/$1<2?$1:'0'x
$1/ge;s/([a-f])/'1'x(ord($1)-97)/ge;$o=$_;push@o,substr($o,$_*8,8) for(0..
24);for(@o){print"\0"x(26-$i).chr(oct('0b'.($_)))."\r";$i++};print"\n"#stm
------------------------------
Date: 16 Nov 2001 09:33:13 -0800
From: nobull@mail.com
Subject: Re: relinquishing group permissions
Message-Id: <4dafc536.0111160933.5dc09dbd@posting.google.com>
"Sean Hamilton" <sh@planetquake.com> wrote in message news:<jh2J7.9081$c4.1481599@news0.telusplanet.net>...
> Greetings,
>
> I have a script running setuid. As soon as the user authenticates, I'm
> calling getpwnam and setting $<, $(, $>, and $) accordingly. However, the
> script still maintains the group permissions of its caller (Apache),
The following should work on many Unicies:
# Ugly, ugly, ugly...
sub setgroups {
require 'syscall.ph';
syscall &SYS_setgroups, @_+0, pack("s*", @_);
}
> and I think it may be possible for it to change its id back up to root or
> whatever.
Not sure about that one. I think that once both real and effective
UID are non-root you can't change UID, GID or group memberships.
------------------------------
Date: Fri, 16 Nov 2001 15:06:08 +0100
From: "Steffen Müller" <tsee@gmx.net>
Subject: slicing multi dimensional arrays
Message-Id: <9t36g0$1pg$01$1@news.t-online.com>
[
I tried to post this to clp.moderated on 11-12-2001, but it has been neither
accepted nor rejected, so as multiple posts appeared in clp.moderated since
then, I fear something did not work (maybe I didn't :). I sincerely hope
this is not going to be a double-post. If so, please excuse it. (me?)
]
Hi,
I have been torturing my head and the perldocs for a simple solution,
but failed (or I would not post in the first place ;). What I am trying to
do is to create a copy of a portion of a multi-dimensional array. Please do
not tell me they do not really exist in Perl, as I already know that.
A simple example:
my @large_ary = ( [ 1 .. 5 ], [ 'a' .. 'e' ] );
# may have arbitrary dimensions.
my @coords = (1, 1);
my @dimensions = (2, 2);
my @portion = multi_dim_slice( \@large_array, \@coords, \@dimensions );
@portion should then be:
( [ 2, 3 ], [ 'b', 'c' ] )
This is demonstration code, untested and not the actual application. I
chose to pass array refs because the number of coords and dimensions is
arbitrary and perhaps unknown at compile time.
I am not plainly asking you to do my work, instead I am thankful for any
hint or idea on how to do this. Perhaps there is some simple mechanism I am
missing? Just FYI, I am trying to find all occurrances of a small matrix
within a larger one and would compare slices of the large one to the smaller
(pattern) matrix. The program works with a bunch of workarounds, but I would
be able to use Data::Compare if I had the slices.
Thanks for your time and effort.
Steffen
--
$_=q;0cb212c210b0bb010c0113bb0c410c0b516c0bb3d212c2b0b0b016b6cb2b2c21010c0
b41110b3bba0e0c0d2c4b2b6bc013d2c0d0b01012b0b0;;s/\n//g;s/(\d)/$1<2?$1:'0'x
$1/ge;s/([a-f])/'1'x(ord($1)-97)/ge;print"\n";$o=$_;push@o,substr($o,$_*8,
8)for(0..24);for(@o){print"\0"x(26-$i).chr(oct('0b'.($_)))."\n";$i++}#st_m
------------------------------
Date: 16 Nov 2001 15:12:23 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: slicing multi dimensional arrays
Message-Id: <9t3acn$s1q$1@mamenchi.zrz.TU-Berlin.DE>
According to Steffen Müller <tsee@gmx.net>:
> [
> I tried to post this to clp.moderated on 11-12-2001, but it has been neither
> accepted nor rejected, so as multiple posts appeared in clp.moderated since
> then, I fear something did not work (maybe I didn't :). I sincerely hope
> this is not going to be a double-post. If so, please excuse it. (me?)
> ]
>
> Hi,
> I have been torturing my head and the perldocs for a simple solution,
> but failed (or I would not post in the first place ;). What I am trying to
> do is to create a copy of a portion of a multi-dimensional array. Please do
> not tell me they do not really exist in Perl, as I already know that.
>
> A simple example:
>
> my @large_ary = ( [ 1 .. 5 ], [ 'a' .. 'e' ] );
> # may have arbitrary dimensions.
>
> my @coords = (1, 1);
> my @dimensions = (2, 2);
>
> my @portion = multi_dim_slice( \@large_array, \@coords, \@dimensions );
>
> @portion should then be:
> ( [ 2, 3 ], [ 'b', 'c' ] )
>
> This is demonstration code, untested and not the actual application. I
> chose to pass array refs because the number of coords and dimensions is
> arbitrary and perhaps unknown at compile time.
I find it hard to derive how a multi-dimensional slice is supposed to work
from your single example. Could you show another case or two?
Anyway, this smells of recursion. Whatever the details, I'd look into
an approach like this:
sub multi_dim_slice {
my ( $array, $coords, $dimensions) = @_;
if ( "$coords and $dimensions are such that some (more)
slicing must be done" ) {
"extract $current_coord and $current_dimension from
@$coords and @$dimensions, reducing them somehow";
"let @partial_slice be the result of a one-dimensional
slice of @$array, according to $current_coord and
$current_dimension";
return multi_dim_slice( \ @partial_slice, $coords, $dimensions);
} else {
# no slicing necessary
return @$array;
}
}
This would likely be destructive to @coords and @dimensions, so
you may want a wrapper around it.
Anno
------------------------------
Date: Fri, 16 Nov 2001 18:23:22 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: specific array items, loop iterator
Message-Id: <3bf5599a.2e35$26e@news.op.net>
In article <slrn9v9ni7.3il.bernard.el-hagin@gdndev25.lido-tech>,
Bernard El-Hagin <bernard.el-hagin@lido-tech.net> wrote:
>On 16 Nov 2001 00:40:04 -0800, nobull@mail.com <nobull@mail.com> wrote:
>> "Sean Hamilton" <sh@planetquake.com> wrote in message news:<jALI7.5092$c4.957093@news0.telusplanet.net>...
>>
>>> 2. I seem to recall reading somewhere about some variable which indicates
>>> the current index in a foreach (@array) loop. Which variable is this?
>>
>> I seem to recall reading that thread too.
>>
>> I think, however, it was in the context of a proposed addition for a
>> future version of Perl.
>
>
>I can confirm that. Anno suggested using $#.
It is now a rejected proposed addition for a future version of Perl.
Abhijit Menon-Sen produced a patch, but it was not accepted.
So you should not expect to see it before Perl 6 at the earliest.
--
@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: 16 Nov 2001 08:20:02 -0800
From: ggrothendieck@volcanomail.com (Grod)
Subject: Re: URL To Text (url2txt)
Message-Id: <ffd662ea.0111160820.5f8ed8fe@posting.google.com>
anand_ramamurthy@yahoo.com (Anand Ramamurthy) wrote in message news:<761041e6.0111151235.71391844@posting.google.com>...
> I am looking for a script for converting an URL to TEXT,
> which takes care of tables also.
Check out the following for numerous leads on converting
HTML to text and other formats:
http://www.w3.org/Tools/html2things.html
------------------------------
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 2143
***************************************