[17682] in Perl-Users-Digest
Perl-Users Digest, Issue: 5102 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 13 14:10:40 2000
Date: Wed, 13 Dec 2000 11:10: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: <976734620-v9-i5102@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 13 Dec 2000 Volume: 9 Number: 5102
Today's topics:
Re: http_referer Problem!? (Randal L. Schwartz)
Ideas... <kereez@yahoo.com>
Re: implicit creation of array? (Mark-Jason Dominus)
input to interactive programs (Evanda Remington)
Interpolating <g.soper@soundhouse.co.uk>
Re: Interpolating <jeffp@crusoe.net>
Re: Interpolating <uri@sysarch.com>
Re: Interpolating <mbudash@sonic.net>
Re: Interpolating <ren.maddox@tivoli.com>
Re: local functions <mjcarman@home.com>
Re: local functions (Mark-Jason Dominus)
Re: local functions <uri@sysarch.com>
lwp-download: 500 Can't connect <bennyc@magix.com.sg>
My first JAPH.... (Adam Spragg)
Re: net:ping - problem in windows 2000 mike_solomon@lineone.net
Re: PERL INternet functions (Jon Bell)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Jon Bell)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <jeff@vpservices.com>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (John Stanley)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <bart.lateur@skynet.be>
Re: Problem using Image::Size on a webserver <g.soper@soundhouse.co.uk>
Re: Problem using Image::Size on a webserver <g.soper@soundhouse.co.uk>
programming help <millerf@execpc.com>
Re: programming help <ren.maddox@tivoli.com>
Re: programming help gungeek@my-deja.com
Re: quick way to search array members <ren.maddox@tivoli.com>
Re: Ready Made Form Data? <mothra@nowhereatall.com>
Re: Ready Made Form Data? <joe+usenet@sunstarsys.com>
Re: Search and Display - Need assistance (Richard Zilavec)
Re: Search and Display - Need assistance msalerno@my-deja.com
Segmentation Fault <eric.kort@vai.org>
Re: sighandler, and strict (Rafael Garcia-Suarez)
SIG{__DIE__} handler <ian.mcgilloway@multimap.com>
Re: single quote hell (Mark-Jason Dominus)
Re: srand() for CGI erictwx@my-deja.com
Re: TMTOWTDI - which way is better? <jeffp@crusoe.net>
Re: To Blob or not To Blob <philip.withoutspam.winfield@totalise.co.uk>
Re: To Blob or not To Blob <pkej@ez.no>
Re: To Blob or not To Blob gungeek@my-deja.com
Re: unicode question (Mark-Jason Dominus)
Varible passing sankarmukh@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 Dec 2000 07:38:05 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: http_referer Problem!?
Message-Id: <m1elzc1gde.fsf@halfdome.holdit.com>
>>>>> "Tina" == Tina Mueller <tinamue@zedat.fu-berlin.de> writes:
Tina> you must know that some environment variables can
Tina> be manipulated. NN and IE set it by themselves, and they
Tina> set it as you would expect, but i can write a browser with
Tina> LWP::UserAgent and set the referer by myself.
Tina> so that doesn't give you real security. if you want it, you
Tina> have to deal with session management.
Or to paraphrase, "it'll keep only the stupid people out!".
Not a good plan. Kinda like painting a line around your desk, and saying
"this is an electrified fence.. Oooooh beware!".
--
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: Wed, 13 Dec 2000 16:09:36 GMT
From: iwjaph <kereez@yahoo.com>
Subject: Ideas...
Message-Id: <3A379F34.1070802@yahoo.com>
Has anyone implemented an architecture in perl similar to the following...
Be able to send data(for example an xml file or a string representation
of xml that I pulled from the database) to another server secure(ssl or
other encryption) or non secure.
That's one major piece. The other is the following....
After that file has been sent. The ability to call an object on the
remote server(basic RPC) to execute the next step in the process. For
example say I wanted to take that xml file I just sent and transform it
into something else...
From my research it seems that this is the basic premise of SOAP but, I
was just seeing if anyone had another architecture that they have
implemented...
JF
------------------------------
Date: Wed, 13 Dec 2000 16:14:38 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: implicit creation of array?
Message-Id: <3a37a06e.2043$2c4@news.op.net>
In article <9166if$5h4$1@nnrp1.deja.com>,
Brian Runck <brianr72@my-deja.com> wrote:
>Any ideas why this statement:
>
>$self->{'input_data'}{$input_tag}[$i];
>
>doesn't work the way one would expect?
It is a long-standing bug in Perl.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: 13 Dec 2000 16:17:15 GMT
From: evanda@ater.org (Evanda Remington)
Subject: input to interactive programs
Message-Id: <slrn93f88a.tg4.evanda@mist.ater.org>
How would i go about sending input to interactive programs?
Is there a handy "waitfor" type deal? What i'm aiming at is having
something call passwd and give it the required info.
-e
--
Evanda Remington
evanda@ater.org
http://www.ater.org
------------------------------
Date: Wed, 13 Dec 2000 17:06:17 +0000 (GMT)
From: Geoff Soper <g.soper@soundhouse.co.uk>
Subject: Interpolating
Message-Id: <4a2c58cfa6g.soper@soundhouse.co.uk>
Currently I sue an expression such as :
my %pending_data = import_data($news_location . "pending",);
Can I somehow interpolate the $news_location inside the string? How do I
mark the end of the variable name without putting in a space?
Thanks
--
Geoff Soper
g.soper@soundhouse.co.uk
Take a look at the Soundhouse page http://www.soundhouse.co.uk/
------------------------------
Date: Wed, 13 Dec 2000 12:31:52 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Interpolating
Message-Id: <Pine.GSO.4.21.0012131230130.19179-100000@crusoe.crusoe.net>
[posted & mailed]
On Dec 13, Geoff Soper said:
> my %pending_data = import_data($news_location . "pending",);
>Can I somehow interpolate the $news_location inside the string? How do I
>mark the end of the variable name without putting in a space?
Use braces around the identifier:
$name = "Jeff";
print "$name's age is 19.\n"; # oops, $name's is $name::s
print "${name}'s age is 19.\n"; # there we go
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
PerlMonks - An Online Perl Community http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
------------------------------
Date: Wed, 13 Dec 2000 17:32:52 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Interpolating
Message-Id: <x7y9xki5vf.fsf@home.sysarch.com>
>>>>> "GS" == Geoff Soper <g.soper@soundhouse.co.uk> writes:
GS> my %pending_data = import_data($news_location . "pending",);
GS> Can I somehow interpolate the $news_location inside the string? How do I
GS> mark the end of the variable name without putting in a space?
use braces to demark the var name from the rest of the string.
"${news_location}pending"
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 13 Dec 2000 10:01:49 -0800
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Interpolating
Message-Id: <mbudash-F9594E.10014913122000@news.pacbell.net>
In article <4a2c58cfa6g.soper@soundhouse.co.uk>, Geoff Soper
<g.soper@soundhouse.co.uk> wrote:
> Currently I sue an expression such as :
> my %pending_data = import_data($news_location . "pending",);
> Can I somehow interpolate the $news_location inside the string? How do I
> mark the end of the variable name without putting in a space?
>
> Thanks
my %pending_data = import_data("${news_location}pending");
i assume you put in the comma after "pending" by mistake?
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: 13 Dec 2000 11:19:45 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Interpolating
Message-Id: <m3vgsoi6ha.fsf@dhcp11-177.support.tivoli.com>
Geoff Soper <g.soper@soundhouse.co.uk> writes:
> Currently I sue an expression such as :
> my %pending_data = import_data($news_location . "pending",);
> Can I somehow interpolate the $news_location inside the string? How do I
> mark the end of the variable name without putting in a space?
my %pending_data = import_data("${news_location}pending");
Not sure why you have the comma at the end, so I've left it off.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 13 Dec 2000 08:11:12 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: local functions
Message-Id: <3A378380.67E7F485@home.com>
Uri Guttman wrote:
>
> >>>>> "MC" == Michael Carman <mjcarman@home.com> writes:
>
> MC> sub foo {
> MC> local *bar = sub {
> MC> print "baz!\n";
> MC> }
Damn. I missed the ending ';' there. I always do that. :/
> MC> bar();
> MC> }
>
> why even use the typeglobs? they will be gone (thankfully) in
> perl6.
So I still have time to change my habits. :) Given that this is one of
only two places I ever use them, I'm not too upset. The other is passing
filhandles. How is that going to be resolved? (Or will I be forced to
use IO::File?)
> just use a simple anon sub and save the code ref and call it. the
> extra syntax on the ref call is matched by the lack of a typeglob and
> local, both of which are ugly when not needed.
A trade off, then. For the sake of thoroughness, I'd like to add that I
don't like method notation for non-objects. I'd use dereferencing
syntax:
my $bar = sub {'baz!'};
&$bar(); # instead of '$bar->();'
-mjc
------------------------------
Date: Wed, 13 Dec 2000 16:21:25 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: local functions
Message-Id: <3a37a205.2073$3a1@news.op.net>
Keywords: Norwich, Parr, surveyor, telephotography
In article <2qsc3tgp07ugr5u0febvr5so2rmv428ja2@4ax.com>,
Bart Lateur <bart.lateur@skynet.be> wrote:
>Ole Christian Eidheim wrote:
>
>>Is there a way to create a local function A within a function B that
>>doesn't override an existent function with the same name anywhere but
>>within function B?
>
>You mean something like:
>
> sub A {
> "global"
> }
> sub B {
> sub A {
> "local";
> }
> print A();
> }
> B();
>
>It works (in Perl5.6),
It certainly does not.
Add
print A();
at the end and it will print "local". The original poster asked:
>>Is there a way to create a local function A within a function B that
>>doesn't override an existent function with the same name anywhere but
>>within function B?
This is not what he wanted. In your example, the 'global' sub A has
been completely destroyed. It is exactly the same as if you had
written this:
sub A { "local" }
sub B { print A() }
B();
> but there's a complaint under -w:
>
> Subroutine A redefined at test.pl line 6.
It does no good to run with -w enabled if you ignore the warnings you get.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Wed, 13 Dec 2000 17:06:27 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: local functions
Message-Id: <x71yvcjlnw.fsf@home.sysarch.com>
>>>>> "MC" == Michael Carman <mjcarman@home.com> writes:
MC> So I still have time to change my habits. :) Given that this is
MC> one of only two places I ever use them, I'm not too upset. The
MC> other is passing filhandles. How is that going to be resolved? (Or
MC> will I be forced to use IO::File?)
you can also pass hard references to typeglobs for file handles. it
makes life easier their as well. and using IO::* is not a bad thing in
most cases. it's major drawback is its size.
MC> A trade off, then. For the sake of thoroughness, I'd like to add
MC> that I don't like method notation for non-objects. I'd use
MC> dereferencing syntax:
MC> my $bar = sub {'baz!'};
MC> &$bar(); # instead of '$bar->();'
that is fine too. but stay away from typeglobs if you can. they are ugly
and nasty.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 13 Dec 2000 15:47:38 GMT
From: Benny Chee <bennyc@magix.com.sg>
Subject: lwp-download: 500 Can't connect
Message-Id: <20001213234549.A1766@magix.com.sg>
hi,
I have problems with my lwp programs, i have no idea what is it due to, i have recompile LWP serveral times and it still give me the errors. Can someone help?
# lwp-download -a http://www.perl.com
lwp-download: 501 Can't connect to www.perl.com:80 (Timeout)
# lwp-mirror http://www.perl.com perl.html
lwp-mirror: 500 Internal Server Error (http://www.perl.com)
I have no firewall or whatever that is blocking it going out, infact i could use lynx to get to that URL.
Benny
--
I don't want Perl to be beautiful,
I want you to write beautiful programs in Perl.
--Larry Wall, Culture of Perl, August 1997
------------------------------
Date: 13 Dec 2000 18:49:54 GMT
From: atspragg@garbanzo.engr.ucdavis.edu (Adam Spragg)
Subject: My first JAPH....
Message-Id: <918gci$fe4$1@mark.ucdavis.edu>
Necessity might be the mother of invention, but boredom is certainly the
father...
@_=(join"","0",eval join("*",17,435983),eval join("*",ord" ",ord"H",5,4441),
eval join("*",(ord"d")+(ord"/"),461,1433),eval(join"*",7,ord"/",3529),"0",eval
(join"*",ord"0",23209),0,eval(join"*",3,17,157061),eval(join"*",179,229499),
"0409".7099,eval(join'*',2,5689,9413))=~m%.{0,3}%g;for(@_){print chr;}print"\n";
Is that good?
Adam
------------------------------
Date: Wed, 13 Dec 2000 16:26:55 GMT
From: mike_solomon@lineone.net
Subject: Re: net:ping - problem in windows 2000
Message-Id: <918804$paq$1@nnrp1.deja.com>
In article <G5HF1M.445@news.boeing.com>,
ced@bcstec.ca.boeing.com (Charles DeRykus) wrote:
> In article <9156ob$91f$1@nnrp1.deja.com>, <mike_solomon@lineone.net>
wrote:
> >I am trying to use Net::Ping to find out if an IP address is
available
> >
> >I am using ActivePerl under Windows 2000
> >
> >I used the following code:
> >
> > use Net::Ping;
> > if (pingecho(${fip},5)) {
> > print "\n\nPing Succeeded - IP ${fip} in use\n";
> > $pop++;
> > } else {
> > print "\n\nPing Failed - ${fip} OK TO USE\n";
> > $ok = 1;
> > }
> >
> >Where $fip is the ip address
> >
> >Which gave me the following error message:
> >
> >The Unsupported function alarm function is unimplemented at
> > C:/Perl/lib/Net/Ping.pm line 308, <STDIN> line 3 (#1)
> >...
> >I have read the documentation for Net:Ping but it hasn't helped me
> >
>
> You must've missed the warning about pingecho and
> a ping object with tcp...look for WARNING near the
> end of the doc.
>
> use Net::Ping;
> my $p = Net::Ping->new;
> if ( $p->ping($fip) ) {
> ...
>
> --
> Charles DeRykus
You are correct, I did miss the warning at the end of the document,
unfortunately I am not really understanding the manual
Can you tell me if I can use this module
If so I need to know the syntax to use to show if a machine can be
reached or not
Any help with this will be gratefully received
I tried the code you put in the bottom of your post but it hasn't got
me any further
Thanks
Mike Solomon
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 13 Dec 2000 14:15:40 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: PERL INternet functions
Message-Id: <G5IFM4.Ixu@presby.edu>
EnIgMaBoM <enigmabomb@home.gotohellspammers.ihopeyourotinghellyouspamminggarbage.com> wrote:
>My apologies. Here is what I have tried. I tried to use a scalar there, It
>didnt take, then I tried the scalar in quotes, [...]
Tip: When we say "show us what you tried", we mean "show us the actual
Perl code that you tried." Preferably by copying and pasting it into your
message, not retyping it, so as to avoid typos. Trying to describe it in
plain English will almost always confuse people.
--
Jon Bell <jtbell@presby.edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA
[ Help try to keep the Deja.com archive alive! Sign the petition at ]
[ http://www2.PetitionOnline.com/dejanews/petition.html ]
------------------------------
Date: Wed, 13 Dec 2000 14:21:45 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <G5IFw9.JB9@presby.edu>
Tad McClellan <tadmc@metronet.com> wrote:
>--------------------------------------
>=item Use an effective followup style
>
>When composing a followup, quote only enough text to establish the
>context for the comments that you will add. Never quote an entire
>article. Never quote a .signature (unless that is what you are
>commenting on).
I'd add: "Always attribute your quotes." Or, in plainer English:
"Always indicate who wrote the quoted material."
>Intersperse your comments B<following> the sections of quoted text
>that your comment applies to.
>--------------------------------------
I'd make that last line "that your comments apply to" or
just "that they apply to".
--
Jon Bell <jtbell@presby.edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA
[ Help try to keep the Deja.com archive alive! Sign the petition at ]
[ http://www2.PetitionOnline.com/dejanews/petition.html ]
------------------------------
Date: Wed, 13 Dec 2000 07:25:24 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <3A3794E4.1AE7B012@vpservices.com>
Tad McClellan wrote:
>
> Jeff Zucker <jeff@vpservices.com> wrote:
> >Tad McClellan wrote:
>
> >make the group most useable by the most number of people.
Blech! Did I really write that? :-(.
> I'll reword it somehow. Can anyone recommend a way without
> the /most.*most/s in it? That sounds kinda cumbersome.
Thanks.
> Naw, let's not go down that slippery slope. I'll change it to:
>
> -----------------------------------
> while ( <> ) {
> print if /^=head/;
> print " $_" if /^=item/;
> }
> -----------------------------------
Sounds good, though I prefer the output of:
while (<>) {
print " $1\n" if /^=item\s+(.*)/;
print " $1\n" if /^=head2\s+(.*)/;
print "$1\n" if /^=head1\s+(.*)/;
}
--
Jeff
------------------------------
Date: 13 Dec 2000 17:54:03 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <918d3r$km1$1@news.NERO.NET>
In article <slrn93e2f8.1c0.tadmc@maxim.metronet.com>,
Tad McClellan <tadmc@metronet.com> wrote:
>For instance, I plan to make a discussion of killfiles and scoring
>for those that are not familiar with real newsreading tools.
This is supposed to be a perl discussion group. It is not a group for
teaching people how to use their newsreaders. There already is a group
for that.
>I'll let this article "simmer" for a couple days, and then post the
>0.2 version for another go-round.
Without pod, please. If you denounce markup languages like HTML which
are parsable by many modern newsreaders, then pod, which is understood
by none, should be prohibited, too.
> Do we want a "flag" in the Subject for filtering purposes?
Yes. As opposed to Abigail, I want to see neither the FAQ nor any
responses to it, as all such articles will be off-topic.
I'm interested to know why you think that posting THIS FAQ will have any
more effect on the way people post than any other FAQ or any of the
oft-repeated responses to people who post in ways you don't like. What
will be special about THIS document that will make them read it and make
them follow your advice, when we already know they do NOT read such
documents (even when they are the documents describing perl) and do not
follow them?
------------------------------
Date: Wed, 13 Dec 2000 18:54:40 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <4ahf3tsb6jvbces8sns5o0tgfkp27dka6t@4ax.com>
John Stanley wrote:
>This is a discussion newsgroup, not a pod newsgroup nor a TeX newsgroup
>nor an HTML newsgroup. It's a bit disengenuous to claim that HTML is not
>welcome here while posting a FAQ in a non-standard (to the rest of the
>world) markup language.
True. POD may be the markup of the original doc, of which HTML and
text-only versions can be generated. The version that would get
autoposted here, should not be POD, but text-only.
>HTML has the great advantage that many
>newsreaders process it natively;
Blech. That's no excuse. Not ALL newsreader process it natively, and
most good programmers seem to prefer text-only tools. If you want o
discuss Britney Spears, by all means, fel free to use HTML if you like
(but not in this newsgroup!). If you want to have meaningful discussions
with experienced programmers about Perl, use text only.
--
Bart.
------------------------------
Date: Wed, 13 Dec 2000 17:07:40 +0000 (GMT)
From: Geoff Soper <g.soper@soundhouse.co.uk>
Subject: Re: Problem using Image::Size on a webserver
Message-Id: <4a2c58f00dg.soper@soundhouse.co.uk>
In article <976674272.26866@itz.pp.sci.fi>,
Ilmari Karonen <iltzu@sci.invalid> wrote:
> More elegant solution:
> use lib '/home/soundh/cgi-bin/required';
I'll go with that!
Many thanks
--
Geoff Soper
g.soper@soundhouse.co.uk
Take a look at the Soundhouse page http://www.soundhouse.co.uk/
------------------------------
Date: Wed, 13 Dec 2000 18:25:49 +0000 (GMT)
From: Geoff Soper <g.soper@soundhouse.co.uk>
Subject: Re: Problem using Image::Size on a webserver
Message-Id: <4a2c6017b2g.soper@soundhouse.co.uk>
In article <976674272.26866@itz.pp.sci.fi>,
Ilmari Karonen <iltzu@sci.invalid> wrote:
> More elegant solution:
> use lib '/home/soundh/cgi-bin/required';
Follow-up question, can I use two of these to allow for the program being
run on my machine and on the server (with different locations)?
Thanks
--
Geoff Soper
g.soper@soundhouse.co.uk
Take a look at the Soundhouse page http://www.soundhouse.co.uk/
------------------------------
Date: Wed, 13 Dec 2000 11:31:52 -0800
From: Fred Miller <millerf@execpc.com>
Subject: programming help
Message-Id: <3a37b24d$0$75804$272ea4a1@news.execpc.com>
i have a file open and i want to print some thing to another file.
how do i redirect to a file?
i want to print "gsdghhfhdh" to another file.
------------------------------
Date: 13 Dec 2000 11:36:30 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: programming help
Message-Id: <m37l54i5pd.fsf@dhcp11-177.support.tivoli.com>
Fred Miller <millerf@execpc.com> writes:
> i have a file open and i want to print some thing to another file.
> how do i redirect to a file?
> i want to print "gsdghhfhdh" to another file.
You can have multiple files open. I'm not sure what exactly you're
asking, but how about something like this silly example:
# assumes $input_file and $output_file are already set
open INPUT, $input_file or die "Could not open $input_file, $!";
open OUTPUT, ">$output_file" or die "Could not create $output_file, $!";
while (<INPUT>) {
s/\bjelly\b/jam/g;
print OUTPUT;
}
close OUTPUT;
close INPUT;
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 13 Dec 2000 18:33:35 GMT
From: gungeek@my-deja.com
Subject: Re: programming help
Message-Id: <918fdv$i8$1@nnrp1.deja.com>
In article <3a37b24d$0$75804$272ea4a1@news.execpc.com>,
Fred Miller <millerf@execpc.com> wrote:
> i have a file open and i want to print some thing to another file.
> how do i redirect to a file?
> i want to print "gsdghhfhdh" to another file.
>
open(FILEOUT,">outfile.txt") or die "Couldn't open outfile.txt : $!";
print FILEOUT "asdfg";
close FILEOUT;
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 13 Dec 2000 10:40:00 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: quick way to search array members
Message-Id: <m3zoi0i8bj.fsf@dhcp11-177.support.tivoli.com>
crb <chris_beaudette@my-deja.com> writes:
> i'm looking for a quick, shorthand way to search thru an array and see
> if a particular string already exists in the array. the goal is to
> build an array of unique members only, by comparing potential array
> members to existing array members.
Then you really want to use a hash instead of an array. You can take
a look at "How can I remove duplicate elements from a list or array?"
in perlfaq4, but pay particular attention to the very last sentence.
> i'd rather not have to use a foreach loop to make the comparison.
If you really want to search through an array to find out if something
is there, then foreach is likely going to be the quickest solution
(at least for large arrays) since you can have it stop searching as
soon as it finds the element. But, you really are better of just
using a hash to begin with.
> i thought i've seen a quick operator to do this before, but now i can't
> find it in any of the manuals i have.
You may be thinking of "grep", but you should avoid that for this
purpose as it will always search the entire array even if the element
is found at the beginning of the array. This can be quite wasteful.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 13 Dec 2000 06:04:35 -0800
From: mothra <mothra@nowhereatall.com>
Subject: Re: Ready Made Form Data?
Message-Id: <3A3781F3.298069CC@nowhereatall.com>
vivekvp wrote:
> Hello,
>
> I need to take data from a form (data see below) I have below and send
> it to a perl script that would write it to a mysql database.
>
> I am not sure how to separate the data sent in the form - and send it
> to each table. Basically I just want the data in the form to send the
> data to the
> database. Each field is a table.
>
you need to take a look at the CVGI.pm module:
From the documentation:
It is possible for a script to receive CGI parameters in the URL as well as
in the fill-out form by creating a form that POSTs to a URL containing a
query string (a ``?'' mark followed by arguments). The param() method will
always return the contents of the POSTed fill-out form, ignoring the URL's
query string. To retrieve URL parameters, call the url_param() method. Use
it in the same way as param(). The main difference is that it allows you to
read the parameters, but not set them.
>
> So how do I separate them? I think I can handle writing and retrieving
> the data. I mean I hope I can! I want to use the Post method as that
> seems
> safer. Can I ensure the data is only numbers text plus an '@', '.','-'
> symbols?
>
> Thanks!
>
> V
>
> Data:
>
> http://www.xxx.com/database/test/?=555&=444&=4444&=222&=555&=5555&first_
>
> name=test%40test.com&first_name=x&last_name=x&street_1=x&city=x&select_s
>
> tate=Louisiana&state=x&zip=12345&country=United+States&flags1=1&birth_da
>
> te_mon=12&birth_date_day=19&birth_date_year=1981&Sex=0&Marital=S&Continu
> e=Sign+Me+Up%21
> --
> He who fights and runs away, lives to run another day!
>
> Sent via Deja.com
> http://www.deja.com/
------------------------------
Date: 13 Dec 2000 09:27:51 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Ready Made Form Data?
Message-Id: <m3g0jse6qg.fsf@mumonkan.sunstarsys.com>
vivekvp <vivekvp@spliced.com> writes:
> http://www.xxx.com/database/test/?=555&=444&=4444&=222&=555&=5555&first_
^ ^ ^ ^ ^ ^
You should use CGI.pm- but are you sure you want a multivalued '' key?
--
Joe Schaefer
------------------------------
Date: Wed, 13 Dec 2000 15:02:54 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: Search and Display - Need assistance
Message-Id: <3a388f0e.75068886@news.tcn.net>
On Wed, 13 Dec 2000 04:52:55 GMT, rzilavec@tcn.net (Richard Zilavec)
wrote:
> # usernames containing
> if(/^.*?$ARGV[0].*?:/) {
^^^^^^
Forgot that...... the username should match at the start, middle and
end now.
--
Richard Zilavec
rzilavec@tcn.net
------------------------------
Date: Wed, 13 Dec 2000 15:32:07 GMT
From: msalerno@my-deja.com
Subject: Re: Search and Display - Need assistance
Message-Id: <9184pn$mdt$1@nnrp1.deja.com>
In article <3a388f0e.75068886@news.tcn.net>,
rzilavec@tcn.net wrote:
> On Wed, 13 Dec 2000 04:52:55 GMT, rzilavec@tcn.net (Richard Zilavec)
> wrote:
>
> > # usernames containing
> > if(/^.*?$ARGV[0].*?:/) {
> ^^^^^^
>
> Forgot that...... the username should match at the start, middle and
> end now.
>
> --
> Richard Zilavec
> rzilavec@tcn.net
>
Thanks for the feedback. I received an E-mail from a fellow newsgroup
poster that pretty much answered the question. I have made some
changes, and for anyone else who may be looking for a similar script I
am going to post it.
Thanks,
Matt
#!/usr/bin/perl -w
use strict;
print "Enter the user information that you want to search for : ";
chomp(my $search = <STDIN> );
print "\n";
setpwent;
my $cnt = 0;
while (my @passwd = getpwent){
if ($passwd[0] =~ /\Q$search/ or $passwd[6] =~ /\Q$search/){
print "User: $passwd[0]\tName: $passwd[6]\n";
$cnt++;
}
}
die "No Users found with current search criteria - \"$search\"\n\n"
unless $cnt > 0;
endpwent;
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 13 Dec 2000 10:45:17 -0500
From: "Eric" <eric.kort@vai.org>
Subject: Segmentation Fault
Message-Id: <918596$116v$1@msunews.cl.msu.edu>
I have a script with an XSUB that is causing segmentation faults that
disappear when I comment out seemingly random bits of my XSUB. Other
seemingly random changes lead to "Attempt to free unreferenced scalar..."
type errors.
This leads me to ask:
1) What are the first things to check when getting segmentation faults?
2) Can anyone point me to a good overview of memory management issues when
writing XSUBs beyond what is in perlguts?
tia,
Eric
------------------------------
Date: Wed, 13 Dec 2000 14:24:34 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: sighandler, and strict
Message-Id: <slrn93f1n2.9n9.rgarciasuarez@rafael.kazibao.net>
Bart Lateur wrote in comp.lang.perl.misc:
> Rafael Garcia-Suarez wrote:
>
> >> > $SIG{WHATEVER} = \&mysub; #not "mysub"
> >>
> >> I guess the question is, where do I declare $SIG?
> >
> >$SIG needs not to be declared : it's a special variable, and as a
> >special variable,
>
> Except that it's %SIG, not $SIG.
You're absolutely right. (But $SIG doesn't need to be declared either.)
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Wed, 13 Dec 2000 15:24:10 -0000
From: "ian mcg" <ian.mcgilloway@multimap.com>
Subject: SIG{__DIE__} handler
Message-Id: <3a379533_2@nnrp1.news.uk.psi.net>
Hi,
I'm trying to handle the 'die' from parsing of a badly formed XML document.
This is the way I've tried to do it,
# $xml_upload is an instance of XML::Parser
{
local $SIG{__DIE__} = \&myDieHandler;
$xml_upload->parse($xml_document);
}
Badly formed XML causes the handler to be called. However, well formed XML
also calls the handler.
Commenting out 'local $SIG{__DIE__} ...' results in badly formed XML
crashing the program, and well formed XML being parsed as expected.
Does anyone out there know why this happens?
Ian
------------------------------
Date: Wed, 13 Dec 2000 16:26:40 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: single quote hell
Message-Id: <3a37a340.208a$304@news.op.net>
In article <t3cmekm9ffnh05@corp.supernews.com>,
Tommy Martin <tmartin@tlmartin.com> wrote:
>Great information. Thanks alot....
>
>DBI is what I am using...
You may want to have a look at
http://www.perl.com/pub/1999/10/DBI.html
In particular, the section at the end titled "Don't do This."
You're doing the thing it says not to do.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Wed, 13 Dec 2000 17:50:53 GMT
From: erictwx@my-deja.com
Subject: Re: srand() for CGI
Message-Id: <918cto$u79$1@nnrp1.deja.com>
In article <3A35EEEE.23685E63@xmission.com>,
fozz@xmission.com wrote:
> sluppy wrote:
> >
> > I wrote a short subroutine to produce a random string that I plan to
> > use as a session ID on a cookie-less web site.
> >
> > The problem is that I can duplicate the "random" string simply by
_very
> > quickly_ running the subroutine twice from the command line.
> >
> > I'm assuming that srand() is equivalent to srand(time) which AFAIK
> > doesn't get any finer than the current second.
> >
> > So... I assume that two visitors to my web site during the exact
same
> > second would be issued the exact same session ID. (This, of course,
> > would be bad.)
> >
> > Is there a way I can minimize the possibility of two or more
visitors
> > to the web site getting the same random result?
>
> One way to increase the entropy in your case is to use the visitor's
IP
> address (usually found in $ENV{REMOTE_ADDR}).
>
> You may also want to use the Math::TrulyRandom module available from
> your local neighborhood CPAN site.
>
> Ahh, RTFM. The POD documentation for srand() gives an excellent
example:
>
> srand (time ^ $$ ^ unpack "%L*", `ps axww | gzip`);
>
> Nice.
>
> -=Fozz
>
> --
> Doran L. Barton -- < fozz@xmission.com >
> "Some people don't know Unix from Meuslix. Others claim to dream in
> Perl."
>
$ENV{REMOTE_ADDR} is not unique to a user. Many users on a masqueraded
subnet have the same IP.
-E
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 13 Dec 2000 09:25:25 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: TMTOWTDI - which way is better?
Message-Id: <Pine.GSO.4.21.0012130918300.19179-100000@crusoe.crusoe.net>
[posted & mailed]
On Dec 13, Philip Lees said:
>Hi. I'm writing an array to an html file and, along the way,
>substituting a string for a pattern. If the pattern isn't found the
>string gets written right before the </body> tag. Both the following
>methods work, but for some reason I feel this nagging dissatisfaction
>with both of them.
>my $done;
>foreach( @old_html ){
> $done = $done || s/\*$link_fields[0]\*(?!<\/p>$)/$include_string/i;
> unless ( $done ){ print FH "$include_string\n" if /^<\/body>\n$/i };
> print FH;
>}
Hmm, you're only substituting once, you know. $done = $done || ... will
only execute the ... when $done is false, and $done will be true after the
first successful s///.
I'd probably use
my $found;
for (@old_html) {
# /o modifier because $link_fields[0] doesn't change, right?
$found ||= s/pattern/$include_string/io;
print FH $include_string, "\n" if m!^</body>$!i and not $found;
print FH;
}
Which is pretty close to your first method, anyway.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
PerlMonks - An Online Perl Community http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
------------------------------
Date: Wed, 13 Dec 2000 16:03:31 +0000
From: Phil <philip.withoutspam.winfield@totalise.co.uk>
Subject: Re: To Blob or not To Blob
Message-Id: <3A379DD3.36D08778@totalise.co.uk>
We use blobs and ANO without problems. We have 90,000 files ranging from
30kb to 2mb and speed of attachment and retrieval is surprisingly good. This
is with a VB client and 600 concurrent users. It does simplify the design by
having everything in the DB but the DBAs don't like it.
Phil
Barnel wrote:
> Can anyone here tell me the pros and cons of storing Blobs in a database
> for this type of web application.
>
> The application will allow users to upload jpegs and mp3 files and
> store them in a database where these files can later be retrieved from a
> webpage.
>
> So I'm thinking: users upload his/her file and store it in the database
> as a Blob
>
> Since this users will view and listen to these files from a web page
> would it not be simpler if I stored the uploaded file on the file system
> and simply put in the database the location of the files which I can
> later insert into a web page.
>
> Do you see my dilemma here or is there something I'm overlooking?
------------------------------
Date: Wed, 13 Dec 2000 18:29:55 +0100
From: Paul K Egell-Johnsen <pkej@ez.no>
Subject: Re: To Blob or not To Blob
Message-Id: <3A37B213.40CB1CF7@ez.no>
Logan Shaw wrote:
> The one other performance issue is that, if the files are in the
> database, then every time a user wants to retrieve such a file, there
> will have to be a Perl script running for the whole time they are
> retrieving it. Perl isn't a terrible resource waster, but then again
> http servers are carefully optimized so that serving plain files of
> disk is going to be a lot more efficient. It's not as terrible as
> starting a script for each on of a bunch of small hits, though -- at
> least this Perl scripts will be long-lived, so the start-up penalty
> will not occur too often.
There is also the 'problem' of timeouts. On a slow connection a medium
sized file (1 MB to about 50 MB) would probably receive a script time
out before the data has been sent. You can override the default time out
of your webserver, but if you want to do that is another question.
The rest of Logan's post is excellent at detailing the various
problems/pitfalls.
--
Paul K Egell-Johnsen
Utvikler/PR Manager
eZ systems as
http://ez.no/
------------------------------
Date: Wed, 13 Dec 2000 18:49:28 GMT
From: gungeek@my-deja.com
Subject: Re: To Blob or not To Blob
Message-Id: <918gbl$1hi$1@nnrp1.deja.com>
In article <3A3720DB.E58C69C0@ottawa.com>,
Barnel <barnel@ottawa.com> wrote:
> Can anyone here tell me the pros and cons of storing Blobs in a
database
> for this type of web application.
>
I've done something very similar to this, and it functioned flawlessly
with blobs Oracle. Actually I think I used another type (maybe long?)
because blob's didn't work very well. I was never able to get it to
work properly on Sybase. In retrospect, I wish I would have used the
filesystem, because the solution didn't scale very well. We had
performance and database space problems.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 13 Dec 2000 16:16:35 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: unicode question
Message-Id: <3a37a0e2.2050$1b@news.op.net>
Keywords: annul, dictum, environ, magnitude
In article <t3co7f4nmo9ic8@corp.supernews.com>,
David Lee <dwl@slip.net> wrote:
>I tried using binmode with discipline ":utf8" but it
>didn't seem to work. Is this working in perl 5.6?
No. Nor is it documented to work.
It will work in 5.6.1, however.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Wed, 13 Dec 2000 16:54:45 GMT
From: sankarmukh@my-deja.com
Subject: Varible passing
Message-Id: <9189kh$qsk$1@nnrp1.deja.com>
Hi,
I run a Perl script in one unix box. I define a few variable there and
then use telnet module to telnet to another box and run a ksh script
there. This ksh script ftps certain files to some other boxes.
Here is my problem? Since I do not how to use the same variables both
in Perl and ksh , I used the variables as an argument to ksh script.
But, I think the argument list is too long and fails. I coomented out
the ftp line to echo to see what is happening.
The Perl script:
*******************************************************
$HOME="/u/ctssmuk";
$HOME1="/u/prod";
$START_DIR="$HOME/web/prod/netx";
$START_DIR1="$HOME1/web/prod/netx";
print "What is the name of the CLIENT? This is usually in Caps. Please
enter in Capitals";
print "\n";
$CLIENT = <STDIN>;
chomp ($CLIENT);
print "\n";
$LOGIN_DIR="$START_DIR/$CLIENT/unsecure-html";
$REMOTE_LOGIN_DIR="$START_DIR1/$CLIENT/secure-html";
$client=`(echo $CLIENT|tr A-Z a-z|tr -d '_')`;
print $client;
$MORE_LOGIN_DIR="$LOGIN_DIR/$client";
$MORE_REMOTE_LOGIN_DIR="$REMOTE_LOGIN_DIR/$client";
print "ftp files from $LOGIN_DIR to $REMOTE_LOGIN_DIR\n";
print "\n";
print "and ftp files from $MORE_LOGIN_DIR to $MORE_REMOTE_LOGIN_DIR\n";
print "\n";
print "Enter the name of the file";
print "\n";
$FILENAME = <STDIN>;
chomp ($FILENAME);
print $FILENAME;
print "\n";
########################################################################
#########
$hostname="inawk77";
$user="ctssmuk";
$hspw="hoNda313";
use Net::Telnet;
$cs = new Net::Telnet ( Host => $hostname, Timeout =>'35');
$cs ->login ($user, $hspw);
$|=1;
my @output1=$cs->cmd("echo $LOGIN_DIR $REMOTE_LOGIN_DIR $FILENAME
$MORE_LOGIN_DIR $MORE_REMOTE_LOGIN_DIR");
print @output1;
print "\n";
$cs ->close;
************************************************************
Here is the output:
**********************************************************************
inawk77:/u/ctssmuk> unsectosecHS.pl
What is the name of the CLIENT? This is usually in Caps. Please enter
in Capitals
BANC_ONE
bancone
ftp files from /u/ctssmuk/web/prod/netx/BANC_ONE/unsecure-html
to /u/prod/web/prod/netx/BANC_ONE/secure-html
and ftp files from /u/ctssmuk/web/prod/netx/BANC_ONE/unsecure-
html/bancone
to /u/prod/web/prod/netx/BANC_ONE/secure-html/bancone
Enter the name of the file
testfile
testfile
/u/prod/web/prod/netx/BANC_ONE/secure-html/bancone
/u/ctssmuk/web/prod/netx/BANC_ONE/unsecure-
html /u/prod/web/prod/netx/BANC_ONE/secure-html
testfile /u/ctssmuk/web/prod/netx/BANC_ON
E/unsecure-html/bancone
inawk77:/u/ctssmuk> /u/prod/web/prod/netx/BANC_ONE/secure-html/bancone
ksh: /u/prod/web/prod/netx/BANC_ONE/secure-html/bancone: cannot execute
inawk77:/u/ctssmuk>
inawk77:/u/ctssmuk>
It breaks up the line in in echo and wants to execute the last line as
ksh command.
Any advice is appreciated.
Sent via Deja.com
http://www.deja.com/
------------------------------
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 5102
**************************************