[18408] in Perl-Users-Digest
Perl-Users Digest, Issue: 576 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 27 18:06:16 2001
Date: Tue, 27 Mar 2001 15:05:20 -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: <985734319-v10-i576@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 27 Mar 2001 Volume: 10 Number: 576
Today's topics:
Re: acceccing files on localhost ? <bart.lateur@skynet.be>
Better way to Flushing STDOUT? <donotreply@interbulletin.bogus>
CGI Newsreader? (Blaine Bauer)
Re: CGI Newsreader? (J.B. Moreno)
check prototype error <ptanner@sw.stratus.com>
Re: check prototype error <bart.lateur@skynet.be>
Checking for two end line symbols with regex <djusha@infotel.kg>
E euro sign how to <sjaaknabuurs@hetnet.nl>
editing function output before assignment to a variable <kirsch@kodak.com>
Re: editing function output before assignment to a vari (Greg Bacon)
Re: find2pl and NFS on solaris 8 <ddunham@redwood.taos.com>
Re: Help determining ShockwaveFlash h & w? <user@host.com>
Help with External Programs <acline@okstateREMOVECAPS.edu>
Re: Hmmm... Which PERL Book Is Best Suited For This??? <idontreadthis56@hotmail.com>
Re: LWP help <mail@ericmarques.net>
Re: More Help please :-) <comdog@panix.com>
Re: Packing/Unpacking C doubles in Perl (John McNamara)
Password: logfile <Jan-Willem@Oudendal.com>
Re: Password: logfile (Abigail)
Re: Perl public key encryption <chris@cake.clara.net>
Read a scalar as a file? <user@host.com>
Re: Read a scalar as a file? (Abigail)
Re: Read a scalar as a file? (John McNamara)
Re: regexp exception confusion <user@host.com>
score-based search engines? <user@host.com>
Re: score-based search engines? <dan@tuatha.sidhe.org>
Serverside + Detect Browser Plugin <jtjohnston@courrier.usherb.ca>
Re: Serverside + Detect Browser Plugin <david23@panix.com>
service pack information <e.quesada@verizon.net>
Re: staying at the bottom on an html page (Abigail)
Re: staying at the bottom on an html page (Gwyn Judd)
Re: staying at the bottom on an html page <kstep@pepsdesign.com>
Re: Using Sunfreeware's perl in place of Sun's perl <"ken"@$spam$wellconnected.com>
Re: Using Sunfreeware's perl in place of Sun's perl <"ken"@$spam$wellconnected.com>
Re: Using Sunfreeware's perl in place of Sun's perl <rra@stanford.edu>
Re: Wierd new response to old CGI script <ruhl@realrates.com>
Re: Wierd new response to old CGI script (Randal L. Schwartz)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 27 Mar 2001 20:59:24 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: acceccing files on localhost ?
Message-Id: <s0v1ctojoojavj5djndl1q366penktn27d@4ax.com>
kellyboy wrote:
>thats is the question...can I access file on the machine in spite of what
>directory are configured in the 'Alias' directive of 'httpd.conf'
I don't fully understand your problem. Note that a browser works using
URL's, so if you want to emit a HTML page using a CGI script containing
a link to an image, that link must be a valid URL for the file. But you
won't be able to stop people from accessing a file through other means.
But if you want a CGI script that locally reads an image file and sends
it to the browser, then your script must use the filesystem conventions
for identifying the file, and your script (or rather, the user it is
running under) must have read access to that directory and that file.
The file needn't be accessible through an URL. But basically, this one
script can't do much else than just sending this one file.
If the latter is what you intend to do, then you might feel like
browsing Randal Schwartz' Web Techniques columns. They're available
online, there's a bunch of them already, and quite a few pull stunts
like this, but lots more as well.
<http://www.stonehenge.com/merlyn/WebTechniques/>
For example: columns 17 and 21.
--
Bart.
------------------------------
Date: Tue, 27 Mar 2001 20:24:28 +0000
From: Hon-Chi Ng <donotreply@interbulletin.bogus>
Subject: Better way to Flushing STDOUT?
Message-Id: <3AC0F6FC.48D60A15@interbulletin.com>
Hi
I would like to flush any buffered output in STDOUT at a given point in my
Perl script, is
$old_autoflush = $|; $| = 1; print ""; $| = $old_autoflush;
the only way?
What about
close STDOUT;
? Will it flush STDOUT? What happens when I send output to STDOUT after it?
As explained in "perldoc perlvar", Perl will typically line buffer STDOUT if
output is to the terminal. But, I would also like to be able redirect
output to STDOUT to file in command-line using Unix redirection for logging
purpose, and use "tail -f" to check the output.
I prefer not to turn $| on permanently, since it is unnecessary, and I'm not
using STDOUT directly.
To clarify my objective, here is the portion of my Perl script.
if ( $output_file ) {
open OUT_FH, ">$output_file"
or die "Can't open output file '$output_file': $!!";
$out_fh = \*OUT_FH;
}
else {
$out_fh = \*STDOUT;
}
print $out_fh " ... "
print $out_fh " ... "
print $out_fh " ... "
if ( $out_fh == \*STDOUT ) {
# TODO: Flush STDOUT. Will close STDOUT; work?
# Or must it be $old_autoflush = $|; $| = 1; print "";
# $| = $old_autoflush;
}
else {
close $out_fh;
}
# May send additional output to STDOUT
print " ... "
Thanks. I appreciate your help.
Regards
Hon-Chi
_______________________________________________
Submitted via WebNewsReader of http://www.interbulletin.com
------------------------------
Date: Tue, 27 Mar 2001 19:09:20 GMT
From: bbauer@h14me.yi.org (Blaine Bauer)
Subject: CGI Newsreader?
Message-Id: <Az5w6.107853$W05.20730743@news1.rdc1.mi.home.com>
Does anyone know of a CGI-based newsreader? I'd like to get able to get
something through a proxy.
Thanks,
Blaine
------------------------------
Date: Tue, 27 Mar 2001 15:37:02 -0500
From: planb@newsreaders.com (J.B. Moreno)
Subject: Re: CGI Newsreader?
Message-Id: <1eqxpyk.400g1e9e1d9pN%planb@newsreaders.com>
Blaine Bauer <bbauer@h14me.yi.org> wrote:
> Does anyone know of a CGI-based newsreader? I'd like to get able to get
> something through a proxy.
Not sure exactly what you are looking for, but I'd suggest looking
around <http://www.newsreaders.com> and/or posting more info to
news.software.readers.
--
JBM
"Your depression will be added to my own" -- Marvin of Borg
------------------------------
Date: Tue, 27 Mar 2001 14:02:14 -0500
From: "Philip Tanner" <ptanner@sw.stratus.com>
Subject: check prototype error
Message-Id: <99qo34$79m$1@transfer.stratus.com>
I recently upgraded my site from perl 5.003.03 to 5.6. I just got mail from
one of our developers saying he's seeing the following errors with the new
version:
main::foo() called too early to check prototype at foo1 line 235
Is this a problem with the way I compiled perl (all the tests ran fine after
the build), or is it a bug in his script?
Thanks for any help,
Phil Tanner
Philip_Tanner@stratus.com
------------------------------
Date: Tue, 27 Mar 2001 19:35:27 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: check prototype error
Message-Id: <0fq1ctgvr7qnii9gbp94qs8tnekeevirqm@4ax.com>
Philip Tanner wrote:
>I recently upgraded my site from perl 5.003.03 to 5.6. I just got mail from
>one of our developers saying he's seeing the following errors with the new
>version:
>
> main::foo() called too early to check prototype at foo1 line 235
>
>Is this a problem with the way I compiled perl (all the tests ran fine after
>the build), or is it a bug in his script?
It's a matter of ordering the source code. Apparently code containing a
function call comes before the definition of the sub. Witness this in
action:
foo('Bart');
sub foo ($) {
print "Hi there $_[0]!\n";
}
-->
main::foo() called too early to check prototype at test.pl line
2.
Hi there Bart!
See? Either you don't use the prototypes, if you don't need them; you
move the sub definition more upfront; you define it in a module that you
load; or you add a prototype. The trick is to let perl know about the
prototype before the function call gets even compiled.
So these will do:
A: # function prototype in front of call
sub foo ($);
foo('Bart');
sub foo ($) {
print "Hi there $_[0]!\n";
}
B: # sub definition in front of call
sub foo ($) {
print "Hi there $_[0]!\n";
}
foo('Bart');
--
Bart.
------------------------------
Date: Wed, 28 Mar 2001 04:07:51 +0600
From: "Andrej Kartashov" <djusha@infotel.kg>
Subject: Checking for two end line symbols with regex
Message-Id: <99r2k1$4t2$1@alpha.elcat.kg>
Hello,
Please help me, how I check that $category should not contain more than three end line
symbols
Like
$category !~ /[\\n]{3,};
Thank you,
Andrej
------------------------------
Date: Tue, 27 Mar 2001 23:06:23 +0200
From: "sjaak nabuurs" <sjaaknabuurs@hetnet.nl>
Subject: E euro sign how to
Message-Id: <u4zUaEwtAHA.284@net005s.hetnet.nl>
This is a multi-part message in MIME format.
------=_NextPart_000_00C1_01C0B712.8B30CF20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi=20
How to program the E euro (money sign)
Thanks
--=20
Sjaak Nabuurs
Visit www.CityTower.com and create your own citytower
and become the centre of internet in your city.
------=_NextPart_000_00C1_01C0B712.8B30CF20
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi </FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D3>How to program the E euro (money =
sign)</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><BR>-- <BR><BR>Sjaak =
Nabuurs</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Visit <A=20
href=3D"http://www.CityTower.com">www.CityTower.com</A> and create your =
own=20
citytower<BR>and become the centre of internet in your=20
city.<BR></FONT></DIV></BODY></HTML>
------=_NextPart_000_00C1_01C0B712.8B30CF20--
------------------------------
Date: Tue, 27 Mar 2001 16:17:36 -0500
From: Mathew Kirsch <kirsch@kodak.com>
Subject: editing function output before assignment to a variable
Message-Id: <3AC1036F.BF45008F@kodak.com>
I've been racking documentation for a solution to this, but apparently I don't
know how to describe it well enough for a search to find what I want.
I want to combine these two lines:
$dom = strftime("%d", localtime(parsedate("yesterday")));
$dom =~ s/^0//;
into one operation. That is, take the output of strftime(), remove a leading
zero if it exists, and assign it to the variable $dom. The way I'm doing it
works, but it looks klugey.
Perl has always been more clever and elegant than that. The solution is
probably simple and right in front of me, but I can't find it.
------------------------------
Date: Tue, 27 Mar 2001 21:53:18 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: editing function output before assignment to a variable
Message-Id: <tc22ue222ip5a7@corp.supernews.com>
In article <3AC1036F.BF45008F@kodak.com>,
Mathew Kirsch <kirsch@kodak.com> wrote:
: I want to combine these two lines:
:
: $dom = strftime("%d", localtime(parsedate("yesterday")));
: $dom =~ s/^0//;
:
: into one operation. [...]
( $dom = strftime("%d", localtime(parsedate("yesterday"))) ) =~ s/^0//;
Hope this helps,
Greg
--
Thousands of geniuses live and die undiscovered--either by themselves or
by others.
-- Mark Twain
------------------------------
Date: Tue, 27 Mar 2001 19:48:48 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: find2pl and NFS on solaris 8
Message-Id: <A86w6.113$U93.39857@news.pacbell.net>
John W. Krahn <krahnj@acm.org> wrote:
> Chris Fedde wrote:
>>
>> Has anyone found a portable way to test if a filesystem is on NFS?
>> Find2perl seems to think that -fstype NFS is the same as (dev < 0)
>> but that does not appear to be true for Solaris 8 at least.
> I don't know how portable this is:
> @nfs = grep { /type nfs/ and $_ = (split " ")[2] } `mount`;
It's not. For solaris you could pretty reliably read field 3 of
'/usr/sbin/mount -p' or the second field of '/etc/mnttab'.
But then you have to work that back to a mountpoint which takes more
work. If you're reading the '/etc/mnttab' file, that also gives you a
'dev=' bit. You can match that to the 'device' portion of stat.
I've thought about working up something like that, but it would only
work on Solaris 2.x. Trying to do something similar in a portable way
would be much more difficult.
--
Darren Dunham ddunham@taos.com
Unix System Administrator Taos - The SysAdmin Company
Got some Dr Pepper? San Francisco, CA bay area
< How are you gentlemen!! Take off every '.SIG'!! >
------------------------------
Date: Thu, 22 Mar 2001 18:41:01 -0600
From: xris <user@host.com>
Subject: Re: Help determining ShockwaveFlash h & w?
Message-Id: <user-85027F.18410122032001@newsrump.sjc.telocity.net>
In article <28djbtot22s40jjjuhnjivecj9nbmbsioh@4ax.com>,
Bart Lateur <bart.lateur@skynet.be> wrote:
> I'd say: tough luck. The above combination is lethal. People just
> mustn't expect fully professional results in a crippled environment.
the point is that the users themselves can change their images without
knowing a THING about html, ftp, etc (most don't, and don't want to).
> So don't use height and width for flash files, and the browser will
> display it properly, maybe after some hickups.
my problem is that the browser *doesn't*... I'm using Mac IE 5 and it
loads flash files as tall/wide as it possibly can.
> <http://2shortplanks.com/flash/>
found this, but it seemed only to have code for creating files, not for
manipulating ones that are already made.
> <http://www.sabren.net/code/flashperl/>
thanks, checking this one out.
------------------------------
Date: Tue, 27 Mar 2001 14:34:07 -0600
From: Aaron Cline <acline@okstateREMOVECAPS.edu>
Subject: Help with External Programs
Message-Id: <cM6w6.290$Rx.3340@news.onenet.net>
Hello:
I am trying to run wvdial from within a perl script. I am able to run it
fine from with the script, but I can't get it to detach and run in the
background so that the script will continue. I have tried using backticks
and the sytem command. Can anyone tell me the command that will make it
detach?
Thanks
Aaron Cline
------------------------------
Date: Fri, 23 Mar 2001 09:56:57 -0600
From: Keep it to Usenet please <idontreadthis56@hotmail.com>
Subject: Re: Hmmm... Which PERL Book Is Best Suited For This???
Message-Id: <idontreadthis56-1E34C8.09565623032001@newsrump.sjc.telocity.net>
In article <3abb627d.87528499@news.earthlink.net>,
bogus@erol.com (---Pete---) wrote:
> I'm looking for a reference book that is instructional as well as
> extensively indexed such that I can pickup a sample Perl script and
> quiclky find topics or functions like sysread(), or even simple
> things like "$!" that I find in the sample Perl code. This PERL
> book should also written with the CGI in mind
Unfortunately, I can't recommend one book.
For the general Perl "stuff" I'd recommend the O'Reilly
_Programmin_in_Perl_ book. It is NOT a good "read the book cover to
cover to learn Perl", but it is a great "Dig around in the index to
find what I need" book. Actually, it is one of the best programming
books in the latter category I've used.
For the CGI "stuff" I'd go with the O'Reilly
_CGI_Programming_with_Perl_ book. This one you can read from cover to
cover, in order to learn what's going on. I did find one typo in the
"File Uploads with CGI.pm" section. The example had:
my $file = $q->param("file");
my $fh = $q->upload($file);
The $file in upload() should have been the HTML form field name (e.g.
"file") and not the value of that field. That's an example of my only
real negative comment about the book -- the choice of variable names
can be confusing. That section should really have been something like:
my $origfilename = $q->param("file");
my $tmpfilehandle = $q->upload("file");
There's also the Stein "Official" CGI.pm book. This one was
surprisingly disappointing. It might be because the book covers
version 2.38 of the module (CGI.pm is at 2.7something, I believe), but
regarding file uploads, it does give an example of using a depreciated
method, and then tells you not to do this. Also, the section of file
uploads is quite good, now that I've built my own page&script combo,
but it wasn't the greatest. It wasn't the best resource while I was
writing the combo. Overall, the book does seem a little rushed and
thrown together at the last minute.
--
Help! I'm being held in a .sig factory.
------------------------------
Date: Tue, 27 Mar 2001 20:31:25 GMT
From: "Eric" <mail@ericmarques.net>
Subject: Re: LWP help
Message-Id: <xM6w6.21628$PF4.30885@news.iol.ie>
Thanks
the thing with the limiting bytes is because im using a kind of proxy server
for html files only and i dont want ppl trying to get large files and
slowing down the server
--
Eric Marques
mail@ericmarques.net
"Gregory Toomey" <gtoomey@usa.net> wrote in message
news:YDUv6.3977$45.20623@newsfeeds.bigpond.com...
> You can set the timeout as given below.
>
> I don't know about limiting the bytes received - there are usually only
> about 5000 bytes
> to a page so this downloads in about 1 sec. Remember, you are not
> downloading
> the images (.gif for .jpg).
>
> gtoomey
> (Greetings from sunny Australia! Beautiful one day, perfect the next ;-)
> ----
> use LWP::UserAgent;
> use HTTP::Cookies;
>
> $ua = new LWP::UserAgent;
> $ua->agent("$0/0.1 " . $ua->agent);
> $ua->timeout(30); # change your timout value as necessary
> $req = new HTTP::Request 'GET' => 'http://www.somesite.com';
#change
> as apprporiate
> $req->header('Accept' => 'text/html');
> $res = $ua->request($req);
>
> if ($res->is_success) {
> #web page is now in the variable$res
> }
>
> -------------
> "Eric" <mail@ericmarques.net> wrote in message
> news:NrMv6.21412$PF4.29991@news.iol.ie...
> > I am using LWP::UserAgent
> > How do i set a timeout and maximum recieve data?
> >
> >
> > --
> > Eric Marques
> > mail@ericmarques.net
> >
> >
>
>
------------------------------
Date: Tue, 27 Mar 2001 13:05:48 -0600
From: brian d foy <comdog@panix.com>
Subject: Re: More Help please :-)
Message-Id: <comdog-DB613E.13054827032001@news.panix.com>
In article <b5k1ct0pnbumb9ooa1j3ftr3djj3d3gabs@4ax.com>, Steve Alpert
<Steve_Alpert@idx.com> wrote:
> nospam@thank.you wrote:
> >I've sorted the list of email address with the script and the
> >resulting file has duplicates :-( Is there a quick way of removing the
> >duplicate lines? While the script is sorting the list? I'm using;
> >@newvalue = sort @value;
> >to sort the list.
> #!/user/bin/perl -w
> use strict;
>
> my @a = qw(a b c d c a e b);
> my $last = '';
>
> print grep { my $r = $_ ne $last; $last = $_; $r } sort @a;
when you see the words "unique", "duplicate", or similar things
you should almost always go with a hash.
my %hash = map { $_, 1 } @array;
my @unique = keys %hash;
--
brian d foy <comdog@panix.com>
------------------------------
Date: Tue, 27 Mar 2001 20:46:44 GMT
From: jmcnamara@cpan.org (John McNamara)
Subject: Re: Packing/Unpacking C doubles in Perl
Message-Id: <3ac0fc1e.3393129@news1.eircom.net>
Ar Mon, 26 Mar 2001 20:42:05 -0800, do scriobh Michael McGrattan:
>The problem is unpacking the double. When I try to display the
>value, it is an enormous number. I expect the value to be
>like 0.18 or 0.24, but I get something like 1071602728 when unpacking
>using "N" or something like 7.38736860443349e+137 when unpacking
>using "d".
If you are on an Intel machine then the "d" format is little-endian.
If the float is packed in "network" order then it is big-endian. So
you need to reverse the bytes in the float:
$unpackElement = unpack "d", reverse $element;
You can read the longs and the float in one go as follows:
# Say that $record contains 36 bytes in the format that
# you described. Make sure that you check this!!
my $longs = substr($record, 0, 7*4, '');
my @longs = unpack "N7", $longs;
my $float = unpack "d", reverse $record;
If you move your program to Windows remember to binmode() the file.
John.
--
"Something tells me we aren't programming in Pascal anymore, Toto."
------------------------------
Date: Tue, 27 Mar 2001 19:30:12 -0000
From: JWO <Jan-Willem@Oudendal.com>
Subject: Password: logfile
Message-Id: <tc1qi4c138cm66@corp.supernews.com>
Hi:
Is it possible when using ".htaccess/.htpasswd" to keep track of the ones
who locked in? (in logfile the time and date will be stored)
Thanks a lot! - JWO
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Tue, 27 Mar 2001 20:25:39 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Password: logfile
Message-Id: <slrn9c1tq3.ef9.abigail@tsathoggua.rlyeh.net>
JWO (Jan-Willem@Oudendal.com) wrote on MMDCCLXV September MCMXCIII in
<URL:news:tc1qi4c138cm66@corp.supernews.com>:
//
// Is it possible when using ".htaccess/.htpasswd" to keep track of the ones
// who locked in? (in logfile the time and date will be stored)
As the man page will tell you, flock does not keep track of who used it.
Abigail
--
#!/opt/perl/bin/perl -- # No trailing newline after the last line!
BEGIN{$|=$SIG{__WARN__}=sub{$_=$_[0];y-_- -;print/(.)"$/;seek _,-open(_
,"+<$0"),2;truncate _,tell _;close _;exec$0}}//rekcaH_lreP_rehtona_tsuJ
------------------------------
Date: Tue, 27 Mar 2001 23:29:17 +0100
From: "Chris Eason" <chris@cake.clara.net>
Subject: Re: Perl public key encryption
Message-Id: <kv8w6.53062$g63.7378381@nnrp3.clara.net>
"those who know me have no need of my name" <not-a-real-address@usa.net>
wrote in message news:tbvv0drv05dg5d@news.supernews.com...
> [note: this is really a security rather than a cryptography issue]
>
Noted. Sorry if this went to the wrong group.
> <wyBv6.50241$g63.6757199@nnrp3.clara.net> divulged:
>
> >I suppose the encrypted data from the remote browser will be decrypted
> >by Apache HTTP server and passed on to the Perl program. The Perl
> >program will then encrypt it again before writing it to a file on the
> >webserver.
>
> ... provided the perl program hasn't been tampered with.
>
True. Any suggestions as to how this could be prevented?
> anyway, you might want to see if they have pgp or gpg installed, then you
> can use Crypt::PGP2, Crypt::PGP5, or Crypt::GPG. be careful not use
> write a temporary cleartext file.
>
Sadly, as I mentioned in my first post, my first choice ISP has stated that
they will not allow the use of PGP on their webservers 'as it requires root
access'. This sounds like a load of nonsense to me, so I'm looking at other
ISP's who do provide PGP.
> >But, incidentally, getting the data to my PC is another reason
> >why I want the data to be encrypted, since my ISP doesn't support secure
> >FTP.
>
> umm. use https: to transfer the files.
>
Yes, but isn't this rather tedious if there are lots of files to download?
I'm not saying that it's so tedious you wouldn't bother, but it could get to
be a real pain. Encrypting the files first and using FTP would be just as
good. I will look at secure Telnet programs too, since it might be more
secure to FTP out from the UNIX box than into it, presuming you log in
securely to do this via a secure Telnet session.
Thanks for the advice. Much appreciated.
Chris
------------------------------
Date: Fri, 23 Mar 2001 12:51:40 -0600
From: xris <user@host.com>
Subject: Read a scalar as a file?
Message-Id: <user-1FE0A6.12514023032001@newsrump.sjc.telocity.net>
I'm messing with images, and currently have to write them to disk before
performing any tests on them, but I'm wondering if there's a way to read
a variable as if it was a file (so I can call something similar to read
or sysread on it)...
Thanks,
Chris
------------------------------
Date: Tue, 27 Mar 2001 21:31:21 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Read a scalar as a file?
Message-Id: <slrn9c21l9.ef9.abigail@tsathoggua.rlyeh.net>
xris (user@host.com) wrote on MMDCCLXI September MCMXCIII in
<URL:news:user-1FE0A6.12514023032001@newsrump.sjc.telocity.net>:
%% I'm messing with images, and currently have to write them to disk before
%% performing any tests on them, but I'm wondering if there's a way to read
%% a variable as if it was a file (so I can call something similar to read
%% or sysread on it)...
You could if you tie a handle.
Or you could download the latest snapshots from the development tree.
It's any day now...
Abigail
------------------------------
Date: Tue, 27 Mar 2001 22:22:24 GMT
From: jmcnamara@cpan.org (John McNamara)
Subject: Re: Read a scalar as a file?
Message-Id: <3ac111b7.8921964@news1.eircom.net>
Ar Fri, 23 Mar 2001 12:51:40 -0600, do scriobh xris <user@host.com>:
>I'm messing with images, and currently have to write them to disk before
>performing any tests on them, but I'm wondering if there's a way to read
>a variable as if it was a file (so I can call something similar to read
>or sysread on it)...
IO::Scalar allows you to treat a scalar as if it were a file via a
tied interface. It is part of the IO::Stringy distro:
http://search.cpan.org/search?dist=IO-stringy
John.
--
We're the dot in dotage.
------------------------------
Date: Fri, 23 Mar 2001 18:10:49 -0600
From: xris <user@host.com>
Subject: Re: regexp exception confusion
Message-Id: <user-320964.18104823032001@newsrump.sjc.telocity.net>
In article <U1Ru6.64915$o7.2753526@news1.rdc1.sdca.home.com>,
"John Hall" <jhall@ifxonline.com> wrote:
> This one is confusing; I am searching a $var for each of the words in an
> array using a foreach loop. For the most part the thing works fine, but for
> one of the words it's not finding it. I am using /.+$var.+/ so the word
> should be matched no matter what's in front or behind, but if there is a '
> or a " in front of _this one specific word_ then it doesn't match! My
> demonstration code follows, followed by my output:
why not just use /$var/ ?? there shouldn't be any real reason to
include the .* stuff unless you're going to use it for something else
down the line:
foreach $badword(@naughty) {
print "found $badword\n" if ($newtext =~ /$badword/);
}
your other problem could be related to the fact that your "split"
statement isn't stripping the whitespace after the comma, so your
searchis actually looking for the word " weasel" not "weasel":
@naughty = split /\s*,\s*/o, $datadb{_NAUGHTY_};
should help.
-Chris
------------------------------
Date: Tue, 27 Mar 2001 00:04:59 -0600
From: xris <user@host.com>
Subject: score-based search engines?
Message-Id: <user-DA4424.00045927032001@newsrump.sjc.telocity.net>
I work for a (very) small web design company, and one of my projects
over the years was to write a search engine for our database. I've
managed to speed up the searching portion of the engine by integrating
it with mysql, but since I'd like to be cool and return score-based
results, any scoring routines I come up with must be done in perl, and
are inevitably slow. Does anyone out there know of some examples of
text scoring that might be faster?
Thanks,
Chris
p.s. Please reply to the group, this email address is obviously fake (I
get too much spam as it is to entice more from newsgroup spiders)
------------------------------
Date: Tue, 27 Mar 2001 22:40:07 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: score-based search engines?
Message-Id: <bF8w6.68881$Ok4.5489486@news1.rdc1.ct.home.com>
xris <user@host.com> wrote:
> I work for a (very) small web design company, and one of my projects
> over the years was to write a search engine for our database. I've
> managed to speed up the searching portion of the engine by integrating
> it with mysql, but since I'd like to be cool and return score-based
> results, any scoring routines I come up with must be done in perl, and
> are inevitably slow. Does anyone out there know of some examples of
> text scoring that might be faster?
To be fast, you really need to expend a lot of effort on the initial
processing end when teh data gets dumped into your search database,
and unless you've a small website I'd say that's probably not
within the realm of something I'd do entirely in perl. You can probably
do the search and display bits in perl with some help from mysql, but
again you might find perl a touch slow, depending on how many pages
you have to retrieve.
As for how to actually do the scoring, that all depends, and it's a
reasonably complex field, or so I'm given to understand. Check out
some CS texts on document classification and suchlike things
for algorithms and more details.
Dan
------------------------------
Date: Tue, 27 Mar 2001 14:34:40 -0500
From: jtjohnston <jtjohnston@courrier.usherb.ca>
Subject: Serverside + Detect Browser Plugin
Message-Id: <3AC0EB50.CED02DD8@courrier.usherb.ca>
Hi, I failed at this mixing JS and SSI script. So this is no longer a
Javascript question.
So I'm wondering, can Perl detect browser plugins? It can read cookies!
If so I want to detect the RealAudio plugin and return the contents of
plugin.txt in the browser, if not return a message.
Here is the JS code I tried and failed at. I'm using serverside includes
and this script below. The ssi works if I put it in the html, but I cannot
document.writeln("") the script to display plugin.txt.
An email response & post would be a big help. I can only get back to the
groups only from work, and only when the boss is not watching.
<script language="JavaScript">
var myMimetype = navigator.mimeTypes["audio/x-pn-realaudio-plugin"]
if (myMimetype)
{
document.writeln("Click <A HREF='test.ram'>here</A> to see a " +
myMimetype.description);
document.writeln("\<\!\-\-\#include virtual=\"plugin\.txt\"\-\-\>");
}
else{
document.writeln("Too bad, can't show you any realvideo.")}
</script>
John
------------------------------
Date: Tue, 27 Mar 2001 15:46:43 -0500
From: "David Petrus" <david23@panix.com>
Subject: Re: Serverside + Detect Browser Plugin
Message-Id: <99qu2n$743$1@news.panix.com>
The problem is that the javaascript executes in the browser and the ssi
needs to execute on the server before it is passed to the browser.
"jtjohnston" <jtjohnston@courrier.usherb.ca> wrote in message
news:3AC0EB50.CED02DD8@courrier.usherb.ca...
> Hi, I failed at this mixing JS and SSI script. So this is no longer a
> Javascript question.
>
> So I'm wondering, can Perl detect browser plugins? It can read cookies!
>
> If so I want to detect the RealAudio plugin and return the contents of
> plugin.txt in the browser, if not return a message.
>
> Here is the JS code I tried and failed at. I'm using serverside includes
> and this script below. The ssi works if I put it in the html, but I cannot
> document.writeln("") the script to display plugin.txt.
>
> An email response & post would be a big help. I can only get back to the
> groups only from work, and only when the boss is not watching.
>
> <script language="JavaScript">
> var myMimetype = navigator.mimeTypes["audio/x-pn-realaudio-plugin"]
> if (myMimetype)
> {
> document.writeln("Click <A HREF='test.ram'>here</A> to see a " +
> myMimetype.description);
> document.writeln("\<\!\-\-\#include virtual=\"plugin\.txt\"\-\-\>");
> }
> else{
> document.writeln("Too bad, can't show you any realvideo.")}
> </script>
>
> John
>
------------------------------
Date: Tue, 27 Mar 2001 20:47:01 GMT
From: "Scaramouche" <e.quesada@verizon.net>
Subject: service pack information
Message-Id: <9%6w6.309$pV5.190018@paloalto-snr1.gtei.net>
is there any way of extracting service pack version information on a win32
system through perl. it's meant to be used within a script and written onto
a file, thus the os 'winver' command is useless to me.
thanks,
rick
------------------------------
Date: Tue, 27 Mar 2001 20:30:52 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: staying at the bottom on an html page
Message-Id: <slrn9c1u3s.ef9.abigail@tsathoggua.rlyeh.net>
GWN (chart@bestweb.net) wrote on MMDCCLXV September MCMXCIII in
<URL:news:B6E64DB9.10044%chart@bestweb.net>:
-- Is there a way to have a web page that is output by a perl cgi script
-- display the bottom of the page after printing and not the top?
It can, if, and only if, it can be done by a CGI program written C.
And if you tell us how it's done in C, someone might be willing to
help you translate it to Perl.
Abigail
--
sub _ {$_ = shift and y/b-yB-Y/a-yB-Y/ xor !@ _?
exit print :
print and push @_ => shift and goto &{(caller (0)) [3]}}
split // => "KsvQtbuf fbsodpmu\ni flsI " xor & _
------------------------------
Date: Tue, 27 Mar 2001 21:15:36 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: staying at the bottom on an html page
Message-Id: <slrn9c20nm.b07.tjla@thislove.dyndns.org>
I was shocked! How could GWN <chart@bestweb.net>
say such a terrible thing:
>Is there a way to have a web page that is output by a perl cgi script
>display the bottom of the page after printing and not the top?
Print it out backwards?
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Vitamin C deficiency is apauling
------------------------------
Date: Tue, 27 Mar 2001 17:22:05 -0500
From: "Kurt Stephens" <kstep@pepsdesign.com>
Subject: Re: staying at the bottom on an html page
Message-Id: <99r3l9$uj1$1@slb6.atl.mindspring.net>
From: "GWN" <chart@bestweb.net>
Newsgroups: comp.lang.perl.misc
Sent: Tuesday, March 27, 2001 2:01 PM
Subject: staying at the bottom on an html page
> Is there a way to have a web page that is output by a perl cgi script
> display the bottom of the page after printing and not the top?
This has nothing to do with Perl - to jump to the bottom of the page, place
a named anchor there and then specify the fragment in the calling URL. In
HTML 4, you can also do this using the id attribute on any tag. To
demonstrate this using a CGI script, copy the following code to bootie.pl in
your cgi-bin, make it executable and call the script as follows:
http://mydomain.com/cgi-bin/bootie.pl?count=25#bootie
Note: The browser may not jump to the bottom when the page is reloaded.
This is a problem with the browser (IE), and has nothing to do with Perl,
CGI or much else for that matter.
[start code]
#!/usr/bin/perl -w
# bootie.pl
#
# Prints a page with a named anchor at the bottom
#
# Usage:
# http://myserver.com/cgi-bin/bootie.pl?count=xx#bootie
use strict;
use CGI;
my $q = new CGI;
print $q->header;
print $q->start_html(-title=>"Bootie Call");
print $q->h1("Bootie Call!");
my $count = $q->param("count") || 25;
for my $p (1..$count) {
print $q->p("Not-a-bootie");
}
# Method 1: Use a named anchor
print $q->a({-name => "bootie"},
# Method 2: Use the HTML 4 'id' attribute
$q->h2({id => "bootie"}, "Here da bootie!")
);
print $q->end_html;
[end code]
HTH,
Kurt Stephens
------------------------------
Date: Tue, 27 Mar 2001 10:13:21 -0800
From: Kenneth Simpson <"ken"@$spam$wellconnected.com>
Subject: Re: Using Sunfreeware's perl in place of Sun's perl
Message-Id: <5L4w6.3270$Kq.880118@newsrump.sjc.telocity.net>
Hi - I didn't have any trouble removing perl5 completely from my
Solaris 8 system.
The CDE errors you posted in removing perl man pages are not in any
manner related to perl - your system or CDE is simply screwed up.
Also, if there was installed software which was depended upon perl,
then pkgrm would warn you of the dependency when you try to remove it.
-- Ken
Och wrote:
>
> >> Och:
> >>
> >> It also seems that a pkgrm SUNWpl5? fails because the Solaris 8
> >> kernel now depends upon perl.
>
> > garry:
> >
> > That's interesting. How did you conclude that?
>
> A deja search returned many hits posted by people experiencing
> problems using Sun's perl in a gcc environment.
>
> My first inclination was to just download Sunfreeware's perl,
> but I thought it best to remove Sun's perl first. Unfortunately,
> pkgrm displays the following errors on each perl package:
>
> _______________________________________________________________________
>
> # pkgrm SUNWpl5m
>
> The following package is currently installed:
> SUNWpl5m Perl5 On-Line Manual Pages
> (i386) 1.0,REV=2
>
> Do you want to remove this package? y
> WARNING: Stale lock installed for pkgrm, pkg SUNWpl5m quit in initial state.
> Removing lock.
>
> ## Removing installed package instance <SUNWpl5m>
> (A previous attempt may have been unsuccessful.)
> ## Verifying package dependencies.
> ## Processing package information.
> pkgrm: ERROR: bad read of contents file
> pkgrm: ERROR: pathname=/usr.dt/appconfig/icnns/C/Fpexit.s.bm
> pkgrm: ERROR: problem=unable to read mode/owner/group
>
> _______________________________________________________________________
>
> Further deja research produced an old post from a Sun engineer
> asking people not to remove Sun's perl packages because the
> Solaris 8 kernel now depends upon perl.
>
> It appears that early Solaris 8 releases used to allow people
> to remove perl.
>
> My hunch is that Sun made it impossible to remove perl from
> recent Solaris 8 releases.
>
> _______________________________________________________________________
>
> Och finger och@nym.alias.net for public key
--
========================================================================
Ken Simpson Well Connected Computing, Inc.
Email: ken@wellconnected.com 1001 Bridgeway, Suite 630
Voice: +1.415.332.5018 Sausalito, CA 94965
FAX: +1.415.332.9197 USA, Earth
========================================================================
Printed using 100% recycled electrons.
------------------------------
Date: Tue, 27 Mar 2001 10:49:32 -0800
From: Kenneth Simpson <"ken"@$spam$wellconnected.com>
Subject: Re: Using Sunfreeware's perl in place of Sun's perl
Message-Id: <0h5w6.3276$Kq.893354@newsrump.sjc.telocity.net>
Hi - and
rpm2cpio
to name another.
-- Ken
John D Groenveld wrote:
>
> In article <20010327172834.16041.qmail@nym.alias.net>,
> Och <och@nym.alias.net> wrote:
> >asking people not to remove Sun's perl packages because the
> >Solaris 8 kernel now depends upon perl.
>
> No, but kstat(1M) and possibly other useful commands depend on
> SUNWpl5u
> John
> groenveld@acm.org
--
========================================================================
Ken Simpson Well Connected Computing, Inc.
Email: ken@wellconnected.com 1001 Bridgeway, Suite 630
Voice: +1.415.332.5018 Sausalito, CA 94965
FAX: +1.415.332.9197 USA, Earth
========================================================================
Printed using 100% recycled electrons.
------------------------------
Date: 27 Mar 2001 13:29:10 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Using Sunfreeware's perl in place of Sun's perl
Message-Id: <ylg0fyzys9.fsf@windlord.stanford.edu>
In news.software.nntp, Och <och@nym.alias.net> writes:
> # ./h2ph /usr/include/syslog.h
> /usr/include/syslog.h -> /usr/include/syslog.ph
h2ph doesn't like absolute path names. Did you, by any chance, try
following the instructions in the INN installation manual, which say to
do:
# cd /usr/include
# h2ph * sys/*
Those instructions are in the section on controlchan, so you may have
missed them.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
------------------------------
Date: Tue, 27 Mar 2001 14:44:19 -0500
From: "Janet Ruhl" <ruhl@realrates.com>
Subject: Re: Wierd new response to old CGI script
Message-Id: <99qqpa$cba$1@bob.news.rcn.net>
Many thanks for your extremely helpful advice! I replaced the calls to
cgilib.pl in my old scripts with "use CGI qw(:cgi-lib);" scripts and
everything still works.
I just don't want to think about how many sales or rate contributions I
might have missed over the past months because visitors had the scripts blow
off on them.
------------------------------
Date: 27 Mar 2001 12:37:27 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Wierd new response to old CGI script
Message-Id: <m1k85bgd88.fsf@halfdome.holdit.com>
>>>>> "Janet" == Janet Ruhl <ruhl@realrates.com> writes:
Janet> Many thanks for your extremely helpful advice! I replaced the calls to
Janet> cgilib.pl in my old scripts with "use CGI qw(:cgi-lib);" scripts and
Janet> everything still works.
Janet> I just don't want to think about how many sales or rate contributions I
Janet> might have missed over the past months because visitors had the scripts blow
Janet> off on them.
May we quote you on that? From time to time, people say "I'll write
my own", and we scream back "No, please use CGI.pm". Yours is a very
practical example of what happens when people "write their own".
Thank you for your reply.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
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 V10 Issue 576
**************************************