[11346] in Perl-Users-Digest
Perl-Users Digest, Issue: 4946 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 19 22:07:28 1999
Date: Fri, 19 Feb 99 19:00:25 -0800
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, 19 Feb 1999 Volume: 8 Number: 4946
Today's topics:
(PK)Zip Interface? <theglauber@my-dejanews.com>
Re: [Q] CGI.pm for CGI script? dturley@pobox.com
Re: Anyone know of a stock quote script? (Doug O'Leary)
Re: automatic converters of perl4 to perl5 (Randal L. Schwartz)
Re: can I run perl on Win 98?????? <jonesy@rmi.nospam.net>
Re: delete line? <Allan@Due.net>
Re: delete line? <Allan@Due.net>
DEMO: don't fill up the disk -- silently <tchrist@mox.perl.com>
FAQ 8.26: Why doesn't open() return an error when a pip <perlfaq-suggestions@perl.com>
FAQ 8.28: How can I call backticks without shell proces <perlfaq-suggestions@perl.com>
FAQ 8.29: Why can't my script read from STDIN after I g <perlfaq-suggestions@perl.com>
guestbook perl script <dstern@aschwebhosting.com*nospam*>
Help I How to use SENDMAIL with Perlshop <celinher@ms12.hinet.net>
Re: How long would the Unixes last without Perl? (Doug O'Leary)
Looking for two CGI Scripts <tjw-pop@ipmedia.net>
Re: My, oh my! <tchrist@mox.perl.com>
Re: perl compiled code cacheing (Abigail)
perl ldap problem HELP please <shaven.monkey@throw.me.the.banana.first>
Perl posts to newsgroups? <shawn@sorcerysoftware.com>
Re: Perl posts to newsgroups? <tchrist@mox.perl.com>
pipe problem <mm93064@central.ntua.gr>
Re: Printing all environment variables (Andre L.)
SRC: hrefsub - make substitutions in link fields of HTM <tchrist@mox.perl.com>
SRC: igrep - grep recursively in include files <tchrist@mox.perl.com>
SRC: manpath - figure out implicit manpath <tchrist@mox.perl.com>
Re: String Manipulation (yet another newbie question) asssi@my-dejanews.com
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 20 Feb 1999 01:08:06 GMT
From: The Glauber <theglauber@my-dejanews.com>
Subject: (PK)Zip Interface?
Message-Id: <7al1th$mak$1@nnrp1.dejanews.com>
Hello,
Just as i was starting to have too much fun using Compress::zlib to
manipulate gzip files, now i need to manipulate "ZIP" (aka PKZip) files
too. Is there an interface to zip files similar to what is provided in
Compress::zlib?
Thanks for any pointers.
Glauber
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 20 Feb 1999 02:23:24 GMT
From: dturley@pobox.com
Subject: Re: [Q] CGI.pm for CGI script?
Message-Id: <7al6aj$pup$1@nnrp1.dejanews.com>
In article <7akqjd$j1t$1@vixen.cso.uiuc.edu>,
research@proton.vlsi.uiuc.edu (green) wrote:
> but all I can see on the Web is just a simple text file,
Because that's what you sent:
> print header('text/plain'), "Nothing to it!";
Try:
print header('text/html'), "Nothing to it!";
or, more simply:
print header, "Nothing to it!";
or even better:
print header, 'Nothing to it!';
--
____________________________________
David Turley
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 19 Feb 1999 20:54:41 -0600
From: dkoleary@wwa.com (Doug O'Leary)
Subject: Re: Anyone know of a stock quote script?
Message-Id: <MPG.1137dfea8d84db8e98968c@news.wwa.com>
In article <78kjlg$64o$0@205.211.154.11>, cypher5@yahoo.die.spammers.com
says...
> Hi,
> I'm looking for a stock quoting script that would send thw output to
> email. Does anyone know of such a script?
If I remember right, there's a module that does some of that for you; at
least I remember seeing that while I was browsing through CPAN modules.
HTH.
Doug
--
==============
Douglas K. O'Leary
Senior System Admin
dkoleary@wwa.com
doleary@ms.acxiom.com
==============
------------------------------
Date: 19 Feb 1999 18:00:35 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: automatic converters of perl4 to perl5
Message-Id: <m1btip3kcc.fsf@halfdome.holdit.com>
>>>>> "vvv" == vvv <vvv@vvv.vsu.ru> writes:
vvv> are there automatic converters of perl4 scripts to perl5 available?
No converter is necessary in general.
Be sure to run "perl -cw yourproggy" though, and fix up anything
it complains about. There's no way an automatic program can do that,
or Perl would have done it anyway. :)
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 20 Feb 1999 01:34:10 GMT
From: Jonesy <jonesy@rmi.nospam.net>
Subject: Re: can I run perl on Win 98??????
Message-Id: <7al3ei$a82$2@news1.rmi.net>
: <t_alter@hotmail.com> wrote in message
: news:7akdfb$4p8$1@nnrp1.dejanews.com
: can I run perl on Win 98??????
You can if you stop using so many "?"s !
------------------------------
Date: Fri, 19 Feb 1999 21:00:30 -0500
From: "Allan M. Due" <Allan@Due.net>
Subject: Re: delete line?
Message-Id: <EHoz2.263$986.5262@nntp1.nac.net>
Ronald J Kimball wrote in message
<1dng423.141phy5wfg9siN@bay2-338.quincy.ziplink.net>...
:Allan M. Due <Allan@due.net> wrote:
:
:> Hmm, are you Dan and Thelma? If not then it may be premature to label my
:> suggestion a failure (then again- maybe not <g>). Does your newsreader
:> indicate that my followup was directed to a post you made? It was not.
:
:Whoa... I thought the whole point of newsgroups was that the answers
:are available and the discussions are open to everyone. If you don't
:want other people joining in, Allan, might I suggest that you send your
:answers via email instead?
Oh boy. Ronald, you completely misunderstand my intent and emotional valance.
Replies in this newsgroup are often of the type please the FAQ. For whatever
reason, she responded to mine and I was surprised. I have actually seen
multiple cases where threads appear incorrectly sorted in some newsreaders.
So was not trying to be snide, I was just saying if she thought my response
was to here post it was not. To me the Hope This Helps was directed to author
of the original post not the group as a whole. So I was surprised that she
responded that my message was unhelpful to her. Not angry, just surprised.
:You appear to be under the mistaken assumption that Thelma was
:questioning the validity of your response. She was not. She was simply
:saying that, having followed the advice in your response, she required
:further help. Don't take it personally, huh?
Sorry if it seemed that way, I did put the <g> in there to try and indicate
that my tone was not intended to be aggressive.
:
:> Now, if in your post you indicate that you have read the FAQ and the docs,
:> you have tried X but it still doesn't work, and you don't know why; then
:> folks will generally try to help reach a better understanding of the
:> material.
I think we have snipped quite a bit here and my original intent cannot be
clearly seen. But then again that might be me.
:Well, it doesn't seem to have worked in this case. Thelma clearly
:stated that she had read the FAQ, and that she didn't understand it, and
:that she had tried doing X, and that X is too slow and tedious. But
:instead of trying to help her reach a better understanding, you attacked
:her for responding to your message, needlessly justified your previous
:post which was not at question, and gave her instructions on posting
:that she had already followed.
Well you have taken out the part of the message that I included and the
original post by Thelma seems to be gone but I interpreted the her post not
as a specific request for help, but rather a comment that replies that say
"Read
the FAQ" make her reluctant to post to this newsgroup.
I was trying to convey information that would make it less likely for her to
get a Read the FAQ answer. I readily admit I may have misinterpreted her
post. If all she was asking was how to do X then I was babbling on for no
reason. But I was trying to address what I thought was her concern. I think
if you read my post again you will see that I was not trying to denigrate or
put here down. I was trying to get her to say where she was having problems
so that help might be offered.
:Oh, no, wait, in the end of the message you did post a snippet of help,
:but then followed with a snide comment that was completely undeserved.
I am sorry you took it that way, it was never my intent to be snide. It was
supposed to be amusing - you know kindness of strangers - a Tennessee Williams
kind of thing (quite unsuccessful attempt at humor apparently- I should no
better). My intention was to try and help her know best how to ask questions
so that she could get the kind of response she was looking for. If this was
not communicated well then Thelma, you and anyone else who took it this way
have my apologies. If it is any consolation, I have been communicating with
Thelma via email and she seems not to have taken the same degree of umbrage
with my post. As it turns out my snippet was not that helpful as I did not
have a good idea of what she was actually trying to do. I think now I have
been able to be more helpful, once I new what her goal actually was. Then
again, once again, I might well be wrong.
I have to admit, I feel kind of like I am in the twilight zone here. I post a
response to someone, say "hope this helps" and then someone else says it
doesn't. I honestly try to provide assistance, but now someone else
interprets that attempt as my being snide, unhelpful, and as demonstrating a
lack of interest in helping others or in having others participate in the
discussion. Yikes. I was just trying to say: ask your question clearly and
folks will try to help you. I will try to be clearer in the future.
AmD
[posted and mailed]
------------------------------
Date: Fri, 19 Feb 1999 21:57:56 -0500
From: "Allan M. Due" <Allan@Due.net>
Subject: Re: delete line?
Message-Id: <7xpz2.267$986.5718@nntp1.nac.net>
Allan M. Due wrote in message ...
:Ronald J Kimball wrote in message
:<1dng423.141phy5wfg9siN@bay2-338.quincy.ziplink.net>...
::Allan M. Due <Allan@due.net> wrote:
::
:Oh boy. Ronald, you completely misunderstand my intent and emotional
valance.
Ok, I have reached the point that I find myself laughing out loud at myself.
Not a good sign. That should read valence. I don't think that Ronald
misunderstood my emotional ornamental drapery. It is quite clearly time to
call it a day.
AmD
------------------------------
Date: 19 Feb 1999 19:20:45 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: DEMO: don't fill up the disk -- silently
Message-Id: <36ce1bfd@csnews>
Have you ever run the equivalent of:
$ program > output
only to have the disk fill up, but the program not exit non-zero?
This will cause your program to manually close stdout as it destructs,
and if there's a problem, emit a warning and change the exit status.
sub END {
return if close(STDOUT);
warn "Couldn't close STDOUT: $!";
$? = $!;
}
--tom
--
You are the sponsor for the account andrew (Andrew Hume).
------------------------------
Date: 19 Feb 1999 17:06:38 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 8.26: Why doesn't open() return an error when a pipe open fails?
Message-Id: <36cdfc8e@csnews>
(This excerpt from perlfaq8 - System Interaction
($Revision: 1.36 $, $Date: 1999/01/08 05:36:34 $)
part of the standard set of documentation included with every
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq8.html
if your negligent system adminstrator has been remiss in his duties.)
Why doesn't open() return an error when a pipe open fails?
Because the pipe open takes place in two steps: first Perl calls fork()
to start a new process, then this new process calls exec() to run the
program you really wanted to open. The first step reports success or
failure to your process, so open() can only tell you whether the fork()
succeeded or not.
To find out if the exec() step succeeded, you have to catch SIGCHLD and
wait() to get the exit status. You should also catch SIGPIPE if you're
writing to the child--you may not have found out the exec() failed by
the time you write. This is documented in the perlipc manpage.
In some cases, even this won't work. If the second argument to a piped
open() contains shell metacharacters, perl fork()s, then exec()s a shell
to decode the metacharacters and eventually run the desired program. Now
when you call wait(), you only learn whether or not the *shell* could be
successfully started. Best to avoid shell metacharacters.
On systems that follow the spawn() paradigm, open() *might* do what you
expect--unless perl uses a shell to start your command. In this case the
fork()/exec() description still applies.
--
There's no such thing as a simple cache bug. --Rob Pike
------------------------------
Date: 19 Feb 1999 18:46:14 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 8.28: How can I call backticks without shell processing?
Message-Id: <36ce13e6@csnews>
(This excerpt from perlfaq8 - System Interaction
($Revision: 1.36 $, $Date: 1999/01/08 05:36:34 $)
part of the standard set of documentation included with every
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq8.html
if your negligent system adminstrator has been remiss in his duties.)
How can I call backticks without shell processing?
This is a bit tricky. Instead of writing
@ok = `grep @opts '$search_string' @filenames`;
You have to do this:
my @ok = ();
if (open(GREP, "-|")) {
while (<GREP>) {
chomp;
push(@ok, $_);
}
close GREP;
} else {
exec 'grep', @opts, $search_string, @filenames;
}
Just as with system(), no shell escapes happen when you exec() a list.
There are more examples of this the section on "Safe Pipe Opens" in the
perlipc manpage.
--
"Computer Science is no more about computers than astronomy
is about telescopes." --E.W. Dijkstra
------------------------------
Date: 19 Feb 1999 19:21:19 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 8.29: Why can't my script read from STDIN after I gave it EOF (^D on Unix, ^Z on MS-DOS)?
Message-Id: <36ce1c1f@csnews>
(This excerpt from perlfaq8 - System Interaction
($Revision: 1.36 $, $Date: 1999/01/08 05:36:34 $)
part of the standard set of documentation included with every
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq8.html
if your negligent system adminstrator has been remiss in his duties.)
Why can't my script read from STDIN after I gave it EOF (^D on Unix, ^Z on MS-DOS)?
Because some stdio's set error and eof flags that need clearing. The
POSIX module defines clearerr() that you can use. That is the
technically correct way to do it. Here are some less reliable
workarounds:
1 Try keeping around the seekpointer and go there, like this:
$where = tell(LOG);
seek(LOG, $where, 0);
2 If that doesn't work, try seeking to a different part of the file and
then back.
3 If that doesn't work, try seeking to a different part of the file,
reading something, and then seeking back.
4 If that doesn't work, give up on your stdio package and use sysread.
--
Perl programming is an *empirical* science!
--Larry Wall in <10226@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: Fri, 19 Feb 1999 20:36:30 -0500
From: "Anonymous" <dstern@aschwebhosting.com*nospam*>
Subject: guestbook perl script
Message-Id: <7al3gn$l46$1@winter.news.rcn.net>
Has anyone ever written a *working* guestbook script for an NT server? If
so, please assist me...if not, please assist me =)
My guestbook.pl script:
#GUESTBOOK.PL
$file = "D:\Customer Sites\DStern\cgi-bin\guestbook.dat";
$date = localtime(time);
$ENV{"REQUEST_METHOD"} eq "POST" ? &Add_Guest($file) :
&Display_Book($file);
%data_received = &User_Data();
&No_SSI(*data_received);
if ($data_received{"name"} ne "") {
$new_guest = "<B>Name:</b> $data_received{\"name\"}<br>\n";
$new_guest .= "<B>Data:</B> $date<BR>\n";
$new_guest .= "<B>E-Mail:</b> <a
href="\"mailto:$data_received{\"email\"}\">$data_recieved{\"email\"}</A><BR>
\n" if
$data_received{"email"} ne "";
$new_guest .="<b>Home page URL:</b> <A
href=\"$data_received{\"url"}\">$data_recieved{\"url\"}</a><br>\n" if
$data_received{"url} ne "";
$new_guest .= "$data_received{\"city\"}, " if $data_recieved{"city"} ne
"";
$new_guest .= "$data_recieved{\"state\"} " if $data_recieved{"state"} ne
"";
$new_guest .= "$data_recieved{\"country\"}<br>\n" if
$data_received{"country"}
ne "";
$new_guest .= "<b>Comments:</b> $data_received{\"comments\"}\n" if
$data_received{"comments"} ne "";
$new_guest .= "<p><hr><p>\n";
open(GUESTBOOK,"$guestbookfile") || die "Content-type: text/text\n\nCannot
open
$guestbookfile";
@guestbook = <GUESTBOOK>;
close (GUESTBOOK)
unshift(@guestbook, $new_guest);
open (GUESTBOOK,">$guestbookfile") || die "Content-type:
text/text\n\nCannot
open $guestbookfile";
print GUESTBOOK @guestbook;
close (GUESTOOK);
&Display_Book($guestbookfile);
} else {
print "Content-type: text/html\n\n";
print "<H1>Sign-In Unsuccessful</H1>\n";
print "You must enter your name to be added to the guest book.";
}
}
sub Display_Book {
local ($guestbookfile_ = @_;
local (@guestbook);
open (GUESTBOOK,"$guestbookfile") || die "Content-type: text/text\n\nCannot
open
$guestbookfile";
@guestbook = <GUESTBOOK>;
close(GUESTBOOK);
print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>My Guestbook</TITLE></HEAD><BODY>";
print "<H1>My Guest book</H1>";
print @guestbook;
print </BODY></HTML>";
}
sub No_SSI {
local (*data) = @_;
foreach $key (sort keys(%data)) {
$data{$key} =~ s/<!--(.|\n)*-->//g;
}
}
sub User_Data {
local (%user_data, $user_string, $name_value_pair,
@name_value_pairs, $name, $value);
if ($ENV("REQUEST_METHOD") eq "POST") {
read(STDIN,$user_string,$ENV{"CONTENT_LENGTH"});
} else {
$user_string = $ENV("QUERY_STRING");
}
$user_string =~ s/\+/ /g;
@name_value_pairs = split(/&/. $user_string);
foreach $name_value_pair (@name_value_pairs) {
($name, $value) = split(/=/, $name_value_pair);
$name =~
s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/ge;
$value =~
s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/ge;
if (defined($user_data{$name})) {
$user_data($name} .= " : " . $value;
} else {
$user_data{$name} = $value;
}
}
return %user_data;
}
It returns the error:
'D:\User Space\Webmaster\cgi-bin\guestbook.pl' script produced no output
Please give me some help on this. Thank you.
------------------------------
Date: Sat, 13 Feb 1999 22:02:03 +0800
From: "Herve" <celinher@ms12.hinet.net>
Subject: Help I How to use SENDMAIL with Perlshop
Message-Id: <7a40ms$5qd@netnews.hinet.net>
Hello,
I spent hours trying to Set the right address to use sendmail on Perlshop
but noway!
I set the followings
$mail_via = 'sendmail';
$sendmail_loc = 'bin/sendmail';
$smtp_addr = Here I put my server adress (where ma site is hosted)
but it doesn't work.
If you can help me that would be very very very nice !!!
Hoping I'm not disturbing your group, if so I apologize.
Hervi Mauric
------------------------------
Date: Fri, 19 Feb 1999 20:39:47 -0600
From: dkoleary@wwa.com (Doug O'Leary)
Subject: Re: How long would the Unixes last without Perl?
Message-Id: <MPG.1137dc72aed5c0a98968b@news.wwa.com>
In article <79q3b7$gvc@zk2nws.zko.dec.com>, tice@hunch.zk3.dec.com
says...
[[Lots-o-snip]]
> >Until Compaq starts selling and supporting Linux on their
> >servers it will not be taken seriously by my management (and, I believe, most
> >companies as well).
>
How 'bout IBM? They had a press release earlier this week in which they
stated that they'll start selling IBM PCs with Redhat Linux - including
support...
I don't think it's time to sound the death knell of the evil empire yet,
but they *can't* like that news....
Doug
--
==============
Douglas K. O'Leary
Senior System Admin
dkoleary@wwa.com
doleary@ms.acxiom.com
==============
------------------------------
Date: Fri, 19 Feb 1999 19:02:24 -0600
From: "T.J. Weber" <tjw-pop@ipmedia.net>
Subject: Looking for two CGI Scripts
Message-Id: <36CE09A0.8AAF8C53@ipmedia.net>
Hi, I've been looking for two CGI scripts to do different tasks. I have
looked for them on cgi-resources.com and some various other search
engines, and I haven't had any luck.
THe first script I am looking for could also be a program. It is an FTP
Search/Spider combo. If you do searches on mp3site.com and the other
mp3 search engines you would know what I'm talking about. I want the
users on my system to be able to index their FTP sites and compile a
master list of all the publicly available files on my system. I guess
it works kinda like Archie would, but the user would be able to add
his/her FTP site at their own will. Then if someone wants to look for a
specific file in the database, they can do so by a web based search
engine. It would work exactly like mp3site.com, except it would search
locally (within several machines on my network) and it will index all
files. So I was wondering if something like this is available (and/or
how much it would cost).
The second script is a stock ticket and portfolio manager. Users can
create their own logins and their own stock portfolios, and have access
to them .... works just like all the big guys ... Yahoo! Finance, and
others. Would also be willing to pay a small fee for a script like
this.
If you have any of these scripts, or could point me in the right
direction, please shoot me an e-mail and/or post to the group!
Thanks,
--t.j. weber
--
T.J. Weber | James: "I hear that if you play the
Interplanetary Media | NT 4.0 CD backwards, you
phone: 847.205.5200 | get a Satanic message!"
fax: 847.205.5201 | Marc: "That's nothing. If you
e-mail: tjw@ipmedia.net | play it forward, it installs
web: http://www.ipmedia.net | NT 4.0!"
----------------------------------------------------------------------
He's not dead, he's / You have the right to remain
electroencephalographically / silent. Anything you say will
challenged. / be misquoted and used against you.
----------------------------------------------------------------------
------------------------------
Date: 19 Feb 1999 17:55:33 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: My, oh my!
Message-Id: <36ce0805@csnews>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, cory@techlounge.com writes:
:I keep having problems with my and use in my perl scripts.
:
:my ($a, $b, $c) = @_;
:use CGI qw (:standard);
:use CGI::Carp qw(fatalsToBrowser);
:
:Each of these lines gives me a syntax error. Why?
Because you're not using Perl? :-)
Those are just fine. You've probably got some dead, flea-bitten
camel carcass lying about rotting up your world.
--tom
--tom
--
agoraphobia (n) - fear of implementing or of being trapped in open systems
------------------------------
Date: 20 Feb 1999 02:32:21 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: perl compiled code cacheing
Message-Id: <7al6rl$d21$2@client2.news.psi.net>
Tom Christiansen (tchrist@mox.perl.com) wrote on MCMXCVIII September
MCMXCIII in <URL:news:36cdadec@csnews>:
|| [courtesy cc of this posting sent to cited author via email]
||
|| In comp.lang.perl.misc, samc@empirewest.com (Sam Curren) writes:
|| :If you save on tenth of a second on a script that is run 5,000 times in a
|| :day, you would save 8 minutes and 20 seconds of processor time.
||
|| Micro-optimizations are useless but dangerous hobgoblins that
|| haunt the deluded minds of uncounted programmers of small capability.
I wouldn't go that far. But if micro-optimizations are important to you,
you shouldn't be programming in Perl. C, a very good compiler, and the
knowledge when to use machine code instead of C is what you need.
Abigail
--
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))
------------------------------
Date: Wed, 17 Feb 1999 01:17:01 +0000
From: "shaven.monkey" <shaven.monkey@throw.me.the.banana.first>
Subject: perl ldap problem HELP please
Message-Id: <36CA188D.590B01F@throw.me.the.banana.first>
Can anybody see what's wrong with this piece of code?
I get the error message "bind error Invalid syntax" and can't figure out
why.
If an existing user already has an attribute rfc822Mailbox I can modify
the value,
but I can't add the attribute to a user.
Help!
thanks
########################################################
use Ldap;
$name="cn=manager";
$password="password";
@objectclass=("organizationalPerson", "person", "top");
#
# Connection to server
#
my $ldap=new Ldap( "localhost" );
#
# Binding to database
#
$ldap->bind_s ( $name, $password ) || die "Can't bind ", $ldap->error;
@objectclass=split(/,/, "rfc822-user,organizationalPerson,person,top");
$ldap->add_s( -dn=>'cn=willy,o=test,l=scotland,c=gb',
{'cn'=>'willy', objectclass=>[@objectclass]},
[ 'surname', 'go' ],
[ 'rfc822Mailbox', 'golly@fred.com']
);
print "bind error ", $ldap->error,"\n" unless ($ldap->success);
undef $ldap;
########################################################
------------------------------
Date: Fri, 19 Feb 1999 21:24:03 -0500
From: shawn raymond <shawn@sorcerysoftware.com>
Subject: Perl posts to newsgroups?
Message-Id: <36CE1CC3.F64FA77F@sorcerysoftware.com>
I know how to send mail thru Perl but can I send mail to newsgroups
What would the code be?
Shawn Raymond
------------------------------
Date: 19 Feb 1999 19:42:32 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl posts to newsgroups?
Message-Id: <36ce2118@csnews>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, shawn raymond <shawn@sorcerysoftware.com> writes:
:I know how to send mail thru Perl but can I send mail to newsgroups
:What would the code be?
Well, I happen to do this very thing every hour, but I'm wearing a
white hat. Are you?
--tom
--
It is, of course, written in Perl. Translation to C is left as an
exercise for the reader. :-) --Larry Wall in <7448@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: Sat, 20 Feb 1999 03:27:37 +0200
From: "manos" <mm93064@central.ntua.gr>
Subject: pipe problem
Message-Id: <7al3eb$akh$1@ulysses.noc.ntua.gr>
Hi there!
I came accross a strange problem when i tried to invoke a DOS application
through my script using a pipe:
Applicattion is executed normally but just before it finishes, i get the
message:
General failure reading from device LP:?
Retry,Abort or Fail?
--------------------------
When i press A or F everything goes find but thats unwanted of course..
Using Win32 Process does it ok BUT there is a certain reason that i must
avoid Win-Process from my code..
Please help.
------------------------------
Date: Fri, 19 Feb 1999 20:15:39 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Printing all environment variables
Message-Id: <alecler-1902992015390001@dialup-684.hip.cam.org>
In article <7akhs4$8ol$1@nnrp1.dejanews.com>, latsharj@my-dejanews.com wrote:
> In article <alecler-1902991249260001@dialup-654.hip.cam.org>,
> alecler@cam.org (Andre L.) wrote:
[...]
> > foreach (sort keys %ENV) {
[...]
>
> Or, to trim a few more chars :-)
>
> for (sort keys %ENV) {
I prefer to use foreach for foreach statements, and for for for statements.
Andre
Too bad I couldn't add another for for four fors.
------------------------------
Date: 19 Feb 1999 19:15:12 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: SRC: hrefsub - make substitutions in link fields of HTML files
Message-Id: <36ce1ab0@csnews>
#!/usr/bin/perl -w
# hrefsub - make substitutions in <A HREF="..."> fields of HTML files
# from Gisle Aas <gisle@aas.no>
sub usage { die "Usage: $0 <from> <to> <file>...\n" }
my $from = shift or usage;
my $to = shift or usage;
usage unless @ARGV;
# The HTML::Filter subclass to do the substitution.
package MyFilter;
require HTML::Filter;
@ISA=qw(HTML::Filter);
use HTML::Entities qw(encode_entities);
sub start {
my($self, $tag, $attr, $attrseq, $orig) = @_;
if ($tag eq 'a' && exists $attr->{href}) {
if ($attr->{href} =~ s/\Q$from/$to/g) {
# must reconstruct the start tag based on $tag and $attr.
# wish we instead were told the extent of the 'href' value
# in $orig.
my $tmp = "<$tag";
for (@$attrseq) {
my $encoded = encode_entities($attr->{$_});
$tmp .= qq( $_="$encoded ");
}
$tmp .= ">";
$self->output($tmp);
return;
}
}
$self->output($orig);
}
# Now use the class.
package main;
foreach (@ARGV) {
MyFilter->new->parse_file($_);
}
__END__
--
"I've decided I don't want to be a manager. Every time you try to be responsive to your employees, they
say you're being reactive and not proactive. And when you try to be proactive, they accuse you
of being capricious and arbitrary. So I don't wanna be a manager... " --Larry Wall
------------------------------
Date: 19 Feb 1999 17:14:37 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: SRC: igrep - grep recursively in include files
Message-Id: <36cdfe6d@csnews>
Ever wonder which include file something got defined in? Ever notice
how cpp'ing it and grepping doesn't work? Here's igrep, designed to
solve this problem. It's a very old piece of perl, way pre-perl5.
Example:
$ igrep 'define\s*NULL' /usr/src/perl5.005_02/perl.c
/usr/include/stdio.h from /usr/src/perl5.005_02/perlsdio.h from /usr/src/perl5.005_02/iperlsys.h from /usr/src/perl5.005_02/perl.h from /usr/src/perl5.005_02/perl.c: 58: #define NULL 0
/usr/include/locale.h from /usr/src/perl5.005_02/perl.h from /usr/src/perl5.005_02/perl.c: 64: #define NULL 0
/usr/include/sys/param.h from /usr/src/perl5.005_02/perl.h from /usr/src/perl5.005_02/perl.c: 52: #define NULL 0
/usr/include/stdlib.h from /usr/src/perl5.005_02/perl.h from /usr/src/perl5.005_02/perl.c: 76: #define NULL 0
/usr/include/stddef.h from /usr/src/perl5.005_02/perl.h from /usr/src/perl5.005_02/perl.c: 57: #define NULL 0
/usr/include/string.h from /usr/src/perl5.005_02/perl.h from /usr/src/perl5.005_02/perl.c: 49: #define NULL 0
/usr/include/time.h from /usr/src/perl5.005_02/perl.h from /usr/src/perl5.005_02/perl.c: 51: #define NULL 0
/usr/include/dirent.h from /usr/src/perl5.005_02/perl.h from /usr/src/perl5.005_02/perl.c: 85: #define NULL 0
/usr/src/perl5.005_02/handy.h from /usr/src/perl5.005_02/perl.h from /usr/src/perl5.005_02/perl.c: 15: # define NULL 0
/usr/src/perl5.005_02/handy.h from /usr/src/perl5.005_02/perl.h from /usr/src/perl5.005_02/perl.c: 17: # define NULL 0L
/usr/include/unistd.h from /usr/src/perl5.005_02/perl.c: 51: #define NULL 0 /* null pointer constant */
#!/usr/bin/perl
# igrep - grep recursively in include files
die "usage: $0 [-I path] pattern file ...\n" unless @ARGV > 1;
@ipath = ( '.', '/usr/include', '/sys/h');
while ($ARGV[0] =~ /^-I(.*)/) {
shift;
push(@ipath, $1 || shift);
}
$pattern = shift;
eval "/$pattern/"; # test her
die "$0: $@" if $@ =~ s/ at \(eval\).*//;
for (@ARGV) { &process($_); }
exit (!$ok);
sub process {
local($fname) = @_;
local(*FH);
return if $seen{$fname};
unless ($fname =~ m#^/# ? open(FH, $fname) : &iopen(FH, $fname)) {
warn "can't open $fname: $! called from "
. join(" from ", reverse @in) . "\n" if $DEBUG;
$seen{$fname}++; # sigh
return;
}
push(@in, $fname);
unless($seen{$fname}++) {
while (<FH>) {
#print "$fname: $.: $_" if /$pattern/o;
print join(" from ", reverse @in), ": $.: $_"
if /$pattern/o;
$ok++;
next unless /^\s*#\s*include\s*(["<])([^">]+)[">]/;
&process($2);
}
}
pop @in;
close(FH);
}
sub iopen {
local($fh, $path) = @_;
local($mypath) = $in[$#in]; # cpp extra inc path
$mypath = '' unless $mypath =~ s#/[^/]*$##;
for $dir ($mypath, @ipath) {
next if $dir eq '';
next unless open ($fh, "$dir/$path");
$_[1] = "$dir/$path"; # clobber caller ref for better msgs
return 1;
}
return 0;
}
--
Fungus doesn't take a vacation. --Rob Pike
------------------------------
Date: 19 Feb 1999 17:21:43 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: SRC: manpath - figure out implicit manpath
Message-Id: <36ce0017@csnews>
manpath figures out an implied manpath based on the ordering of your
binpath. It does not consult /etc/man.conf or anything like that.
host1$ manpath
/home/tchrist/man:/usr/local/devperl/man:/usr/local/man:/usr/man:/usr/X11R6/man
host2$ manpath
/usr/local/man:/usr/man:/usr/X11R6/man
host3$ manpath
/usr/local/man:/usr/man:/usr/openwin/man:/usr/local/gnu/man
This one was written in a style that's somewhat for obfuscatory value.
--tom
#!/usr/bin/perl
# manpath - figure out implicit manpath
for (split(/:/, $ENV{'PATH'})) {
next if /^\.?$/;
s![^/+]*$!man! && -d && !$seen{$_}++ && do {
($dev,$ino) = stat(_);
! $seen{$dev,$ino}++
} && push(@manpath,$_);
}
print join(":", @manpath), "\n";
--
It's a dark abyss or tunnel:
Strewn with stones, stowed, solace, gunwale,
------------------------------
Date: Sat, 20 Feb 1999 00:47:50 GMT
From: asssi@my-dejanews.com
Subject: Re: String Manipulation (yet another newbie question)
Message-Id: <7al0nj$l9o$1@nnrp1.dejanews.com>
>
> A regular expression match operator. Read perlop to learn how to write
> the match operators, and perlre to learn how to write the regular
> expressions that act as match patterns.
>
> Using regular expressions and match operators is one of the most
> fundamental things in Perl programming. It really pays to learn them as
> early as possible. It will probably take you several readings of the
> above documents to get comfortable with pattern matching, but the
> up-front effort will pay off handsomely.
>
I have no doubt that it would..
can you give me some references for finding relevant reading material online?
Thanks in advance
Asssi.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 4946
**************************************