[7846] in Perl-Users-Digest
Perl-Users Digest, Issue: 1471 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Dec 14 16:07:16 1997
Date: Sun, 14 Dec 97 13:00:28 -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 Sun, 14 Dec 1997 Volume: 8 Number: 1471
Today's topics:
Re: Another Sort problem, this time with numbers (John Moreno)
Changing a picture. <tufgar@golden.net>
Re: Changing a picture. (Tushar Samant)
Re: Changing a picture. (brian d foy)
Dynamically Sending an Adobe Acrobat PDF File to the Br <danvdw@microsoft.com>
Re: how can I fork a process from the Web.. <thestevens@kih.net>
Re: How to get everything in between <pre>....</pre> ta (Tad McClellan)
Re: is there anyway around this ssi problem with "query (brian d foy)
Re: mkdir command <rootbeer@teleport.com>
Re: Perl on Netware? (Jonathan Stowe)
Re: Perl support for the long long type (Lloyd Zusman)
Re: perl4 -> perl5 upgrade - problems with db <adavid@netinfo.com.au>
Re: perl4 -> perl5 upgrade - problems with db <adavid@netinfo.com.au>
Re: pgp encrypion via perl script (brian d foy)
Re: pgp encrypion via perl script (brian d foy)
Re: pgp encrypion via perl script nospam@minivend.com
Re: pgp encrypion via perl script (brian d foy)
Re: prevent download of images <rootbeer@teleport.com>
Re: Problem: My mailbot dropping lines (Tushar Samant)
Re: Problem: My mailbot dropping lines (brian d foy)
Rewinding a file back to the first line <e.phillips@mindspring.com>
Re: Rewinding a file back to the first line <uzs7ci@ibm.rhrz.uni-bonn.de>
Socket Connect <russ@eastland.net>
Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
Re: Teaching programing (Tushar Samant)
Re: xml lib (Bart Schuller)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 14 Dec 1997 13:40:15 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Another Sort problem, this time with numbers
Message-Id: <1d1963h.5qforn11vb425N@roxboro-180.interpath.net>
Martin Cohen <mcohen@netaxs.com> wrote:
I'll reply both to your message and a email message (actually it looks
like it might be a cc of news post, but who can tell?) in my reply.
> John Moreno wrote:
> >
> > fTiwason <tiwason@aol.com> wrote:
> >
> > > If i have a bunch of numbers to sort say
> > > 5,7,2,1,21,4,11,32
> > >
> > > is there anyway to get around them sorting like
> > >
> > > 1,11,2,21,32,4,5,7
> >
> > You know, I started to reply to this with a informative answer with a
> > bit of sample code, then I realized that it's in the manual, not even in
> > the faq but in the damn manual under the description of sort. If you've
> > learned how to use sort then you know how to do this. I'm not too
> > familiar with sort and thought you had probably tried the obvious and it
> > didn't work because perl was treating the elements as strings and they
> > just needed to be coerced into integers using int, but no that's not the
> > cause, you haven't read the manual on how to use sort at all. Look at
> > the manual and THEN you'll know how to do it. Hint: it's so
> > pathetically easy that you'll feel stupid for not knowing how to do it.
> >
>
> Seems like a pretty rough answer. If you sort numerically you get
> 1,2,4,5,7,11,21,32 not 1,11,2,21,32,4,5,7
> So I guess you have to sort using cmp, but that may not work if the
> strings are different lengths. Please show the code you were going to
> post.
You sir, need to pay attention. They ARE sorted like 1,11,2 (this is
sorts normal method of sorting) and he wants to sort them numerically,
i.e. 1,2,4...
tiwason@aol.com (Tiwason) said via email:
> Sorry of great one I did not mean to offend you..........
I thought I made it clear that *I* am not a great one - I thought you
deserved a decent response until I looked at the manual (which people
like Phoenix,Christiansen or Foy] wouldn't have had to do).
> Thats no way to answer a question, if your gonna be helpful be helpful if
> not shut up........
I was more helpful than such a question deserves, if I wasn't such a
nice guy I'd have given you precisely the answer such a question really
deserves - to be canceled.
> I have no idea what manual you are talking about
What manual do you think, the one for your car? The one for your
computer? No, you idiot the one for perl. [BTW that "idiot" is not
gratuitous or unwarranted, it went in after careful thought - what
manual indeed!].
> it was just a simple question that requires a simple answer...........
And the least effort on your part to look in the perl man pages to see
what and how sort does it thing would give you the answer. In the time
it took you to write the question you could have found the answer.
--
John Moreno
------------------------------
Date: Sun, 14 Dec 1997 12:28:57 -0500
From: The Tufgars <tufgar@golden.net>
Subject: Changing a picture.
Message-Id: <34941759.FCDA0822@golden.net>
Hi,
I've got a map and I'd like to be able to somehow move the boundries
of the countries around from user input is this possible with perl?
------------------------------
Date: 14 Dec 1997 13:42:58 -0600
From: scribble@tekka.wwa.com (Tushar Samant)
Subject: Re: Changing a picture.
Message-Id: <671cs2$i7a@tekka.wwa.com>
tufgar@golden.net writes:
>Hi,
> I've got a map and I'd like to be able to somehow move the boundries
>of the countries around from user input is this possible with perl?
Even when this is "just usenet" (and perhaps especially in this case!)
you should give a little more context.
Otherwise you will have Tom Phoenix responding: "This may or may not be
possible with Perl. If it is, perhaps searching for a module on CPAN will
help. If not, you are invited to contribute a module".
Hell, the post has probably originated and is on the wires as we speak.
So please reframe your question.
Hope this helps!
------------------------------
Date: Sun, 14 Dec 1997 15:09:34 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Changing a picture.
Message-Id: <671e0v$562@bgtnsc02.worldnet.att.net>
In article <34941759.FCDA0822@golden.net>, The Tufgars <tufgar@golden.net>
wrote:
> I've got a map and I'd like to be able to somehow move the boundries
> of the countries around from user input is this possible with perl?
perl could probably be used somewhere in that process, although perl
doesn't handle image manipulations inherently. if there is a module for
such a thing, you might find it on CPAN [1].
good luck :)
[1]
Comprehensive Perl Archive Network
find one near you at
<URL:http://www.perl.com>
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: Sun, 14 Dec 1997 12:44:54 -0800
From: "Daniel F. Van Der Werken, Jr." <danvdw@microsoft.com>
Subject: Dynamically Sending an Adobe Acrobat PDF File to the Browser using PERL in a CGI Script
Message-Id: <671ggc$l71@news.microsoft.com>
I need a CGI Perl script that dynamically sends a PDF file to the browser
for opening and reading with Adobe Acrobat Reader. By dynamic, I mean, NOT
<a href="mymostexcellent.pdf">PDF File</a>. I mean, a .PL file acts to open
and send binary PDF data to a browser as MIME-type "application/pdf" and
having the format that includes "%PDF-1." in the beginning of the data.
This should be easy but I'm finding it harder to do than I'd like, so I'm
asking you all. There are a few sites on the WWW that do this, but not
many. I only know of one that I can test with. The one example I do have
is an HTTPS site, so I can't sniff it and it does some other goofy stuff I
don't exactly like. I need a very simple one I can test on my own.
What I've done:
print "Content-type: application/pdf\n\n";
open(PDFFILE, "c:\\ntreskit\\perl\\samples.pdf");
binmode PDFFILE;
while(<PDFFILE>)
print $_;
}
close (PDFFILE);
What someone who's smarter than I am has done:
$filename="d:\MyFile.PDF";
print <<END_OF_HEADER
Content-Type: application/pdf
Content-Length: 50
END_OF_HEADER
;
# $buffer = "";
$fhandle = "\:\:$filename";
open($fhandle,$filename) || die "Couldn't open file";
binmode($fhandle);
chmod 0666,$filename;
while ($bytesread = sysread($filename,$buffer,1)) {
$totalbytes += $bytesread;
print $buffer;
}
close(INFILE);
So, I'd appreciate any suggestions. Thanks!
---Dan---
------------------------------
Date: 14 Dec 1997 20:42:32 GMT
From: "The Stevens" <thestevens@kih.net>
Subject: Re: how can I fork a process from the Web..
Message-Id: <01bd08d0$a18c7b00$67638ccf@thestevens>
I'm trying to something similar using Oracle's WebServer on NT. My script
works from the command line, but when it is submitted via the Web the
background process cranks and then dies immediately. Does fork() work
with Perl for Win32......I haven't been able to get it to.
Any help is greatly appreciated!
tstevens
brian d foy <comdog@computerdog.com> wrote in article
<66k14l$phj@bgtnsc01.worldnet.att.net>...
> In article <348D5335.C589EAF4@larc.nasa.gov>, Hazari Syed
> <h.syed@larc.nasa.gov> wrote:
>
>
> > I have written a perl cgi script that runs on the web.. I need to
fork
> > off a
> > process in the background when the user clicks a button.. The user then
> > can do
> > whatever he wants.. The process that is running in the background will
> > eventually
> > complete successfully. The cgi script does not need the status of this
> > completed
> > process. Can this be done..
>
> what happened when you tried using fork()?
>
> --
> brian d foy <http://computerdog.com>
> #!/usr/bin/perl
> $_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
> qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
> $pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
>
------------------------------
Date: Sun, 14 Dec 1997 10:14:41 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to get everything in between <pre>....</pre> tags in html
Message-Id: <hl0176.cs.ln@localhost>
[ no module stuff here. Trimmed both Newsgroups and Followup-To ]
Michael Budash (mbudash@sonic.net) wrote:
: In article <343E8927.26E1@nt.com>, Daniel Lortie <dlortie@nt.com> wrote:
: >>
: >> I have an HTML file that I read from the internet, but I want
: >> to parse the file I receive to only keep the text between the
: >> <pre> and </pre> tags. Is there a quick way to do this?
: >>
: If you've only got one such occuring pair of <pre>'s, this should do it:
That seems like an unrealistic expectation...
: open (FILENAME) or die("oops!"); # open the file (duh!)
: @lines = <FILENAME>; # get all the records at once
: close (FILENAME); # close the file
: $lines = join ('', @lines); # make one big scalar
That is an inefficient way to get an entire file into a string.
I would stick with the conventional idiom:
undef $/;
$lines = <FILENAME>; # slurp
: $lines = lc($lines); # make it lower case
He did not give us license to change the data that he wants to extract.
It he's trying to extract a code snippet (as they are often found in
<pre> tags), then you have just broken his code for him.
I would not recommmend that.
: $tokeep = $1 if ($lines =~/<pre>(.*)<\/pre>/); # find the pair and only
: save what's between 'em
That only works if the start and end tags are on the same line.
That seems like an unrealistic expectation...
: You get to keep any newlines...
I don't understand what you mean here as the regex above cannot match
any newlines...
: If there's more than one pair of <pre>'s, it' be harder, considering the
: possibilites of things like:
: <pre>Here's some pre-text
: and some more.</pre><hr><pre>Here's some more pre-text without starting
: a new line.
: Darn! That makes it harder...</pre>
That is no problem (if slurping the whole file is OK):
----------------------
#!/usr/bin/perl -w
undef $/;
$_ = <DATA>; # slurp
print "==>$1<==\n\n" while m#<pre>(.*?)</pre>#gsi;
__DATA__
<pre>Here's some pre-text
and some more.</pre><hr><pre>Here's some more pre-text without starting
a new line.
Darn! That makes it harder...</pre>
----------------------
Or, do it with a one liner:
perl -n0777e 'print "==>$1<==\n\n" while m#<pre>(.*?)</pre>#gsi' filename
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 14 Dec 1997 15:05:17 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: is there anyway around this ssi problem with "query_Strin
Message-Id: <671dov$562@bgtnsc02.worldnet.att.net>
[note follow-ups]
In article <Pine.OSF.3.96.971214002059.19911E-100000@alpha.furman.edu>,
Kevin Graham <kgraham@alpha.furman.edu> wrote:
> > i have an ssi
> > <!--#exec cmd="/home/user/go/html/cgi-bin/perl.pl?miscinfo"-->
> >
> > if i use QUERY_STRING in the perl script, the query after the ? is
> > ignored.
>
> Your problem is really simple.. First off, you'd need to use #exec
> cgi=.. #exec cmd is intended for shell-level commands, and isn't
> intended for CGI's. Unfortunately, even still, a SSI will not pass
> QUERY_STRING information (or PATH_INFO, for that matter).
this depends on your server. NCSA-like servers pass the QUERY_STRING
and PATH_INFO of the parent document.
the "#include virtual" directive can be used, so "#exec cgi" is not
necessary, although sufficient in some cases.
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: Sun, 14 Dec 1997 12:48:22 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Abigail <abigail@fnx.com>
Subject: Re: mkdir command
Message-Id: <Pine.GSO.3.96.971214124746.29505H-100000@user2.teleport.com>
On 14 Dec 1997, Abigail wrote:
> Perhaps -w should trigger a warning if someone uses a numerical literal
> with umask, mkdir or chmod that doesn't start with a 0.
Good idea. Gotta patch? :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 14 Dec 1997 19:36:31 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Perl on Netware?
Message-Id: <671cfv$lsa@neon.btinternet.com>
I have heard a rumour that there is a perl 5.* port for netware out there
but likewise know nothing. As far as I know the port is still at 4.036
Jonathan
------------------------------
Date: 14 Dec 1997 18:03:38 GMT
From: ljz@asfast.com (Lloyd Zusman)
Subject: Re: Perl support for the long long type
Message-Id: <slrn6987p1.i7.ljz@ljz.asfast.net>
On Thu, 11 Dec 1997 20:43:51 -0800, Tom Phoenix <rootbeer@teleport.com> wrote:
> On Thu, 11 Dec 1997, Vincent Joseph wrote:
> > The 5 byte integer that I wish to convert is actually Unix time in 100th
> > of a seconds. (By Unix time I mean the value returned by the time
> > function.)
>
> [ ... ]
>
> sub toSeconds {
> # Given a five-byte bitstring with an unsigned integer
> # value less than or equal to 429,496,729,599, returns that
> # value divided by 100, as a long unsigned integer
> [ ... remainder of algorithm deleted ... ]
> }
>
> Hope this helps!
Here's another one ... it's shorter and doesn't use multiplication:
sub toSeconds {
# Split the 5 bytes into a high-order 4-byte unsigned long
# and a low-order 1-byte unsigned char ...
my ($uchar, $ulong) = unpack('CL', shift);
# Get the quotient and remainder which result from dividing
# the high-order value by 100 ...
my $quotient = int($ulong / 100);
my $remainder = ($ulong % 100);
# To truncate the resultant seconds ...
return ( ($quotient << 8) +
int( (($remainder << 8) + $uchar) / 100 ) );
# To round the resultant seconds ...
#return ( ($quotient << 8) +
# int( (($remainder << 8) + $uchar + 50) / 100 ) );
}
The 8-bit shift of '$quotient' is guaranteed not to overflow a 4-byte
unsigned long as long as the 5-byte input is truly a value whose magnitude
cannot be larger than (2^32 - 1)*100, which would indeed be the case
if this truly is the number of hundredths of seconds since 1/1/1970.
'$remainder' is a value between 0 and 99, and hence, its 8-bit shift
couldn't possibly overflow a 4-byte unsigned long.
I'll email the mathematical proof for this algorithm, if you're
interested ... and I'll post this mathematical proof if any readers of
the newsgroup are interested.
Good luck!
--
Lloyd Zusman
ljz@asfast.com
------------------------------
Date: Mon, 15 Dec 1997 07:22:45 +1100
From: Anthony David <adavid@netinfo.com.au>
Subject: Re: perl4 -> perl5 upgrade - problems with db
Message-Id: <34944014.7AFD0023@netinfo.com.au>
Anthony David wrote:
> perldoc DBM
Whoops. ^^^^^make that perldoc AnyDBM_File
> --
> Anthony David | Opinions expressed ARE
> Anthony David & Associates | those of my employer
--
Anthony David | Opinions expressed ARE
Anthony David & Associates | those of my employer
------------------------------
Date: Mon, 15 Dec 1997 07:07:19 +1100
From: Anthony David <adavid@netinfo.com.au>
To: chr@mediascape.de
Subject: Re: perl4 -> perl5 upgrade - problems with db
Message-Id: <34943C77.B5123A1@netinfo.com.au>
Christian Bruegmann wrote:
> Hi
>
> I want to upgrade from perl4.018 to perl5.004.
>
> My Problem is that i have about 200 databases (dbm with .pag and .dir).
> My new Version of Perl seems to use an other type of databases - there
> is no .pag and .dir ending anymore. That will be ok - because the old
Could you please be more specific here. Do you have any examples?
> scripts will work - but i can't open the new type with my old "dbmopen
> (...)" - - where can i set the type of the used database ????
>
check out
perldoc -f tie
and
perldoc DBM
There are a number of different xDBM packages supported, they should all
use
.dir & .pag though.
--
Anthony David | Opinions expressed ARE
Anthony David & Associates | those of my employer
------------------------------
Date: Sun, 14 Dec 1997 14:52:29 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: pgp encrypion via perl script
Message-Id: <671d0v$35p@bgtnsc02.worldnet.att.net>
In article <mbudash-1412970413320001@d134.pm11.sonic.net>,
mbudash@sonic.net (Michael Budash) wrote:
> In article <66unui$rl6@bgtnsc02.worldnet.att.net>, comdog@computerdog.com
> (brian d foy) wrote:
>
> >> In article <mbudash-1312970304160001@d67.pm2.sonic.net>, mbudash@sonic.net
> >> (Michael Budash) wrote:
> >>
> >> > In article <34917ff8.17495498@news.scescape.net>, rgay@palmetto.net
wrote:
> >> >
> >> > >> Any ideas on this one...
> >> >
> >> > If I'm gathering your problem correctly, I just went thru the same thing
> >> > on an Irix server, and the answer was incredibly simple:
> >>
> >> > chdir "path_to_dir_containing_pgpe";
> >> > $encrypted_data = `(echo "$unencrypted_data") | pgpe -at -r
> >> > $recipient_email_address`;
> >>
> >> > Pretty simple, eh?
> >> you cannot store the plaintext on disk.
> ok, brian, i give up - what are you talking about? i'm _not_ storing the
> plaintext on disk....
i'm sory, i thought you were trying to get the data off disk and had
used echo by mistake. you didn't show anything that prepared the data
to be echo-ed (there are embedded characters that will give you
trouble), or any sanitizing of data being sent to the shell.
it seems like a long way to go to open a pipe to a process though,
which perl does inherently with open(). avoid backticks whenever
possible.
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: Sun, 14 Dec 1997 14:59:35 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: pgp encrypion via perl script
Message-Id: <671de9$562@bgtnsc02.worldnet.att.net>
In article <349402B2.265C@domain.com>, nospam@domain.com wrote:
[there's a missing attribution to me]
[note follow-ups]
> > you cannot store the plaintext on disk.
> 2. Storing unencrypted data to disk is not necessarily bad.
> Whether it's bad depends on how secure your disk is,
> or how secret the data actually is. Maybe we don't care
> if any other local users see it.
if you are using Unix, your disk is not secure. there is no
distinction between local and unauthorized users. which accounts
do you think crackers use while on your system ;)
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: 14 Dec 97 19:39:33 GMT
From: nospam@minivend.com
Subject: Re: pgp encrypion via perl script
Message-Id: <349435f5.0@news.one.net>
John Nolan <nospam@domain.com> wrote:
>> > In article <34917ff8.17495498@news.scescape.net>, rgay@palmetto.net wrote:
>> >
>> > >> Any ideas on this one...
>> >
>> > If I'm gathering your problem correctly, I just went thru the same thing
>> > on an Irix server, and the answer was incredibly simple:
>>
>> > chdir "path_to_dir_containing_pgpe";
>> > $encrypted_data = `(echo "$unencrypted_data") | pgpe -at -r
>> > $recipient_email_address`;
>>
>> > Pretty simple, eh?
>>
>> THIS IS NOT THE RIGHT WAY TO DO IT (yes i'm yelling).
>>
>> you cannot store the plaintext on disk.
>> you cannot store the plaintext on disk.
>> you cannot store the plaintext on disk.
> 1. This script does not necessarily store anything to disk.
> Is uses "echo", not "cat". $unencrypted_data is not a filename.
> It might prompt the user to enter data, and then echo it
> to pgp directly.
Thereby placing part of the unencrypted data in the process table for
anyone to see.
> 2. Storing unencrypted data to disk is not necessarily bad.
> Whether it's bad depends on how secure your disk is,
> or how secret the data actually is. Maybe we don't care
> if any other local users see it.
It's bad. It compromises the data completely, as when the file
is unlinked the data may stay around indefinitely for anyone to
see. If you are using the high security of PGP, it is a very
definite mismatch unless you are using the practice of putting
removable disks in a safe when finished. 8-)
> 3. This script does have one problem, and that is that the text
> of $encrypted_data may show up in a "ps" list on that machine.
> Again, whether this is bad depends on your machine, and how
> secure you need to be.
I consider it bad, because it can be compromised totally by accident
in normal operations.
Especially when it is so easy to fix:
open(PGP, "| pgpe -atr $recipient > /tmp/pgp_encrypted.$$")
or die "creat: $!\n";
print PGP $unencrypted_data;
close PGP;
die "PGP error" if $?;
Now only PGP encrypted data is stored to disk. Not nearly as unsecure,
though you would like to overwrite even that for best security.
I did come in late, so I suppse the question might have been
how to do this without creating a disk file. Well, without IPC::Open3
or the like you can't with PGP. Not portable. The above is
portable to most OSes.
On a UNIX system I would also redirect the error output for PGP,
as it is a bit nasty about sending random messages through stderr.
Regards,
Mike Heins http://www.minivend.com/ ___
Internet Robotics |_ _|____
"The U.S. Senate -- white 131 Willow Lane, Floor 2 | || _ \
male millionaires working Oxford, OH 45056 | || |_) |
for YOU!" -- Dave Barry <mikeh@minivend.com> |___| _ <
513.523.7621 FAX 7501 |_| \_\
------------------------------
Date: Sun, 14 Dec 1997 15:17:43 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: pgp encrypion via perl script
Message-Id: <671eg9$7om@bgtnsc02.worldnet.att.net>
In article <349435f5.0@news.one.net>, nospam@minivend.com wrote:
> Especially when it is so easy to fix:
>
> open(PGP, "| pgpe -atr $recipient > /tmp/pgp_encrypted.$$")
> or die "creat: $!\n";
> print PGP $unencrypted_data;
> close PGP;
> die "PGP error" if $?;
>
> Now only PGP encrypted data is stored to disk. Not nearly as unsecure,
> though you would like to overwrite even that for best security.
>
> I did come in late, so I suppse the question might have been
> how to do this without creating a disk file. Well, without IPC::Open3
> or the like you can't with PGP. Not portable. The above is
> portable to most OSes.
i'm a bit confused by that last statement. are you asserting that:
* the snippet you gave is portable to most OSes
*a) OSes == Unix
*b) OSes include the MacOS, for instance, which doesn't
know about > or |
* IPC::Open3 is portable
or something else?
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: Sun, 14 Dec 1997 12:36:02 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: psyclone@twd.net
Subject: Re: prevent download of images
Message-Id: <Pine.GSO.3.96.971214123446.29505F-100000@user2.teleport.com>
On Sat, 13 Dec 1997 psyclone@twd.net wrote:
> Is it possible to check the HTTP_REFERER variable and use 'expires' and
> 'pragma: no-cache' headers in a script to block browsers from saving and
> image on a web site (either in cache or storing to disk)?
If it's possible at all, there's nothing Perl-specific about it. You could
try looking in the CGI docs and FAQs, and the ones about servers and
browsers. If you don't find your answer there, you could ask in a
newsgroup about CGI, browsers, or servers. Thanks!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 14 Dec 1997 12:59:31 -0600
From: scribble@tekka.wwa.com (Tushar Samant)
Subject: Re: Problem: My mailbot dropping lines
Message-Id: <671aaj$eda@tekka.wwa.com>
greycloak@greycloak.access.one.net writes:
>When sending the file requested, it drops lines. Here's the script.
Get rid of that "$_ = <IN>".
>-------------cut---------------
>while (<IN>) {
> $_ = <IN>;
------------------------------
Date: Sun, 14 Dec 1997 14:32:34 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Problem: My mailbot dropping lines
Message-Id: <671brj$p3m@bgtnsc02.worldnet.att.net>
In article <slrn696os2.nc.greycloak@greycloak.access.one.net>,
greycloak@greycloak.access.one.net (Grey Cloak) wrote:
> I trying to create a mailbot. Since I lost my old one during an upgrade.
> Not having the address toget it, I decided to write my own. I am hitting
> a little snag.
> open (IN, "-");
> while (<IN>) {
> $_ = <IN>;
perhaps you wanted
while( $_ = <IN> )
otherwise you are reading a line in the while condition, then
immediately reading the next line thus losing the previous one.
good luck :)
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: Sat, 13 Dec 1997 12:00:51 -0800
From: "Eric Phillips" <e.phillips@mindspring.com>
Subject: Rewinding a file back to the first line
Message-Id: <6713ck$fr1@camel18.mindspring.com>
Hello, I have a script that will check a login and a password. The problem
is, when I try to log in via a form, the script only accepts the login and
password on the last line of the file?
How do I take the "$_", or the current line that the script is reading, back
to the very first line and character of the file?
Thanks, and let me know!
--
Eric Phillips
e.phillips@mindspring.com
------------------------------
Date: 14 Dec 1997 20:17:18 +0100
From: Oliver Much <uzs7ci@ibm.rhrz.uni-bonn.de>
Subject: Re: Rewinding a file back to the first line
Message-Id: <671bbu$pjc@walras.econ.de>
Eric Phillips <e.phillips@mindspring.com> wrote:
EP>Hello, I have a script that will check a login and a password. The problem
EP>is, when I try to log in via a form, the script only accepts the login and
EP>password on the last line of the file?
EP>How do I take the "$_", or the current line that the script is reading, back
EP>to the very first line and character of the file?
a) close and reopen the password-file.
or
b) read the file in an array and use only the array for verifying the
login-data.
--
---
Oliver Much|@home: UZS7CI@ibm.rhrz.uni-bonn.de | Sei P ein Punkt Q wir
|@work: oliverm@addi.finasto.uni-bonn.de| wollen ihn Z nennen.
------------------------------
Date: Sun, 14 Dec 1997 11:05:23 -0600
From: "Russ" <russ@eastland.net>
Subject: Socket Connect
Message-Id: <6713g8$oe4$1@news1.iamerica.net>
Hello,
I was trying to figure out if a socket was open on another machine. We
have a chat program running on port 3335 on more than one machine. Was
wanting to try to use the connect to see if it was up and running. I'm
having problems getting the examples I have seen on opening a socket. If
you know how to do this or can point me in the right direction I would
greatly appreciate it. I'm using perl and Linux 2.0.32. I would like to
create a program that will monitor different ports on our machines ftp,
http, 3335 and such.
Russ Verner
russ@eastland.net
------------------------------
Date: 14 Dec 1997 20:09:53 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <671eeh$o3$1@info.uah.edu>
Following is a summary of articles spanning a 7 day period,
beginning at 06 Dec 1997 10:23:42 GMT and ending at
12 Dec 1997 22:03:40 GMT.
Notes
=====
- A line in the body of a post is considered to be original if it
does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
- All text after the last cut line (/^-- $/) in the body is
considered to be the author's signature.
- The scanner prefers the Reply-To: header over the From: header
in determining the "real" e-mail address and name.
- Original Content Rating is the ratio of the original content volume
to the total body volume.
- Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
Excluded Posters
================
perlfaq-suggestions@mox.perl.com
Totals
======
Total number of posters: 315
Total number of articles: 698 (308 with cutlined signatures)
Total number of threads: 317
Total volume generated: 1215.3 kb
- headers: 485.5 kb (9,738 lines)
- bodies: 669.1 kb (21,458 lines)
- original: 492.1 kb (16,420 lines)
- signatures: 58.8 kb (1,211 lines)
Original Content Rating: 0.7356
Averages
========
Number of posts per poster: 2.22
median: 1 post
mode: 1 post - 218 posters
s: 5.17 posts
Number of posts per thread: 2.20
median: 2 posts
mode: 1 post - 147 threads
s: 1.53 posts
Message size: 1782.8 bytes
- header: 712.2 bytes (14.0 lines)
- body: 981.5 bytes (30.7 lines)
- original: 722.0 bytes (23.5 lines)
- signature: 86.3 bytes (1.7 lines)
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
74 123.2 ( 61.3/ 46.2/ 29.4) Tom Phoenix <rootbeer@teleport.com>
33 52.3 ( 23.4/ 23.6/ 11.5) Jeremy D. Zawodny <jzawodn@wcnet.org>
30 45.1 ( 21.4/ 17.4/ 9.7) brian d foy <comdog@computerdog.com>
24 43.7 ( 16.7/ 21.9/ 15.3) Martien Verbruggen <mgjv@comdyn.com.au>
15 19.0 ( 8.6/ 10.4/ 5.0) Tushar Samant <scribble@tekka.wwa.com>
12 14.0 ( 8.0/ 5.7/ 3.5) Zenin <zenin@best.com>
11 20.5 ( 5.7/ 13.2/ 11.3) Greg Bacon <gbacon@cs.uah.edu>
11 21.8 ( 7.8/ 14.0/ 8.4) "Mark S. Reibert" <reibert@mystech.com>
10 24.9 ( 8.0/ 15.2/ 13.2) Tom Christiansen <tchrist@mox.perl.com>
8 11.0 ( 6.2/ 4.8/ 3.1) bowlin@sirius.com
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
123.2 ( 61.3/ 46.2/ 29.4) 74 Tom Phoenix <rootbeer@teleport.com>
73.6 ( 0.6/ 73.0/ 72.5) 1 Matthew H. Gerlach <gerlach@netcom.com>
52.3 ( 23.4/ 23.6/ 11.5) 33 Jeremy D. Zawodny <jzawodn@wcnet.org>
45.1 ( 21.4/ 17.4/ 9.7) 30 brian d foy <comdog@computerdog.com>
43.7 ( 16.7/ 21.9/ 15.3) 24 Martien Verbruggen <mgjv@comdyn.com.au>
24.9 ( 8.0/ 15.2/ 13.2) 10 Tom Christiansen <tchrist@mox.perl.com>
21.8 ( 7.8/ 14.0/ 8.4) 11 "Mark S. Reibert" <reibert@mystech.com>
20.5 ( 5.7/ 13.2/ 11.3) 11 Greg Bacon <gbacon@cs.uah.edu>
19.9 ( 1.1/ 18.8/ 18.8) 2 Atif Ahmad Khan <aak2@Ra.MsState.Edu>
19.0 ( 8.6/ 10.4/ 5.0) 15 Tushar Samant <scribble@tekka.wwa.com>
Top 10 Posters by OCR (minimum of five posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
------ -------------- ----- -------
0.9797 4.2 / 4.3 7 Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh" <bsa@void.apk.net>
0.8671 13.2 / 15.2 10 Tom Christiansen <tchrist@mox.perl.com>
0.8572 11.3 / 13.2 11 Greg Bacon <gbacon@cs.uah.edu>
0.6992 15.3 / 21.9 24 Martien Verbruggen <mgjv@comdyn.com.au>
0.6690 5.1 / 7.7 8 Randal Schwartz <merlyn@stonehenge.com>
0.6393 3.1 / 4.8 8 bowlin@sirius.com
0.6363 29.4 / 46.2 74 Tom Phoenix <rootbeer@teleport.com>
0.6114 3.5 / 5.7 12 Zenin <zenin@best.com>
0.6050 3.6 / 5.9 7 Bart Lateur <bart.mediamind@tornado.be>
0.5993 8.4 / 14.0 11 "Mark S. Reibert" <reibert@mystech.com>
Bottom 10 Posters by OCR (minimum of five posts)
=================================================
(kb) (kb)
OCR orig / body Posts Address
------ -------------- ----- -------
0.5993 8.4 / 14.0 11 "Mark S. Reibert" <reibert@mystech.com>
0.5942 5.2 / 8.8 6 Mike Stok <mike@stok.co.uk>
0.5579 9.7 / 17.4 30 brian d foy <comdog@computerdog.com>
0.5381 4.2 / 7.9 7 "Creede Lambard" <fearless@io.com>
0.5136 1.9 / 3.7 5 nospam@domain.com
0.4898 1.7 / 3.5 6 Clay Irving <clay@panix.com>
0.4876 11.5 / 23.6 33 Jeremy D. Zawodny <jzawodn@wcnet.org>
0.4827 5.0 / 10.4 15 Tushar Samant <scribble@tekka.wwa.com>
0.3823 2.0 / 5.1 7 M.J.T. Guy <mjtg@cus.cam.ac.uk>
0.2561 1.5 / 5.8 8 Nathan Stanford <nathan@cyberservices.com>
Top 10 Threads by Number of Posts
=================================
Posts Subject
----- -------
9 the skinny on my() vs local() - thanks to all
8 a certain bug...!!!
7 newbie: compact an array
7 just starting with perl
7 pattern matching
7 Inserting only the unique elements into an array ...
6 formmail - IE works, netscape doesn't
6 Wildcards
6 Pls that run as root
6 Recommended PERL-book?
Top 10 Threads by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Subject
-------------------------- ----- -------
75.9 ( 1.2/ 74.7/ 74.2) 2 Reading from a modem in Perl/Linux
28.2 ( 3.8/ 24.0/ 22.2) 6 Simple/small socket script doesn't work
16.3 ( 7.4/ 7.6/ 4.0) 9 the skinny on my() vs local() - thanks to all
15.1 ( 4.0/ 10.6/ 4.6) 5 MS IE 3.03 File Uploading
12.6 ( 5.8/ 6.2/ 2.8) 7 Inserting only the unique elements into an array ...
12.4 ( 2.5/ 9.3/ 8.5) 4 Statistics for comp.lang.perl.misc
12.4 ( 4.7/ 7.2/ 4.8) 7 just starting with perl
12.1 ( 6.0/ 5.1/ 2.9) 8 a certain bug...!!!
10.8 ( 4.2/ 5.9/ 4.4) 6 formmail - IE works, netscape doesn't
10.7 ( 5.2/ 5.4/ 3.4) 5 Which language pays most 17457 -- C++ vs. Java?
Top 10 Targets for Crossposts
=============================
Articles Newsgroup
-------- ---------
12 comp.lang.perl.modules
9 comp.lang.perl
6 comp.infosystems.www.servers.unix
5 comp.lang.fortran
5 comp.lang.eiffel
5 comp.edu
5 misc.jobs.misc
5 comp.lang.c++
5 comp.lang.c
5 comp.lang.smalltalk
Top 10 Crossposters
===================
Articles Address
-------- -------
10 tholen@ifa.hawaii.edu
10 "John W. Sublett" <john@tridium.com>
10 Mix <mixmaster@remail.obscura.com>
10 mcv@wxs.nl
9 Ken Lee <kenton@rahul.net->
4 Kristina Kolesnikov <kika@megsinet.net>
4 Nick Djurovich <etlndh@etlxdmx.ericsson.se>
4 djr@newcoast.com
4 Fabrizio Pivari <pivari@geocities.com>
3 Marc Slemko <marcs@znep.com>
------------------------------
Date: 14 Dec 1997 13:12:07 -0600
From: scribble@tekka.wwa.com (Tushar Samant)
Subject: Re: Teaching programing
Message-Id: <671b27$ffm@tekka.wwa.com>
merlyn@stonehenge.com writes:
>paper before that, and hacked my HP-41C a bit. (I'm probably dating
>myself here... but if I don't, who will? :-)
Dang! So Perl doesn't get you dates either!
Foiled again!
------------------------------
Date: 14 Dec 1997 18:18:01 GMT
From: schuller+news@lunatech.com (Bart Schuller)
Subject: Re: xml lib
Message-Id: <882123480.336851@perla.rotterdam.luna.net>
In article <66fc32$s3@panix.com>, Clay Irving <clay@panix.com> wrote:
>In <881527587.16932@dejanews.com> chuck@yahoo-inc.com writes:
>
>>Has anyone written an XML module that parses an xml doc
>
>Nope, but Adam Turoff is working on something:
>
> Subject: Perl and XML
> Date: Tue, 02 Dec 97 15:06:00 PST
> From: Adam Turoff <AdamT@smginc.com>
> To: "'modules@perl.org'" <modules@perl.org>
>
> I'm currently investigating the usefulness of XML with Perl.
> Looking at the current list of modules and categories, I
> can't seem to find any XML-specific modules or categories
> in development, so I would like to propose an XML:: namespace
> with at least an XML::Parser class.
XML is SGML, for appropriate values of "is". You can use the existing
SGML-SPGrove modules to parse XML just fine.
See $CPAN/modules/by-module/SGML/
Note (and this might be the catch) that this modules interfaces with the
SP library, which is written in C++.
--
Bart Schuller schuller+sig@lunatech.com At Lunalabs, where the
Lunatech Research http://www.lunatech.com/ future is made today..
Partner of The Perl Institute http://www.perl.org/ Linux http://www.li.org/
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.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 1471
**************************************