[17482] in Perl-Users-Digest
Perl-Users Digest, Issue: 4902 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 16 11:05:47 2000
Date: Thu, 16 Nov 2000 08:05:08 -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: <974390708-v9-i4902@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 16 Nov 2000 Volume: 9 Number: 4902
Today's topics:
A silly. Substitution - s/// ishulz@lycosmail.com
A silly. Substitution - s/// ishulz@lycosmail.com
Re: A silly. Substitution - s/// <bart.lateur@skynet.be>
Re: about .htaccess (phil)
Re: Batch inserting into Oracle with Perl <prlawrence@lehigh.edu>
Re: beginner question regarding extracting email body w (Tad McClellan)
Re: cookies fetch returns an empty hash (Rafael Garcia-Suarez)
Re: Date <bart.lateur@skynet.be>
Re: Device driver via perl? <eric@urbanrage.com>
Extracting data from a string <jmilley@tera.engr.mun.ca>
Re: Finer points of lists, etc. <ren.maddox@tivoli.com>
HELP: cookies, LWP and cache control!!!! <artax@shineline.it>
How do you redirect to download a file? <sladb69@magma.ca>
Re: How to get client address from accept() (bowman)
Re: IP geography <lmoran@wtsg.com>
Re: NEWBIE:HTTPS connections using PERL <eric@urbanrage.com>
Re: No idea about perl, Long post, short question (Randal L. Schwartz)
Re: No idea about perl, Long post, short question (Randal L. Schwartz)
Re: No idea about perl, Long post, short question <mjcarman@home.com>
Re: Prevent web page time out during CGI execution? (Randal L. Schwartz)
Re: sleep & $anything question (Garry Williams)
What is "Use of uninitialized value in subroutine entry <ishark@lsh01.univ-lille1.fr>
Re: Where are param and redirect defined (Rafael Garcia-Suarez)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 16 Nov 2000 14:09:54 GMT
From: ishulz@lycosmail.com
Subject: A silly. Substitution - s///
Message-Id: <8v0pre$al5$1@nnrp1.deja.com>
How is it possible to reduce number of subsequent symbols? For example
how to replace each 5 identical symbols with only 2 of them, like this:
Input: This is oone exxxxxample 111111111
Output: This is oone exxxample 111
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 16 Nov 2000 14:10:41 GMT
From: ishulz@lycosmail.com
Subject: A silly. Substitution - s///
Message-Id: <8v0pss$an6$1@nnrp1.deja.com>
How is it possible to reduce number of subsequent symbols? For example
how to replace each 5 identical symbols with only 2 of them, like this:
Input: This is oone exxxxxample 111111111
Output: This is oone exxample 111
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 16 Nov 2000 14:29:10 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: A silly. Substitution - s///
Message-Id: <rer71t8u720vq16k95tqi7p8rmjoe5pv77@4ax.com>
ishulz@lycosmail.com wrote:
>How is it possible to reduce number of subsequent symbols? For example
>how to replace each 5 identical symbols with only 2 of them, like this:
>
>Input: This is oone exxxxxample 111111111
>
>Output: This is oone exxample 111
s/(.)\1\1\1\1/$1$1/g;
But your example isn't right. You've got nine 1's in a row, so (5+4)
will leave 2+4 = 6.
This is oone exxample 111111
You can add a '+' to eat all remainders:
s/(.)\1\1\1\1+/$1$1/g;
-->
This is oone exxample 11
If you want to reduce it to just one instance: tr/// with the /s option
(for "single") is designed for that.
tr/\000-\377//s;
-->
This is one example 1
--
Bart.
------------------------------
Date: 16 Nov 2000 15:33:42 GMT
From: phil@RedBrick.DCU.IE (phil)
Subject: Re: about .htaccess
Message-Id: <slrn917rrl.v2e.phil@Enigma.RedBrick.DCU.IE>
Sam Tsui -[sam@cplhk.com]- spewed forth
the following lines of wisdom:
>Hi,
>
>I have several question about .htaccess
>
>1. Is it possible to update the password of .htaccess by CGI from Web?
Nearly anything is possible, however it's a pain in the ass.
>2. If yes, How? How could I dump the password to .htaccess?
It depends what scripting language you are using. You could run htpasswd, if
you had an expect script you could do it like that
>3. If yes, must my CGI run as 'root'?
No, if you have suEXEC installed on the system and the CGI runs as the user of
the account, then no. Otherwise it has to run as a priviledged user, yes.
I would advise looking into other methods of authentication which are more
portable and generally better and securer than htaccess.
Phil.
------------------------------
Date: Thu, 16 Nov 2000 09:00:17 -0500
From: "Phil R Lawrence" <prlawrence@lehigh.edu>
Subject: Re: Batch inserting into Oracle with Perl
Message-Id: <8v0p9i$ev4@fidoii.CC.Lehigh.EDU>
Not sure what a "batch insert" is... please post what you find out.
Meanwhile I might be able to help you speed up your current attempt. Please
post the code so we can all see what you're doing...
Phil R Lawrence
<davewang168@my-deja.com> wrote in message
news:8uv6u1$3ks$1@nnrp1.deja.com...
> Hi,
>
> I am building a simple web log parsing program that will insert the IP
> addresses of my users into an Oracle 8i database.
>
> I've tried the obvious: "insert into IPtable (IP) values ($IP)"
>
> .. and it takes forever to go through a 10mb log file.
>
> I've heard there's a faster way to do this using batch inserts. Has
> anyone had experience doing something similar? If so, I'd greatly
> appreciate any tips.
>
> Thanks!
> David
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Thu, 16 Nov 2000 09:42:07 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: beginner question regarding extracting email body with regexp
Message-Id: <slrn91802f.rl.tadmc@maxim.metronet.com>
On Tue, 14 Nov 2000 20:40:48 +0000 (UTC), Debian User
<damajah@kzahq.ath.cx> wrote:
>Hi, I am trying to learn perl by starting with a simple email client,
>I can extract the From and Subject ok like this:
That will only be OK if the matches succeed.
It may be that you are certain that the pattern matches will
_always_ succeed, as they should with valid headers.
But it is better if your program is prepared to handle broken headers.
>#!/usr/bin/perl
You should ask for all the help that you can get.
Turning on warnings and strictures will have perl find many
common programming mistakes for you.
#!/usr/bin/perl
use strict;
"use strict" requires that you declare all of the variables that
you use. This is a Good Thing. You declare your variables with
the my() operator.
For more info:
perldoc strict
perldoc -f my
>while (<STDIN>) {
This reads *one line* into $_.
> ($from) = /^From: (.+)$/;
That will set $from when you happen to be processing the From: line,
but when you process any other line, $from will get set to undef
(because that's what happens when a pattern match fails).
$from = $1 if /^From: (.+)$/;
Now $from won't get reset when you are processing a Subject: line
for example.
Your way will also use the "wrong" From: if there happens to be
a line in the _body_ that starts with From: (like a forwarded
email message for instance).
>Then I try and get the body, which I can't do. Now this program reads
>standard mailbox format files, a single message at a time
>from stdin, so I want to read from the first line following a line
>where \n is the first character up till eof.
>
>Heres what I tried but it doesn't work:
>
> ($body) = split(/^\n/s, $_, 1);
This has a bunch of things wrong.
Since you have only read a single line, there can only be one newline,
so split must always return either 1 element (for non-blank lines) or
0 elements (for blank lines).
The //s option is worthless there and not needed.
The //s option only affects the dot metacharacter. Since you do
not have a dot character in your pattern, it has no effect. So
it shouldn't be there.
>I also tried this:
>
> ($body) =~ m/^\n (.+)/s;
This is trying to match against the string in $body, but I don't
think you have put a string in there. So that won't work either.
>Please don't laugh, I am only learning :)
Maybe having a complete program to start with would help. Here's one:
----------------------------------
#!/usr/bin/perl -w
use strict;
{
local $/; # set "slurp mode" (see perlvar.pod)
$_ = <STDIN>; # get _all_ of the lines into a single scalar
}
my($headers, $body) = split(/\n\n/, $_, 2);
my $from = $1 if $headers =~ /^From: (.*)/m;
my $subject = $1 if $headers =~ /^Subject: (.*)/m;
print "message from '$from' about '$subject':\n";
print "body:\n$body\n\n";
----------------------------------
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 16 Nov 2000 14:14:14 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: cookies fetch returns an empty hash
Message-Id: <slrn917quj.3ik.rgarciasuarez@rafael.kazibao.net>
Eugene Vekua wrote in comp.lang.perl.misc:
>In article <slrn915g4i.1cm.rgarciasuarez@rafael.kazibao.net>,
> rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:
>> examining the contents of $ENV{'HTTP_COOKIE'}. If it's empty, the
>> problem is with the code that sets the cookies.
>
>I am using f.e 'auth.cgi' to set cookie. If I am checking HTTP_COOKIE
>from this 'auth.cgi' it returns correct value, but after redirection
>to 'config.cgi' it returns nothing.
>Is cookie somehow tide to the source cgi?
Cookies are tied to a domain and a path. For example, a cookie tied to
foo.com and to the path /a/b will be send to all urls requested by the
browser in the domain foo.com and that begin with /a/b
(http://foo.com/a/b/...). Thus, it's possible to tie a cookie to a
single CGI program, but it must be explicitly specified in the code.
The HTTP_COOKIE environment variable contains the contents of the Cookie
headers sent by the browser while requesting the document -- this
document being a static html page, a server-side parsed html document, a
CGI program, a PHP page, an image, etc. etc.
If HTTP_COOKIE is defined for auth.cgi, that means that the browser sent
it to the server while requesting auth.cgi, hence before auth.cgi was
executed.
BTW it's really a discussion for comp.infosystems.www.authoring.cgi now.
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Thu, 16 Nov 2000 14:08:29 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Date
Message-Id: <ieq71t8n7irbre48vhc7r9je3q04ps1pav@4ax.com>
ameen @ dausha . net (Ameen Dausha) wrote:
>Yes, buy with localtime don't you need to incriment the month and day?
>Don't you need to handle the fact that this is Perl Year 100? Granted,
>that can be handled by adding a few lines of code, but:
A few lines of code?
@now = localtime;
$today = sprintf "%02d/%02d/%02d", 1+$now[4], $now[3], $now[5]%100;
I fail to see the "few lines" here.
--
Bart.
------------------------------
Date: Thu, 16 Nov 2000 09:47:56 -0600
From: eric <eric@urbanrage.com>
Subject: Re: Device driver via perl?
Message-Id: <3A1401AB.910D15A1@urbanrage.com>
Christian Meisl wrote:
>
> I have an interface card and a small c++ program that tests the card:
>
> #include <stdio.h>
> #include <unistd.h>
> #include <asm/io.h>
> #define adr 0x0300
>
> int main()
> {
> iopl(3);
> outb(128,adr+3);
> outb(155,adr+7);
> outb(255,adr);
> outb(255,adr+1);
> }
>
> The two "255" values are the codes for the actions of the card and
> should be variable.
>
> Now I would like to write a simple Perl/Tk program that offers 16
> switches (one for each bit of the adr/adr+1 word) and calls the above
> code (that should be rewritten in Perl, as well).
>
> Is that possible, and how can I do that?
well I'm not sure how good perl is at inline assembly so I am guessing
you won't be able to do a direct code replacement for the above (outb is
an inline asm macro out_8).
what you can do is write it as a function and make a package to
interface to the c function and then write your perl/tk program with
that package.
make a small header file for your function including input parameters
then use h2xs to create your base package.
Hope this helps,
Eric
eric@urbanrage.com
Brainbench MVP for Unix Programming
http://www.brainbench.com
P.S.
a good book to read on this is (jaguar) advanced perl programming
good man pages are perlxs perlxstut perlguts
------------------------------
Date: 16 Nov 2000 15:51:35 GMT
From: Jonathan MILLEY <jmilley@tera.engr.mun.ca>
Subject: Extracting data from a string
Message-Id: <8v0vq7$mqn$1@coranto.ucs.mun.ca>
I'm kind of new to perl, but I', getting the hang of it.
My question pertains to extracting information from a string.
Example I'm parseing an HTML file and I want to get the title, so
I look for the line with <TITLE> in it, and I want to extract everything
between <TITLE> and </TITLE> is there an easy way to accomplish this?
Any and all help is appreciated,
Jon
=================================================================
Jonathan Milley jmilley@engr.mun.ca CE Class of 2003
Memorial University of Newfoundland
St. John's, Newfoundland, Canada
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Visit my website @ http://jmilley.cjb.net
=================================================================
------------------------------
Date: 16 Nov 2000 09:11:22 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Finer points of lists, etc.
Message-Id: <m33dgsdk9x.fsf@dhcp11-177.support.tivoli.com>
Jeff Ross <jeffross@bendcable.com> writes:
> Sort of a newbie stuck on list and string nuances.
>
> @MyList = (30188, $A01, 3644, $A02, 4080, $B03, 2976, $B09, 2912)
>
> I want to take this list (above) and make the $# equal to the value on
> its left side. I then want to print the results to a text file. My
> results should look like this:
>
> $A01 = 30188
> $A02 = 3644
> $B03 = 2976
> $B09 = 2912
You want a hash.
But you've got your data a little confused. You say you want $A01 to
be associated with 30188, which is what comes before it. But starting
at $B03, you've used what comes *after* instead. So you skipped the
4080 value in the middle.
Once you get that straightened out, then you can simply assign the
list to a hash, either after reversing it or not depending on whether
you really have the values before the keys or after.
Something like:
@MyList = (30188, $A01, 3644, $A02, 2976, $B03, 2912, $B09);
%hash = reverse @MyList;
print "$_ = $hash{$_}\n" for sort keys %hash;
Though, of course, all those $A01 type constructs are variables that
may or may not have values. If you really want the literal $A01 to
print, you will need to quote them in the assignment to @MyList. The
easiest way to do that is:
@MyList = qw(30188 $A01 3644 $A02 2976 $B03 2912 $B09);
Of course, you've probably already got them assigned to the list with
other code, so this shouldn't matter.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Thu, 16 Nov 2000 16:29:31 +0100
From: "Federico" <artax@shineline.it>
Subject: HELP: cookies, LWP and cache control!!!!
Message-Id: <3a13ffea_1@news.telnetwork.it>
Hi all,
I have a big problem and no idea how to solve it. I would be very happy
is somebody could catch this little challenge and give me an help.
The problem is the following: I have to download a page using the perl
module LWP (the URL change at every request) ans its address could be this
one:
http://service.bfast.com/bfast/click?bfmid=1921220&siteid=35414878&bfpid=086
162036941&bfmtype=movies If you try with IE or Netscape you could raalize
that (and maybe this is one of the causes of the problem!) before you obtain
the answer page there will be TWO rediretcs. Anyway using the browser all
work correctly.
On the countrary usind the metod GET with the Perl module LWP:
use LWP::UserAgent;
my($interfaccia) = new LWP::UserAgent;
my($richiesta);
$interfaccia->agent('Mozilla/5.0');
$interfaccia->timeout(30);
$richiesta=HTTP::Request-> new('GET' =>
'http://service.bfast.com/bfast/click?bfmid=1921220&siteid=35414878&bfpid=08
6162036941&bfmtype=movies' );
$richiesta->content_type('application/x-www-form-urlencoded');
$risultato = $interfaccia->request($richiesta);
$temp = $risultato->as_string;
print $temp;
(it could be i have done mistakes or fogotten something coping the code, but
the original one is correct it works well with all the other addreses)
you will botain an ERROR MESSAGE from the host server of this kind (this is
the print of the headers):
HTTP/1.1 200 OKCache-Control: no-cacheConnection: Keep-AliveDate: Thu, 16
Nov 2000 12:23:29 GMTPragma: no-cachePragma: no-cacheServer:
Microsoft-IIS/5.0Content-Length: 19386Content-Type: text/htmlContent-Type:
text/html; charset=windows-1252Expires: Thu, 01 Dec 1994 16:00:00
GMTExpires: Wed, 11 Aug 1999 07:00:00 GMTExpires: 0Client-Date: Thu, 16 Nov
2000 12:23:30 GMTClient-Peer: 199.2.223.1:80Set-Cookie:
SITESERVER=ID=83d9b27a6d8d7e3e7e4e9f73e1540cc7; expires=Monday, 01-Jan-2035
00:00:00 GMT; path=/; domain=.800.comTitle: Incorrect Access Permission
What i can understand is that the remote server does a cookies cache control
and since the module LWP hasn't this function the server returns an error.
Does somebody know how to solve this problem?
I have tried to lunch two requests: the first to obtain a cookies-set
and the second one with the cookies-set just obtained to get the wanted
response page without the cache controll considering that the cookies were
already present. I have done it adding before the previus code this
instructions
use HTTP::Cookies;
my($biscottino) = new HTTP::Cookies;
and after the same previus code
$biscottino->add_cookie_header($richiesta);
$risultato = $interfaccia->request($richiesta);
$temp=$risultato->as_string.$temp;
but it doesn't work!
Please if somebody knows how to solve this problem ... could it write me
at artax@shineline.it ???
Thank you, sorry for my terrible english, from italy ^_^
Federico Bari.
------------------------------
Date: Thu, 16 Nov 2000 14:09:42 GMT
From: Scott Thornton <sladb69@magma.ca>
Subject: How do you redirect to download a file?
Message-Id: <3A13EAB8.497F96C1@magma.ca>
Just say I have a simple page with 1 button on it saying 'Download
Now'. When I click this button I want to do two things:
(1) add client information to a log file
(2) go ahead with the download.
Basically I want it to work exactly like a normal download link in HTML,
but also log the event. How do I, in PERL pass on information to the
browser to tell it to start downloading a file immediatley? You know
like those pages where it has the message, 'If your file does not start
downloading in 5 seconds, click here...'. I have tried using 'Location:
http://127.0.0.1/somefile.exe ' as the first line in my HTML output, and
it does cause the browser to attempt a download but it comes back with
the message, ' Trying to download a file of type */* ...'. Huh?
Can somebody help me out with this, what seems to me a remedial question
that I just can't seem to wrap my head around.
Thank you in advance,
Scott
------------------------------
Date: Thu, 16 Nov 2000 14:30:15 GMT
From: bowman@news.montana.com (bowman)
Subject: Re: How to get client address from accept()
Message-Id: <slrn917sel.umq.bowman@localhost.localdomain>
Nick Condon <nickco3@yahoo.co.uk> wrote:
!The client's IP address is in $iaddr, $name contains the client's
!hostname, $port is the originating port (probably not very interesting).
Just as a footnote: it is possible for the client to designate a port and
bind it, rather than using a ephemeral port assigned by the OS. This
technique is sometimes used so the server can examine the client's port
for authentication purposes.
------------------------------
Date: Thu, 16 Nov 2000 11:00:59 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: IP geography
Message-Id: <t4181t4radbl9q36ioufkda2v8gucn99m4@4ax.com>
On Tue, 14 Nov 2000 03:13:32 GMT, cfedde@fedde.littleton.co.us (Chris
Fedde) wrote wonderful things about sparkplugs:
>In article <8uprqv$n1n$1@nnrp1.deja.com>, <tcblue@my-deja.com> wrote:
>>Hi,
>>does any know if there is a perl module or script that can 'try' and
>>detect the physical location of a given IP address or hostname? I
>>found this site that gives a pretty good description of how to make an
>>educated guess on it. I know there is no real solid way of doing this,
>>but i'd like to start collecting geographical information of IP
>>address. please let me know If you have any ideas or if there is
>>already something out there that does this. Thanks,
>>
>
>package IP::Location
>
>sub loc
>{
> return "98.9% probability that $_[0] is within 20037.54 km of Tucson AZ US";
>}
I must steal this for my sig! Pure genius.
>
>It's realy hard to do much better.
"Ow, ow, stupid trash, rotten, stinky, hate world, revenge soon,
take out on everyone..."
lmoran@wtsg.com
------------------------------
Date: Thu, 16 Nov 2000 10:01:26 -0600
From: eric <eric@urbanrage.com>
Subject: Re: NEWBIE:HTTPS connections using PERL
Message-Id: <3A1404D6.AEA9E589@urbanrage.com>
manav agarwal wrote:
>
> Hi,
>
> I'm new to Perl and was wondering if there are any modules that I can
> use to get data from an HTTPS server.
>
> thanks in advance.
> Manav Agarwal
> manav_a@yahoo.com
you need Crypt::SSLeay, LWP and HTTP
small example (probably not most efficient, but works)
use LWP::UserAgent;
use HTTP::Request;
my $user_agent = new LWP::UserAgent;
$user_agent->agent("MyProg/1.0" . $user_agent->agent);
my $request = new HTTP::Request(POST =>
"https://secure.domain.com/cgi-bin/info.pl");
$request->content_type('application/x-www-form-urlencoded');
$request->content("user=joe\&pass=joe"); #parameters to pass
my $response = $user_agent->request($request);
if (!($reponse->is_success)) {
print "error on request: $response->as_string\n";
exit;
}
# otherwise it worked
LWP uses Crypt::SSLeay to do the secure transaction
LWP is nice because it handles pretty much any url (http, https, ftp,
...)
If you don't have it you'll probably want to do the bundle install via
cpan as you end up downloading about 6 modules that it relies on.
Hope this helps,
Eric
eric@urbanrage.com
Brainbench MVP for Unix Programming
http://www.brainbench.com
------------------------------
Date: 16 Nov 2000 06:26:00 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: No idea about perl, Long post, short question
Message-Id: <m1aeb0ngcn.fsf@halfdome.holdit.com>
>>>>> "Simon" == Simon Watkins <siwatkins@iee.org> writes:
>> The key in that sentence was 'stealth'. Nowhere in your message did
>> you _state_ that you sent an email copy as well as a post to the
>> newsgroup. Especially since mail normally propagates faster than
>> Usenet feeds, that is very annoying.
Simon> I explained my reasons. There was no "stealth" involved. This
Simon> really is a petty issue, and I suggest that if you wish to
Simon> continue to debate it, please take it to email.
Just to clarify once more since you seem to still be missing this
clue:
A stealth CC is a CC'ed copy of a news posting that IS NOT MARKED AS
SUCH, and causes grief for those of us who are obsessive answerers
of questions since we don't know that the response will also be seen
by the millions of people who are also reading the group, and feel
it is our obligation to answer personally.
You sir, did not mark your CC as a "courtesy mail copy of a posting".
That differs from my response to you, which *WAS* marked as such. (Go
back and check, as is THIS one.)
I respect that you are new in the group, and do not know all the
customs here. I'm just amazed you violated so many of them at once on
your first posting. That could be a new record! :)
This also means you don't understand Usenet in general, where you are
supposed to read a group for a few weeks before your first posting, to
understand the culture and players. There's another free clue for
you, so you won't have this culture shock in your next online
discussion area.
It's not about making everyone the same. It's about making everyone
compatible, though.
In particular, CLPM posters have a disdain for being a replacement
help desk for a commercial software, *and* for being requested to
provide substitute brains for helping someone out who really just
would be better off hiring a consultant. You triggered both of those
in one post, and that's what I pointed out. And then you
stealth-CC'ed and upside-down posted (two more culture violations), so
my "lack of clue" meter pegged, and it was time for me to keep talking
about it in public, to innoculate the rest of the group from you. :)
print "Just another Perl hacker,"
--
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 Nov 2000 06:31:31 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: No idea about perl, Long post, short question
Message-Id: <m13dgsng3g.fsf@halfdome.holdit.com>
>>>>> "Simon" == Simon Watkins <siwatkins@iee.org> writes:
Simon> I am trying to customize a low budget product for a charity
Simon> trust that provides Kidney Dialysis support and vacations for
Simon> those with such a need. I simply wish to be able to implement
Simon> the fix (which I have established) in a technology area that I
Simon> am not familiar with.
Then this is how your post could have read to get maximum impact and
minimum offense:
I have a commercial piece of software that I'm taking beyond its
original design, so the original creators won't help. I know very
little Perl, and do not have time to become an expert, but I'm
also working on a non-profit project, and do not have cash to hire
a consultant.
So I'm looking for some private consulting for free. Is anyone
here willing to do some consulting for free for a good cause?
Please reply to me via email.
There. Plain and simple, I think that's what you're asking for.
"consulting for free" is not what Usenet's about. Maybe that's where
you got confused. :)
--
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: Thu, 16 Nov 2000 08:26:48 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: No idea about perl, Long post, short question
Message-Id: <3A13EEA8.61E5ADFF@home.com>
Simon Watkins wrote:
>
> Logan Shaw <logan@cs.utexas.edu> wrote:
>> Simon Watkins <siwatkins@iee.org> wrote:
>>>
>>> How can I amend a perl file that generates html to write the tag
>>> <base href="someurl/acatalog/">
>>
>> Well, you could insert
>>
>> print '<base href="someurl/acatalog/">';
>>
>> somewhere in the script.
>>
>> Of course, that might not work, but since you've given no specifics
>> at all about your problem, I can't predict what will work.
>
> Sorry about that - I didn't want to swamp my initial request with
> too much detail. But thank you for your assistance. I'll try and
> identify the problem a little more....
Heh. Five lines of code is better than fifty of text when it comes to
this newsgroup.
Simon, you probably don't think that we here are very helpful, but we do
try to be. The problem is that your post set off warning buzzers for a
lot of the old timers. Your question was simple, and Logan's answer is
about the best that anyone here can do. Actually, your question was too
simple -- if you don't know enough Perl to figure out on your own that
you need to add a print() statement, you don't stand much of a chance of
figuring out the most important part: where to put it. The most helpful
advice that I can add is to look through the code for the part that
seems to be creating the section of HTML where you want to add the
<base> tag, and stick it in there.
Moving off-topic, there are some things about the nature of this group
that you'll pick up on if you lurk for a while. Here are some of the
most important (IMHO) points:
1) We like to help people who have made a genuine effort to help
themselves first. We despise those to lazy to try.
2) Many of the people her make their living from their expertise in
Perl. While they're happy to provide assistance to another Perl person
who's stuck, they do *not* want to provide free consulting for a
commercial project to someone who obviously doesn't know Perl. By doing
so, they could be putting another programmer (or even themselves) out of
work. The general philosophy is "If you're getting paid to do X, then
you should know how to do X. If you don't, you should hire someone who
does."
3) Don't respond to posts upside-down. It drives people here batty and
you'll lose tons of credibility. Don't use k3wl spelling either, dood!
:)
4) Think twice before asking a CGI question here. Then think again. Most
CGI questions have nothing to do with Perl -- even if written in Perl!
The people who ask them don't seem to realize this, and that also drives
the locals batty.
Get those down, and you'll be welcomed with open arms and find this to
be a very friendly and helpful place. Welcome.
-mjc
------------------------------
Date: 16 Nov 2000 06:33:26 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Prevent web page time out during CGI execution?
Message-Id: <m1vgtom1ft.fsf@halfdome.holdit.com>
>>>>> "stimpiton" == stimpiton <stimpiton@my-deja.com> writes:
stimpiton> Is there a way to prevent a web page from timeing out during a CGI
stimpiton> execution?
stimpiton> I have a script that can take quite a long time (3-5 minute) to
stimpiton> compleate each step.
stimpiton> It does a foreach loop to relable backup tapes and the relabling can
stimpiton> take awile and the page times out but the script still runs.
stimpiton> Can I tell the page not to time out?
http://www.stonehenge.com/merlyn/WebTechniques/col20.html
--
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: Thu, 16 Nov 2000 15:41:41 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: sleep & $anything question
Message-Id: <VeTQ5.675$xb1.40768@eagle.america.net>
On Thu, 16 Nov 2000 13:52:01 -0000, Geoff Winkless
<geoff-at-farmline-dot-com@127.0.0.1> wrote:
>"Neil Cherry" <njc@CC47532-A.ewndsr1.nj.home.com> wrote in message
>news:slrn917php.qk1.njc@CC47532-A.ewndsr1.nj.home.com...
>> On Thu, 16 Nov 2000 05:09:42 GMT, Gwyn Judd wrote:
>> >I was shocked! How could Neil Cherry <njc@CC47532-A.ewndsr1.nj.home.com>
>> >say such a terrible thing:
>> >>I have a bit of a weird problem with sleep. I tried the follwoing code
>> >>under Linux (I suspect Windows would be the same):
>> >>
>> >>$Tb = 30;
>> >>
>> >>sleep( $Tb );
>> >>
>> >>This immediately returns instead of sleeping for 30 seconds.
>> >
>> >Are you sure? It works okay for me. Is that cut and pasted from your
>> >actual code?
>>
>> I'll try it again in my program, I just tried it from stdin and it
>> worked like you said. Strange! If it works in my program then we'll
>> just consider it a typo and a late night.
>
>The only thing to check for is if anything would have sent a siglarm to the
>process.
Actually, *any* (caught) signal will cause the sleep function to
return. From the perlfunc manual page:
Causes the script to sleep for EXPR seconds, or forever if no
EXPR. May be interrupted if the process receives a signal such as
`SIGALRM'.
which is not as clear as the sleep(3C) manual page:
DESCRIPTION
The current process is suspended from execution for the
number of seconds specified by the argument. The actual
suspension time may be less than that requested because any
caught signal will terminate the sleep() following execution
of that signal's catching routine.
--
Garry Williams
------------------------------
Date: 16 Nov 2000 15:57:41 +0100
From: Alberto BARSELLA <ishark@lsh01.univ-lille1.fr>
Subject: What is "Use of uninitialized value in subroutine entry"?
Message-Id: <m28zqkq80q.fsf@pcmaxwell.intec.rug.ac.be>
Hi all,
one of my old programs has stopped working. In a fairly
"hard" way, actually. It's inside an HTML parser, a very simple
class derived from HTML::Parser. Basically it's identical to the
example from "man HTML::Parser", with the addition of 'new':
package MyParser;
use base 'HTML::Parser';
use strict;
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = $class->SUPER::new();
# [........ my initialization ......]
bless ($self, $class); # reconsecrate
return $self;
}
(no idea if $class->SUPER::new(); is correct. I can't find it in man
perlobj, but I certainly copied if from somewhere).
When I run the parser (again, in a way identical to the example) it
crashes with:
Use of uninitialized value in subroutine entry at MyParser.pm line 72, <GEN0> line 10814.
Segmentation fault (core dumped)
Line 72 is:
sub text {
print "text: " . join(',', @_) . "\n";
my $self = attr shift; # <----- this is line 72!!!
my ($origtext, $is_cdata) = @_;
[...........]
}
Which seems to indicate that 'attr shift' is killing the whole thing.
The print just before it, which I added to see if anything weird was
being passed, just prints:
text: MyParser=HASH(0x8302420),
,
not much for $origtext and $is_csdata, but at least the hash does not
point into neverland.
I don't think I'm using alias in any weird way, I put a:
use Alias qw(attr);
use vars qw($var1 $var2 ....etc.etc...);
at the top of my class definition (just before new).
I've grepped the perl doc for the error message, but I can't find it.
In any case the SEGV means that there's something real bad going on.
I've tried to remove the attr shift from the "text" subroutine, but then
it just crashes when entering "end" (which has an attr shift). Is
there some known problem with Alias? Should I remove it?
Any idea is welcome....
Thanks,
Alberto
--
Alberto BARSELLA
PGP fingerprint = 13 3F 22 D2 0B 0A D3 25 F1 89 FE B5 82 AD 75 2A
** Beliefs are dangerous. Beliefs allow the mind to stop functioning.
A non-functioning mind is clinically dead. Believe in nothing... **
------------------------------
Date: Thu, 16 Nov 2000 14:06:43 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Where are param and redirect defined
Message-Id: <slrn917qgh.3i7.rgarciasuarez@rafael.kazibao.net>
Scott Thornton wrote in comp.lang.perl.misc:
>I have seen in a few examples in the newsgroups the use of param and
>redirect. Where are they defined? They are not part of the original
>PERL language, or at least they are not listed in the man pages.
at the prompt :
perldoc CGI
and, BTW, it's "Perl", not "PERL".
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
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 4902
**************************************