[14033] in Perl-Users-Digest
Perl-Users Digest, Issue: 1443 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 20 12:12:10 1999
Date: Sat, 20 Nov 1999 09:06:39 -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: <943117599-v9-i1443@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 20 Nov 1999 Volume: 9 Number: 1443
Today's topics:
Re: alias a mailer <gellyfish@gellyfish.com>
Re: alias a mailer (Kragen Sitaker)
Re: Can i prevent the user from viewing the source HTML (Bobo)
Re: Can i prevent the user from viewing the source HTML <klayto@gmx.net>
Re: Can Perl return the ASCII code for a given characte (Abigail)
Re: Can Perl return the ASCII code for a given characte (Kragen Sitaker)
Date and Files <martin@mert.globalnet.co.uk>
Re: Date and Files <jaimedp@pacbell.net>
Re: Date and Files <martin@mert.globalnet.co.uk>
Re: Date and Files <jaimedp@pacbell.net>
Re: Date and Files (Kragen Sitaker)
Re: DBI questions (memory, signals) <gellyfish@gellyfish.com>
Re: Do you now an affordable Perl editor for Windows NT <gellyfish@gellyfish.com>
Re: Encryption Algorithm for Perl Source Code?? jut@letterbox.com
Re: Encryption Algorithm for Perl Source Code?? <kbandes@home.com>
Re: environment vars <gellyfish@gellyfish.com>
Re: file descriptors already used when perl starts lee.lindley@bigfoot.com
Re: file empty? (Abigail)
Re: file empty? <flavell@mail.cern.ch>
Re: file empty? (Matthew Bafford)
Fix for PerlShop Transmission Error perlshop_user@my-deja.com
Re: Getting HTML tags via regular expression (Abigail)
Re: Getting HTML tags via regular expression <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 20 Nov 1999 11:30:50 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: alias a mailer
Message-Id: <8160pa$78c$1@gellyfish.btinternet.com>
On Fri, 19 Nov 1999 22:01:49 GMT Fox wrote:
> hi all:
> i got a problem....
> in my /etc/aliases
> i definded :
>
> aaa:|/www/fox/test.pl
>
> in /www.fox/test.pl i wrote:
>
> #!/usr/bin/perl
> open (ifile,">>test");
> $time=localtime();
> print ifile "$time\n";
> print ifile "mail is comming\n";
> close (ifile);
>
> and i send a mail to aaa,the server returned:
>
> sh: /www/fox/test.pl: Text file busy
> 554 |/www/fox/test.pl... unknown mailer error 126
>
Yes I got the same message when I tested your code - however you will
notice something about the message as I had sensibly put in some
check on whether the open succeeded :
The original message was received at Sat, 20 Nov 1999 11:19:00 GMT
from gellyfish@localhost
----- The following addresses had permanent fatal errors -----
"|/home/gellyfish/clpmtest/mailthing.pl"
(expanded from: fook)
----- Transcript of session follows -----
Cant open test to open - Permission denied
554 "|/home/gellyfish/clpmtest/mailthing.pl"... unknown mailer error 13
So the moral of the story is that you should *always* check the success
of an open :
open (IFILE,'>>test') || die "Cant open test - $!\n";
Almost certainly your problem is that you are trying to create a file in
a directory that the user that the MTA runs the script as doesnt have
permission to do so - you should specify a path to a location in the
first instance that is world writeable like /tmp. You should also
check that the program file is executable by a possibly unknown user
try 755 in the first instance. The "Text file busy" is a wierd one
because that is usually a sign that you are trying to overwrite the text
of a running program - I think that it is probably a spurious message
caused by whatever return your program has when it tries to write to
an unopened filehandle.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 20 Nov 1999 17:02:56 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: alias a mailer
Message-Id: <4vAZ3.30834$YI2.1484696@typ11.nn.bcandid.com>
In article <38376aee.997048@news.bentium.com>, Fox <hry@163.net> wrote:
>On 20 Nov 1999 02:29:41 GMT, mgjv@wobbie.heliotrope.home (Martien
>Verbruggen) wrote:
>>On Fri, 19 Nov 1999 22:01:49 GMT,
>> Fox <hry@163.net> wrote:
>>> hi all:
>>> i got a problem....
>>> in my /etc/aliases
>>> i definded :
>>>
>>> aaa:|/www/fox/test.pl
>>>
>>> in /www.fox/test.pl i wrote:
>>
>>That's not the same thing.
>then ,how can i do that ?
Well, either change the aliases to say /www.fox/test.pl or change the
filename to be /www/fox/test.pl.
>>-w, and use strict are considered to be good things.
>
>i can run it in shell ,and no errors ....
>so i don't think -W is useful.
You are mistaken.
>>That's an error from your MTA, not from perl
>where to change to slove this error?
"slove"?
>>What happens if you execute the script, feeding it an email message on
>>stdin? Have you even tried?
>i want to process some mail infomation .
So what happens if you execute the script by hand, feeding it an email
message on stdin?
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 20 Nov 1999 11:21:15 GMT
From: bobo@bobo.com (Bobo)
Subject: Re: Can i prevent the user from viewing the source HTML code by using PERL script ??
Message-Id: <81607b$t8c6@imsp212.netvigator.com>
How does it work ??
I save the following code as test.pl
````````````````````````````````````````````````````````
#!/usr/bin/perl
print "Content-type: text/html\n\n";
$_ = "\x3C\x3C\x45\x4F\x54";
print if s/<<EOT/<<EOT/e;
Just another Perl Hacker
EOT
````````````````````````````````````````````````````````
But, it does not work !!
Please help !
In article <slrn83cpdm.m2v.abigail@alexandra.delanet.com>, abigail@delanet.com
says...
>
>Bobo (bobo@bobo.com) wrote on MMCCLXXI September MCMXCIII in
><URL:news:8146qn$l0k9@imsp212.netvigator.com>:
>??
>?? Can i prevent the user from viewing the source HTML code by using PERL
script
>??
>
>
>Easy. I've hidden the solution in this article.
>Just do it the same way in your document.
>
>
>
>Abigail
>--
>$_ = "\x3C\x3C\x45\x4F\x54";
>print if s/<<EOT/<<EOT/e;
>Just another Perl Hacker
>EOT
>
>
> -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
> http://www.newsfeeds.com The Largest Usenet Servers in the World!
>------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers
==-----
------------------------------
Date: Sat, 20 Nov 1999 13:03:44 +0100
From: Klay To <klayto@gmx.net>
Subject: Re: Can i prevent the user from viewing the source HTML code by using PERL script ??
Message-Id: <01HW.B45C4CB000110858056E3B7C@news.bcandid.deja.com>
On Sat, 20 Nov 1999 7:55:53 +0100, Bobo wrote:
> Can u speak more about how does the script can work ?
> More, '/usr/local/apache/conf/httpd.conf' is what file ?
Sure man!
If the httpd.conf does not work 4 u, then u should consider replacing
the lines
> open(CONF,$conf_file) || die "Cant open $conf_file - $!\n";
>
> my @docdirs;
>
> while(<CONF>)
> {
> push @docdirs, $1 if /^DocumentRoot\s+(.+)/;
> }
with
my @docdirs[0] = $ENV{'DOCUMENT_ROOT'};
or if that failz as well, use
my @docdirs[0] = 'path_2_yer_home_directory';
U can be sure that n0 0ne will B able 2 C any cool HTML source code on
your pagez anymore.
WARNING: There's no undo function implemented yet. But real hackers
like U have no need for them anyway, eh?
Klayto
------------------------------
Date: 20 Nov 1999 05:34:25 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Can Perl return the ASCII code for a given character?
Message-Id: <slrn83d208.m2v.abigail@alexandra.delanet.com>
David Cannon (look@signature.com) wrote on MMCCLXXI September MCMXCIII in
<URL:news:JF4Z3.27392$YI2.1239476@typ11.nn.bcandid.com>:
;; I need a Perl equivalent to Visual Basic's ASC() function. I need Perl to
;; return the ASCII code for a given character. Is there a way?
Yeah. It's mightly complicated though.
#!/opt/perl/bin/perl -w
use strict;
use constant I => 1 << 1;
use constant II => 1 << 2;
use constant III => 1 << 3;
use constant IV => 1 << 4;
use constant V => 1 << 5;
use constant VI => 1 << 6;
use constant VII => 1 << 7;
use constant VIII => sub {die "Blake only had seven.\n"};
sub is_vowel {$_ [0] =~ /[euio]/ || $_ [0] eq 'a'}
sub is_digit {@_ || return &is_digit ($_); local $^W = !$_ [0];
$_ [0] eq '0' || $_ [0] * (V + 5);} # 42 - 5. (Magic)
sub is_crypto {local $" = qq qq; # Makes it faster.
eval "/[@{[map {sprintf '\x%02x' => $_} 0 .. V - 1]}]/"}
my $puncto = sub {my $p = shift; $p =~ s/[\\']/\\$&/;
[$p => eval "\x6F\x72\x64 '$p'"]};
sub ascii;
sub ascii {
local $_ = shift;
die "That ain't no ascii character!\n" if $_ gt "\x7F" or 1 < length;
my $val = 0;
if (is_digit) {
$val = V + IV;
$val ++ while $_ -- && is_digit;
}
if (/[xyz]/) {
$val = (/[xyz]/?1:0) + (/[yz]/?1:0) + (/[z]/?1:0) + ascii 'w';
}
if (is_vowel $_) {
$val ||= VI + V + 1 if "papa" =~ /$_/;
$val ||= VI + V - 1 + IV if "aorta" =~ /$_/;
$val ||= VI + V + 5 + IV if "doofuz" =~ /$_/;
$val ||= VI + V + 5 if "appel" =~ /$_/;
$val ||= VI + V + 9 if "is_vowel" =~ /$_/;
}
$val = V if $_ eq $";
if (/[fw]/) {
my $dingy = 6;
$dingy ++ unless /f/;
$val = hex ($dingy x 2);
}
if (/[the quick brown fox jumps over the lazy dog]/) {
local $_ = "$_";
$val ||= -1 + ascii ++ $_;
}
$val ||= V ^ ascii lc if /[^\W_]/;
if (is_crypto) { # Special characters used to encrypt messages.
die "Cannot do that in international forum\n";
}
# Else it's a puncto thingy.
$val || $puncto -> ($_) -> [1];
}
__END__
You would assume Perl would make it easier, but as you saw in the
manual, there isn't a function doing the work for you.
Abigail
--
perl -wlne '}for($.){print' file # Count the number of lines.
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sat, 20 Nov 1999 16:43:33 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Can Perl return the ASCII code for a given character?
Message-Id: <VcAZ3.30633$YI2.1475170@typ11.nn.bcandid.com>
In article <JF4Z3.27392$YI2.1239476@typ11.nn.bcandid.com>,
David Cannon <look@signature.com> wrote:
>I need a Perl equivalent to Visual Basic's ASC() function. I need Perl to
>return the ASCII code for a given character. Is there a way?
Several people suggested ord(); you might also be interested in unpack
"C", which has the nifty unpack "C*" variation which does this to a
whole string at once.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Sat, 20 Nov 1999 15:47:45 -0000
From: "Martin Elliott" <martin@mert.globalnet.co.uk>
Subject: Date and Files
Message-Id: <816g1t$ms4$1@gxsn.com>
I need to expand a script that writes the contents of a form to a flat file,
so that at the end of each day it is written to another file, say, one for
the month, and then at the end of the month, the month file is either
blanked or written to a 'last month' file.
How would I go about doing this? I've looked at localtime() but am not sure
how to use it properly :-(
Thanks for your help,
Martin
------------------------------
Date: Sat, 20 Nov 1999 07:57:40 -0800
From: Jaime Perez <jaimedp@pacbell.net>
Subject: Re: Date and Files
Message-Id: <3836C4F4.35AC6E7@pacbell.net>
What have you written so far?
-Jaime
Martin Elliott wrote:
> I need to expand a script that writes the contents of a form to a flat file,
> so that at the end of each day it is written to another file, say, one for
> the month, and then at the end of the month, the month file is either
> blanked or written to a 'last month' file.
>
> How would I go about doing this? I've looked at localtime() but am not sure
> how to use it properly :-(
>
> Thanks for your help,
>
> Martin
------------------------------
Date: Sat, 20 Nov 1999 16:06:31 -0000
From: "Martin Elliott" <martin@mert.globalnet.co.uk>
Subject: Re: Date and Files
Message-Id: <816h52$d97$1@gxsn.com>
Jaime Perez <jaimedp@pacbell.net> wrote in message
news:3836C4F4.35AC6E7@pacbell.net...
> What have you written so far?
I haven't been able to use any date or time functions yet, but the script
writes all form data to a flat file 'today', and I just want to move it to
'month' at the end of each day.
------------------------------
Date: Sat, 20 Nov 1999 08:23:47 -0800
From: Jaime Perez <jaimedp@pacbell.net>
Subject: Re: Date and Files
Message-Id: <3836CB13.FBED35F@pacbell.net>
Have you ever used the Date module?
-Jaime
Martin Elliott wrote:
> Jaime Perez <jaimedp@pacbell.net> wrote in message
> news:3836C4F4.35AC6E7@pacbell.net...
> > What have you written so far?
>
> I haven't been able to use any date or time functions yet, but the script
> writes all form data to a flat file 'today', and I just want to move it to
> 'month' at the end of each day.
------------------------------
Date: Sat, 20 Nov 1999 16:36:41 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Date and Files
Message-Id: <t6AZ3.30581$YI2.1480758@typ11.nn.bcandid.com>
In article <816h52$d97$1@gxsn.com>,
Martin Elliott <martin@mert.globalnet.co.uk> wrote:
>
>news:3836C4F4.35AC6E7@pacbell.net...
>> What have you written so far?
>
>I haven't been able to use any date or time functions yet, but the script
>writes all form data to a flat file 'today', and I just want to move it to
>'month' at the end of each day.
perldoc -f time
perldoc -f localtime
HTH.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 20 Nov 1999 16:52:14 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: DBI questions (memory, signals)
Message-Id: <816jju$7ob$1@gellyfish.btinternet.com>
On Fri, 19 Nov 1999 19:54:29 GMT Jon Drukman wrote:
> Jani Lahti wrote:
>>> When I open a DBI connecion to Oracle, my script grows by 3MB. I
>>> understand it's because some more script data is being utilized and
>>> buffers reserved. It's just that I think 3MB is a bit too much.
>
> On Fri, 19 Nov 1999 16:51:46
> -0700, Ron Reidy <rereidy@uswest.net> wrote:
>>The size of the script grows not because of some added data structs used by
>>DBI/DBD, but because of the inclussion of the Oracle libraries. This would
>>happen regardless of language used (i.e. Perl, C/C++, php3, etc.).
>
>
> Ron is absolutely correct. If you're worried about multiple copies of
> your script snarfing memory, you have two choices:
>
<snip the er *three choices*>
Also bear in mind that if you have the database server running on the
same machine then you are likely to have some bastarding great processes
already - e.g. on a Solaris machine at work I have Informix running where
there may be 8 21MB processes (and thats only because I selected to have
that few.)
You only need to start worrying if the running process is using more than
the available real memory (and IME MySQL is truly bad at this) whilst it
builds a cursor for a large recordset - in these cases you might need to
think again about your query.
For more on the database stuff you might want to ask in the appropriate
comp.databases.* newsgroup.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 20 Nov 1999 10:58:53 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Do you now an affordable Perl editor for Windows NT
Message-Id: <815utd$74q$1@gellyfish.btinternet.com>
On 20 Nov 1999 04:20:22 GMT Steve McKay wrote:
> samhobbs@mindspring.com (Sam Hobbs) wrote in
> <7vfqe8$nl9$1@nntp4.atl.mindspring.net>:
>
> I love Textpad (http://www.textpad.com/). It has proven to be a very
> flexible and extensible text editor. It includes color coding, custom tools
> (like perl -cw or just perl -w), libraries (with *many* free contributed
> libraries), totally configurable...
>
> Best $40 I ever spent.
>
If your favourite editor is not listed on the Perl editopr reference at
<http://www.perl.com/reference/query.cgi?editors> then perhaps you should
contact the maintainer of that page - if everyone did that then perhaps
there would be no excuse for threads like this which has after all been
going on for nearly two months now.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 20 Nov 1999 14:51:35 GMT
From: jut@letterbox.com
Subject: Re: Encryption Algorithm for Perl Source Code??
Message-Id: <3836b4aa.774251@news.singnet.com.sg>
Thank you so much for your reply. You may be on to something here. But
even if the code IS obfuscated, what can I do to make it "plain-text".
And yet a hunch tells me there's more to it than meets the eye. I
can't help but notice the function unpack which appears TWICE in the
plain-text code (pls refer to my first post).
Sorry to be such a pain, but I'm really curious because this is really
my first experience with workable gibberish code. :)
On Sat, 20 Nov 1999 04:43:15 GMT, Kenneth Bandes <kbandes@home.com>
wrote:
>mason@voodoo.net wrote:
>> On 19 Nov 1999 22:56:03 -0000, Jonathan Stowe
>> <gellyfish@gellyfish.com> wrote:
>>
>> >On Fri, 19 Nov 1999 03:14:39 GMT jut@letterbox.com wrote:
>> >> Hello, I recently downloaded this script. I can't say where but when I
>> >> was deconstructing it to see how it did it's stuff and to learn,
>> >> imagine my horror when I saw a whole load of gibberish!!!
>> >>
>> >
>> >Of course thee file has been archived and packed somehow. You will
>> >have to tell us what the extension of the file was to be sure - but
>> >usually files are tarred and gzipped .
>
>> I don't think so because
>>
>> a) It came as a with a .cgi extension
>> b) When I placed it into my cgi-bin it ran as per normal
>> c) The first line of it starts with #!/usr/bin/Perl/ or whatever
>
>I recently saw something like this in a Perl program distributed
>with some software we got at work. At first, it appeared to be
>all ASCII 1s and 0s. On closer inspection, it turned that all the
>variable names had been modified to various strings of 0s, 1s, and
>(letter) ls. Mixed in were standard Perl operators, a few file
>names, etc.
>
>In other words, it wasn't actually encrypted, just obfuscated. I'd
>guess that's what you've got too.
>
>Ken Bandes
------------------------------
Date: Sat, 20 Nov 1999 16:06:24 GMT
From: Kenneth Bandes <kbandes@home.com>
Subject: Re: Encryption Algorithm for Perl Source Code??
Message-Id: <3836C726.DF413D09@home.com>
jut@letterbox.com wrote:
> On Sat, 20 Nov 1999 04:43:15 GMT, Kenneth Bandes <kbandes@home.com>
> wrote:
> >> >On Fri, 19 Nov 1999 03:14:39 GMT jut@letterbox.com wrote:
> >> >> Hello, I recently downloaded this script. I can't say where but when I
> >> >> was deconstructing it to see how it did it's stuff and to learn,
> >> >> imagine my horror when I saw a whole load of gibberish!!!
> >I recently saw something like this in a Perl program distributed
> >with some software we got at work. At first, it appeared to be
> >all ASCII 1s and 0s. On closer inspection, it turned that all the
> >variable names had been modified to various strings of 0s, 1s, and
> >(letter) ls. Mixed in were standard Perl operators, a few file
> >names, etc.
> >
> >In other words, it wasn't actually encrypted, just obfuscated. I'd
> >guess that's what you've got too.
>
> Thank you so much for your reply. You may be on to something here. But
> even if the code IS obfuscated, what can I do to make it "plain-text".
> And yet a hunch tells me there's more to it than meets the eye. I
> can't help but notice the function unpack which appears TWICE in the
> plain-text code (pls refer to my first post).
There's no mechanical way to do this. A program has human readers
and mechanical readers. The mechanical reader, i.e., the compiler,
doesn't care whether the program is nicely formatted or has
meaningful variable and function names; these things only matter
to human readers. Therefore you can take a program, lose the
formatting, and rename all the variables to (humanly) meaningless
names without in any way affecting the compiler's ability to
parse it. Restoring human meaning to such a text is a tedious
exercise in software hermeneutics, which requires you interpret the
code and rename variables to names that reflect what you judge to
be their purpose.
I doubt it's worthwhile. My guess is you could spend countless hours
on this only to discover, as is overwhelmingly likely, that the
program is utter garbage. If you want to learn how to write CGI
in Perl, you could do worse than the documentation for CGI.pm, or
the book "The Official Guide to Programming with CGI.pm", by Lincoln
Stein (who wrote CGI.pm).
By the way, I don't attach any special importance to the presence
of pack. Perl keywords will need to appear in their original
form. Only programmer-assigned names would be changed (although
there are tricks one could do with eval, overloading, etc.).
Ken Bandes
------------------------------
Date: 20 Nov 1999 11:56:38 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: environment vars
Message-Id: <81629m$78q$1@gellyfish.btinternet.com>
On Fri, 19 Nov 1999 23:27:03 -0500 Chris Collins wrote:
>
> I'm catching alot of flak for asking an innocent question.
> Maybe I'll just write all my code in ADA from now on
>
I didnt think it was *you* that was copping any flak in this thread.
BTW was it the $ENV{LD_LIBRARY_PATH} thing ?
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 20 Nov 1999 14:03:26 GMT
From: lee.lindley@bigfoot.com
Subject: Re: file descriptors already used when perl starts
Message-Id: <8169ne$3jg$1@rguxd.viasystems.com>
Uri Guttman <uri@sysarch.com> wrote:
[snip]
:>a telnet or getty can open the pseudo or real tty in itself and fork a
:>child which closes fd 0, 1 and 2, dups to them the fd pointing to the
:>device and then closes those high fds. then exec is called to run login
:>or the shell which will keep 0, 1 and 2 open since they have the
:>FD_CLOEXEC flag set by the dup. the flag is set on fds 0, 1 and 2 is
:>inherited by all children of the shell which don't close them and open
:>new ones (as they woould for pipes and redirections).
Under Solaris I see file descriptors 4, 5 and 6 left open whether
I execute from an xterm or from a telnet session. I can't rule
out much from that -- it could still be a shell doing it. But
it seems likely that there is some shared tty driver code involved
somewhere that is opening the device files, duping them to 0,1 and 2,
then failing to close them before exec.
Hmm. Let me try executing this thing from "at".
execve("/usr/lib/lprgs/perl", 0xFFBEF954, 0xFFBEF960) argc = 2
open("/dev/zero", O_RDONLY) = 3
mmap(0x00000000, 8192, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xFF3A0000
open("/usr/dt/lib/libsocket.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/openwin/lib/libsocket.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/local/rg/lib/libsocket.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libsocket.so.1", O_RDONLY) = 4
[snip]
OK. With no tty involved 4,5 and 6 are not tied up. This seems
to support the guess that there is some tty driver code under
Solaris that is not closing those file descriptors like it should.
This is also supported by an observation I made earlier where
I poked around and found that fd=5 was reading from the keyboard.
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: 20 Nov 1999 07:49:38 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: file empty?
Message-Id: <slrn83d9ts.m2v.abigail@alexandra.delanet.com>
Chris (chris@chrismail.connectfree.co.uk) wrote on MMCCLXXI September
MCMXCIII in <URL:news:3835b653.0@news2.cluster1.telinco.net>:
``
`` How do you find out if a .fil file is empty???
Turn it upside down and shake it. If bits and bytes fall out, it wasn't
empty.
Abigail
--
$" = "/"; split $, => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sat, 20 Nov 1999 15:34:33 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: file empty?
Message-Id: <Pine.HPP.3.95a.991120153402.26446I-100000@hpplus01.cern.ch>
On 20 Nov 1999, Abigail wrote:
> `` How do you find out if a .fil file is empty???
>
> Turn it upside down and shake it. If bits and bytes fall out, it wasn't
> empty.
Ah, but will it be empty afterwards?
------------------------------
Date: Sat, 20 Nov 1999 17:00:11 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: file empty?
Message-Id: <slrn83dk3c.ui.*@dragons.duesouth.net>
On Sat, 20 Nov 1999 15:34:33 +0100, Alan J. Flavell"
<flavell@mail.cern.ch> held some poor sysadmin at gunpoint, and typed
the following into comp.lang.perl.misc:
: On 20 Nov 1999, Abigail wrote:
: > [some non abigail wrote:]
: > `` How do you find out if a .fil file is empty???
: >
: > Turn it upside down and shake it. If bits and bytes fall out, it wasn't
: > empty.
:
: Ah, but will it be empty afterwards?
Once no more bits and bytes fall out, yes.
--Matthew
------------------------------
Date: Sat, 20 Nov 1999 14:30:36 GMT
From: perlshop_user@my-deja.com
Subject: Fix for PerlShop Transmission Error
Message-Id: <816bad$grd$1@nnrp1.deja.com>
PerlShop has an old bug that is exposed by the
latest release of Perl. It
just hit me when my ISP upgraded, but fortunately
I found the problem. I
don't follow these newsgroups, but I see now that
others have suffered too.
The problem is in the ReadParse subroutine, a
small routine the extracts the
passed form parameters and puts them into the
$input{} array. I don't know
how it ever worked the way it is, but this the
fix:
Change these lines:
$in{$key} .= '\0' if (defined($in{$key})); # \0
is the multiple separator
$in{$key} .= $val;
To:
$input{$key} .= '\0' if (defined($in{$key})); #
\0 is the multiple separator
$input{$key} .= $val;
That's all there is to it. Well, at least it
worked for me. I have been
using PerlShop for three years on an active web
site. I have modified it a
lot to suite my needs.
I hope this helps.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 20 Nov 1999 08:22:33 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Getting HTML tags via regular expression
Message-Id: <slrn83dbri.m2v.abigail@alexandra.delanet.com>
Jonathan Stowe (gellyfish@gellyfish.com) wrote on MMCCLXXI September
MCMXCIII in <URL:news:814nec$6ji$1@gellyfish.btinternet.com>:
{} On Fri, 19 Nov 1999 22:11:11 GMT davidairth@my-deja.com wrote:
{} > I am trying to parse HTML files and get a list of all of the tags,
{} > pretty simple. I am using regular expressions and just about have it,
{} > but I am still getting:
{} >
{} > "<b> blah blah </b> and this too" <---matches to the end of a line
{} >
{} > I want just a list of all the open and close tags:
{} >
{} > <b> <---match 1
{} > </b> <---match 2
{} > <TR>
{} > <TD>
{} > </TD>
{} > </TR>
{} >
{} > basically, the parsing doesn't stop when it hits the second > tag:
{} >
{} > I am trying: </?b.+>
{} >
{} > Any ideas?
{} >
{}
{} Yes use HTML::Parser - I have posted a veritable shedload of examples in
{} the last few weeks.
Even this rather simple thing, extracting "tags" from HTML is a task
HTML::Parser isn't capable of. Because it has no idea what HTML is.
It will get most pages that use javascript to generate markup wrong.
Which isn't uncommon at all.
<SCRIPT>
document.write ("<BR>");
</SCRIPT>
will trigger 2 calls to "start", one call to "end", and 2 calls to
"text", while a real HTML tokenizer would see 3 tokens: the SCRIPT
begin tag, a CDATA section (for which there isn't a call back at all
in HTML::Parser), and the end tag for SCRIPT.
An HTML parser would return something resembling a tree, with 2 nodes.
A top node "SCRIPT", and a leaf node CDATA, including its content.
You can with some degree of success do your own bookkeeping, and gather
calls to 'start', 'end', 'declaration', 'comment' and 'text' after seeing
a being "SCRIPT" and not seeing an end "SCRIPT" (and the same with other
elements having CDATA declared content). But I doubt HTML::Parser does
anything useful on:
<SCRIPT>
<!--
</SCRIPT>
50k of HTML document, without a -->
<SCRIPT>
// -->
</SCRIPT>
which is a perfectly fine document. But HTML::Parser wouldn't do much
useful with it.
After all, and I'm getting tired to repeat this, HTML::Parser doesn't
parse, nor does it have a clue about HTML.
Too bad there isn't any review for names for CPAN modules.
HTML is an SGML application. Parsing SGML is far from trivial. Attempts
to use regexes and HTML::Parser on documents you don't know much about
are hilarious, and will cause more pain than being useful. Only if you
know the document is limited enough, there can be some benefit in giving
it to HTML::Parser. But then, you might as well use what you know about
the document, and use some special purpose regexes or substr/index combos.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 20 Nov 1999 15:51:13 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Getting HTML tags via regular expression
Message-Id: <816g1h$7nr$1@gellyfish.btinternet.com>
On 20 Nov 1999 08:22:33 -0600 Abigail wrote:
> Jonathan Stowe (gellyfish@gellyfish.com) wrote on MMCCLXXI September
> MCMXCIII in <URL:news:814nec$6ji$1@gellyfish.btinternet.com>:
> {} On Fri, 19 Nov 1999 22:11:11 GMT davidairth@my-deja.com wrote:
> {} > I am trying to parse HTML files and get a list of all of the tags,
> {} > pretty simple. I am using regular expressions and just about have it,
> {} > but I am still getting:
> {} >
> {} > "<b> blah blah </b> and this too" <---matches to the end of a line
> {} >
> {} > I want just a list of all the open and close tags:
> {} >
> {} > <b> <---match 1
> {} > </b> <---match 2
> {} > <TR>
> {} > <TD>
> {} > </TD>
> {} > </TR>
> {} >
> {} > basically, the parsing doesn't stop when it hits the second > tag:
> {} >
> {} > I am trying: </?b.+>
> {} >
> {} > Any ideas?
> {} >
> {}
> {} Yes use HTML::Parser - I have posted a veritable shedload of examples in
> {} the last few weeks.
>
> Even this rather simple thing, extracting "tags" from HTML is a task
> HTML::Parser isn't capable of. Because it has no idea what HTML is.
>
> It will get most pages that use javascript to generate markup wrong.
> Which isn't uncommon at all.
>
<snip>
>
> After all, and I'm getting tired to repeat this, HTML::Parser doesn't
> parse, nor does it have a clue about HTML.
>
>
> Too bad there isn't any review for names for CPAN modules.
>
>
> HTML is an SGML application. Parsing SGML is far from trivial. Attempts
> to use regexes and HTML::Parser on documents you don't know much about
> are hilarious, and will cause more pain than being useful. Only if you
> know the document is limited enough, there can be some benefit in giving
> it to HTML::Parser. But then, you might as well use what you know about
> the document, and use some special purpose regexes or substr/index combos.
>
Fine. Do you then suggest that for every querent who comes here with a
similar request we:
A) Tell them to learn about SGML, understand the relevant DTD and then
build their own parser.
B) Tell them to use an external SGML parser with reference to the
appropriate DTD.
C) Tell them to go away because Perl isnt capable of such a thing.
D) Go through the usual eternal iterative process of helping them
decompose their HTML using a regex or other language feature.
Bearing in mind that for nearly every request of this type we get here the
document *is* of a fairly predictable nature.
But yes I do agree with you about the CDATA, and yes in nearly every place
that I have used HTML::Parser I have resorted to some book-keeping scheme.
Anyhow how many of these people will actually see CDATA chunks in the wild -
and if they do care about what it contains ? If they do and do then I am
fairly certain also that they will be savvy to the issues and wouldnt be
asking these types of questions (then they would'nt be one of these people
of course DOH!).
However, given that most of the querents do have relatively simple needs
and given that they most likely dont have the wherewithal to go for options
A or B above, C is untrue and we arent going to want to do D then for
all intents and purposes HTML::Parser is the best option. Sure it doesnt
necessarily do what it says on the tin - but unless one of us is going to
make something better then most sensible usenauts are going to recommend it.
I will be sure to include some caveat next time I recommend it.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 1443
**************************************