[18269] in Perl-Users-Digest
Perl-Users Digest, Issue: 437 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 7 18:05:52 2001
Date: Wed, 7 Mar 2001 15:05:24 -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: <984006323-v10-i437@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 7 Mar 2001 Volume: 10 Number: 437
Today's topics:
Re: "uninitiatlized value" errors? (John Joseph Trammell)
Re: (Linux beginner) How to de-install and re-install P <gellyfish@gellyfish.com>
[newbie] How to take parameters into the script? <ckzchang02@home.com>
Re: [newbie] How to take parameters into the script? <shanem@ll.mit.edu>
Re: adding a directories files to an array david_kershaw@merck.com
Re: Am I a naughty perl coder? <parrot0123@yahoo.ca>
Re: Am I a naughty perl coder? <bart.lateur@skynet.be>
Re: Am I a naughty perl coder? <andras@mortgagestats.com>
Re: Am I a naughty perl coder? <shanem@ll.mit.edu>
Backreferencing in ()*-like patterns (LMC)
Re: Backreferencing in ()*-like patterns <elijah@workspot.net>
Re: Backreferencing in ()*-like patterns (Abigail)
Re: Backreferencing in ()*-like patterns nobull@mail.com
Re: creating dos exectable from perl script (Arek P)
Re: creating dos exectable from perl script (Malcolm Dew-Jones)
DeCSS in Perl <ubl@schaffhausen.de>
Re: Defining Global Script Variables nobull@mail.com
Detecting User Country in CGI Script (MartelLM)
Re: Detecting User Country in CGI Script <juex@deja.com>
Re: Detecting User Country in CGI Script <shanem@ll.mit.edu>
Re: Detecting User Country in CGI Script nobull@mail.com
Re: Detecting User Country in CGI Script <bart.lateur@skynet.be>
Re: Detecting User Country in CGI Script <andras@mortgagestats.com>
Re: FAQ 5.4: How do I make a temporary file name? <mischief@velma.motion.net>
Re: flock and close with empty read strangeness <gellyfish@gellyfish.com>
Re: general documentation about computer languages; as <shanem@ll.mit.edu>
general documentation about computer languages; as moti (Walter Tautz [MFCF])
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 07 Mar 2001 22:59:42 GMT
From: trammell@bayazid.hypersloth.net (John Joseph Trammell)
Subject: Re: "uninitiatlized value" errors?
Message-Id: <slrn9add38.nv5.trammell@bayazid.hypersloth.net>
On Wed, 7 Mar 2001 10:24:17 -0500, John A. Grant wrote:
> I'm using "strict" and "perl -c" is ok. My program works fine,
> but when I use -w, I get these warnings. Even with "diagnostics",
> I don't understand it.
Can I recommend 'use diagnostics -verbose;'?
> 1547: my $lastslash=rindex($filename,"/");
> 1548: if($lastslash){
> Use of uninitialized value in rindex at contact.cgi line 1547.
> Use of uninitialized value in substr at contact.cgi line 1548.
The messages mean that $filename and $lastslash are undefined.
Where did $filename come from?
> On reflection, I see I've used both "==" and "eq" in my program.
> for strings, i.e.:
> if($xxx=="hello")
> if($xxx eq "hello")
Operator '==' tests for numerical equality, 'eq' for stringwise.
Try these:
print "bar\n" if "12.000" == "12";
print "baz\n" if "12.000" eq "12";
Your "$xxx == 'hello'" should have generated a warning too.
> Also, how do I redirect the "-w" output to a file?
Depends on how your shell redirects STDOUT.
------------------------------
Date: 7 Mar 2001 21:02:28 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: (Linux beginner) How to de-install and re-install Perl on Linux
Message-Id: <9867l4$eib$1@orpheus.gellyfish.com>
On Wed, 7 Mar 2001 22:19:14 +1100 Martien Verbruggen wrote:
> On Tue, 6 Mar 2001 22:35:24 -0000,
> Garry Heaton <garry@heaton6.freeserve.co.uk> wrote:
>> I'm new to Linux/Unix and want to remove the default Perl installation, then
>> re-install from source code because I read somewhere that the Perl libraries
>> on some Linux distributions are incomplete. How do I remove and re-install?
>
> It's better to leave the original installed, otherwise all other
> packages managed by rpm will start whinging that you don't have perl
> installed (and that includes bind, for crying out loud!).
>
Wuss :)
/J\
--
Jonathan Stowe |
<http://www.gellyfish.com> | This space for rent
|
------------------------------
Date: Wed, 07 Mar 2001 21:47:07 GMT
From: "Andy" <ckzchang02@home.com>
Subject: [newbie] How to take parameters into the script?
Message-Id: <v%xp6.20555$V6.79746@news1.gvcl1.bc.home.com>
Hi,
say I have a script that will translate a morse code into an acsii code.
This script called "m2s" and i want this m2s to take 2 parameter at the
command when the script is activated. where parameter 1 is a file in mosrse
code, parameter 2 is the name of the file that the translated code is
stored. It looks like:
% m2s parameter1 parameter2
in case of both parameters are missing, the script will output a usage info.
If only one parameters, the script will assume its the file to read and
output the result (translated ascii code) to the screen.
Any help is greatly appreciated!
Andy
------------------------------
Date: Wed, 07 Mar 2001 17:16:05 -0500
From: Shane McDaniel <shanem@ll.mit.edu>
Subject: Re: [newbie] How to take parameters into the script?
Message-Id: <3AA6B325.858410D4@ll.mit.edu>
Instead of answering your question I think it would be best if you went
and read the subroutines section of a perl book. Nothing personal, but
the fact that you don't know this shows you haven't read enough.
I can't stress how important it is to _know_ perl and not just how to
hack together scripts. It'll save you in the end.
Andy wrote:
>
> Hi,
>
> say I have a script that will translate a morse code into an acsii code.
> This script called "m2s" and i want this m2s to take 2 parameter at the
> command when the script is activated. where parameter 1 is a file in mosrse
> code, parameter 2 is the name of the file that the translated code is
> stored. It looks like:
> % m2s parameter1 parameter2
>
> in case of both parameters are missing, the script will output a usage info.
> If only one parameters, the script will assume its the file to read and
> output the result (translated ascii code) to the screen.
>
> Any help is greatly appreciated!
>
> Andy
------------------------------
Date: Wed, 07 Mar 2001 14:23:21 -0500
From: david_kershaw@merck.com
Subject: Re: adding a directories files to an array
Message-Id: <3AA68AA9.7E325631@merck.com>
Here is some code to do this from the O'Reilly Perl Cook Book (p319).
opendir(DIR, $dirname) or die "can't opendir $dirname: $!";
while (defined($file = readdir(DIR))) {
# do something with "$dirname/$file"
}
instead of the while loop you can use this to weed out the '.' and '..'
files.
@files = grep {!/^\.\.?/} readdir(DIR);
The glob() function also does this but can become slow when processing
directories with mucho grande files. The above code is safer.
Hope this helps
Dave
Cliff Hodges wrote:
>
> I need to add a directories files to an array, so I can step through the
> files and add code to them. I have the code to search the individual files
> and add the code I just don't know how to add all the files in directory
> "messages" to an array. I am new at perl, any help will be greatly
> appreciated.
> Cliff
The contents of this message express only the sender's opinion.
This message does not necessarily reflect the policy or views of
my employer, Merck & Co., Inc. All responsibility for the statements
made in this Usenet posting resides solely and completely with the
sender.
------------------------------
Date: Wed, 07 Mar 2001 21:22:22 GMT
From: "Parrot" <parrot0123@yahoo.ca>
Subject: Re: Am I a naughty perl coder?
Message-Id: <iExp6.353405$f36.12243994@news20.bellglobal.com>
John Hall <jhall@ifxonline.com> wrote in message
news:lSup6.11304$o7.347896@news1.rdc1.sdca.home.com...
>
> One of the first pieces of code I 'borrowed' spit out html pages by using
> this method:
>
>
> _________________________________
> $text = <<HTML;
>
> <br><br>
> <font "arial">HTML goes here with embedded $variables etc... Doesn't need
to
> be "escaped" \ because as far as i can tell it's within a debugging
> function?</font><br><br>
>
> HTML
>
> print header();
> print $text;
> _________________________________
>
> So this works fine, but I can't really find a good description of what i'm
> actually doing in any of my books. It looks like i'm using some debugging
> stuff as actually part of the program? Is that correct? if so, should I
not
> do it? Or is it something that's been deprecated?
>
Oh boy, you see a message with that a subject like that and your mind just
runs with it! But, since I see that you are a male I'll put a stop to those
thoughts post haste! :)
What you've got there is a really nifty Perl shortcut called a Here
document. You can print multiple lines of text output without worrying
about semicolons and a new print command for each line. It will also accept
characters that your print statement normally wouldn't handle without using
special code references, and it will also recognize variables.
You can put the whole lines of text in a variable like the example you've
pasted - or more commonly just print out the whole lot. You use a label to
tell the program where the text ends. In the case you refered to the label
was 'HTML', but often people will use 'EOF' or 'END' - it can really be
whatever you want.
You can indent the text as you like, it won't matter in HTML output, but
you've got to make sure that your ending label is justified to the very left
in order for it to work properly. If you put it with a Print statement it
will look something like this:
print << "END";
The text I want to print goes here....
AND HERE....
OR WHEREVER!
END
Pretty cool, eh?
------------------------------
Date: Wed, 07 Mar 2001 21:46:01 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Am I a naughty perl coder?
Message-Id: <1uadatkb55ps3291l157oulrtu2srougf1@4ax.com>
Shane McDaniel wrote:
>The
>
><<HTML;
>......
>HTML
>
>is called a "here" document. Basically it prints everything between the
><<MYTITLE; and MYTITLE without using the print function.
Wrong. The here document syntax QUOTES a block of text, whole lines
only, and returns a string. You still need print() to actually print
anything.
my $q = <<HTML;
......
HTML
print "Nothing printed yet.\n";
print "My string is '$q'\n";
Note the line break just before the closing quote.
--
Bart.
------------------------------
Date: Wed, 07 Mar 2001 16:53:23 -0500
From: Andras Malatinszky <andras@mortgagestats.com>
Subject: Re: Am I a naughty perl coder?
Message-Id: <3AA6ADD3.560ECDAE@mortgagestats.com>
>
>
> John Hall wrote:
> >
> > One of the first pieces of code I 'borrowed' spit out html pages by using
> > this method:
> >
> > _________________________________
> > $text = <<HTML;
> >
> > <br><br>
> > <font "arial">HTML goes here with embedded $variables etc... Doesn't need to
> > be "escaped" \ because as far as i can tell it's within a debugging
> > function?</font><br><br>
> >
> > HTML
> >
> > print header();
> > print $text;
> > _________________________________
> >
> > So this works fine, but I can't really find a good description of what i'm
> > actually doing in any of my books. It looks like i'm using some debugging
> > stuff as actually part of the program? Is that correct? if so, should I not
> > do it? Or is it something that's been deprecated?
Shane McDaniel wrote:
> The
>
> <<HTML;
> ......
> HTML
>
> is called a "here" document. Basically it prints everything between the
> <<MYTITLE; and MYTITLE without using the print function. MYTITLE can be
> anything as long as it is the same in both spots, and the ; at the end
> of the firt MYTITLE is important.
No, the here document construct does not print anything. It's simply a quoting
mechanism.
------------------------------
Date: Wed, 07 Mar 2001 17:13:06 -0500
From: Shane McDaniel <shanem@ll.mit.edu>
Subject: Re: Am I a naughty perl coder?
Message-Id: <3AA6B272.DE3B901@ll.mit.edu>
yes, yes you are right. I'm so used to doing 'print <<HERE;' that I've
started integrating the two. But it's good for me to keep the seperated
as I hadn't actually thought about storing it into a var, or haven't
needed to.
thx
Bart Lateur wrote:
>
> Shane McDaniel wrote:
>
> >The
> >
> ><<HTML;
> >......
> >HTML
> >
> >is called a "here" document. Basically it prints everything between the
> ><<MYTITLE; and MYTITLE without using the print function.
>
> Wrong. The here document syntax QUOTES a block of text, whole lines
> only, and returns a string. You still need print() to actually print
> anything.
>
> my $q = <<HTML;
> ......
> HTML
> print "Nothing printed yet.\n";
> print "My string is '$q'\n";
>
> Note the line break just before the closing quote.
>
> --
> Bart.
------------------------------
Date: Wed, 07 Mar 2001 15:30:49 -0500
From: "Antoine Beaupre (LMC)" <lmcabea@lmc.ericsson.se>
Subject: Backreferencing in ()*-like patterns
Message-Id: <3AA69A79.4F1093D0@lmc.ericsson.se>
Hi.
I think this is probably a stupid question, but it's not covered in the
faq (at least from what I read..)
I was wondering wether it was possible to do a regexp pattern like:
/^([0-9]+)(-[0-9]+)*/
and access matches like: $1, $2, $3, $4, until there's no match...
In other words, instead of specifying precisly how many occurences of
"-[0-9]" I search for, just let the matching engine find as much as it
can and after reference each of this patterns seperatly....
Or:
/^.*-([0-9]+)(-([0-9]+)){0,4}/
or better:
/^.*-([0-9]+)(-([0-9]+))*/
instead of:
/^.*-([0-9]+)(-([0-9]+))?(-([0-9]+))?(-([0-9]+))?(-([0-9]+))?/
and then be able to reference $3, $5, $7...
I guess this is impossible with perl's current (or any?) re engine, but
I wanted to have confirmation or alternatives, etc...
I anyone wonders, this is obviously for version control, resolution of
conflict between multiple version of a package...
Thanks,
A.
--
La sémantique est la gravité de l'abstraction.
------------------------------
Date: 7 Mar 2001 21:26:01 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: Backreferencing in ()*-like patterns
Message-Id: <eli$0103071624@qz.little-neck.ny.us>
In comp.lang.perl.misc, Antoine Beaupre (LMC) <lmcabea@lmc.ericsson.se> wrote:
> I was wondering wether it was possible to do a regexp pattern like:
> /^([0-9]+)(-[0-9]+)*/
> and access matches like: $1, $2, $3, $4, until there's no match...
@matches = /( (?: - | ^ ) \d+ )/gx;
Then use $matches[0], $matches[1], etc.
/g find all matches
/x ignore whitespace (for readibility)
Elijah
------
or you could count the '-'s with tr/-/-/ and build an RE to use in an eval()
------------------------------
Date: 7 Mar 2001 21:30:49 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Backreferencing in ()*-like patterns
Message-Id: <slrn9ada49.q1s.abigail@tsathoggua.rlyeh.net>
Antoine Beaupre (LMC) (lmcabea@lmc.ericsson.se) wrote on MMDCCXLV
September MCMXCIII in <URL:news:3AA69A79.4F1093D0@lmc.ericsson.se>:
:} Hi.
:}
:} I think this is probably a stupid question, but it's not covered in the
:} faq (at least from what I read..)
:}
:} I was wondering wether it was possible to do a regexp pattern like:
:}
:} /^([0-9]+)(-[0-9]+)*/
:}
:} and access matches like: $1, $2, $3, $4, until there's no match...
Well, in general, I don't think your problem is solvable.
But for this particular regex, you can do things.
my @parts = split /(?=-)/ => $string;
That will fail if there is trailing garbage after the digits though.
And if you don't care about the dashes, you could just extract
the digits:
my @parts = $string =~ /\d+/g;
Although that will fail on something like "12-13-14 foobar 1234132".
But in both cases, you can fix the problem of trailing garbage:
$string =~ /^([0-9]+)(-[0-9]+)*/ and my @parts = $& =~ /\d+/g;
[ Interlude: headless people ranting about the use of $&, without even
knowing whether it's significant or not. ]
It would be nice if you could get all the submatches instead of just
the last one (when working with modifiers).
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$==-2449231+gm_julian_day+time);do{until($=<$#r){$_.=$r[$#r];$=-=$#r}for(;
!$r[--$#r];){}}while$=;$,="\x20";print+$_=>September=>MCMXCIII=>=>=>=>=>=>=>=>'
------------------------------
Date: 07 Mar 2001 21:19:30 +0000
From: nobull@mail.com
Subject: Re: Backreferencing in ()*-like patterns
Message-Id: <u9k861l1jx.fsf@wcl-l.bham.ac.uk>
"Antoine Beaupre (LMC)" <lmcabea@lmc.ericsson.se> writes:
> I think this is probably a stupid question, but it's not covered in the
> faq (at least from what I read..)
>
> I was wondering wether it was possible to do a regexp pattern like:
>
> /^([0-9]+)(-[0-9]+)*/
>
> and access matches like: $1, $2, $3, $4, until there's no match...
Not in one step. Bu one step is not always the most elegant.
/^([0-9]+(-[0-9]+)*)/
my @bits = split /-/ => $1;
> I guess this is impossible with perl's current (or any?) re engine, but
Actually since Perl's RE engine can now embed arbitrary code in the RE
you probably _could_ do it wiht a single RE - but it would not
result in readable code.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 7 Mar 2001 16:07:46 EST
From: Arek@nospam.tv (Arek P)
Subject: Re: creating dos exectable from perl script
Message-Id: <9867v2$1q05$1@earth.superlink.net>
On 06 Mar 2001 04:07:07 GMT, C J Sinha <cj@sinha.cncdsl.com> wrote:
Try perl2exe, which will compile Your .pl files into .exe allowing U
to run them without as stand alone apps;
Also PerlDev Kit from ActiveState.com has PerlApp utility that will do
the same, second being my choice.
>
>Greetings,
>I have written a small perl program which is very useful to my colleagues.
>When someone wants it, I have go over and install perl on their NT machines,
>so that they can run this script.
>
>I understand that it is possible to convert a perl script to a self
>contained .exe file that will run in windows/dos. That way I just pass
>along the .exe file and the do not have to install perl on their machine.
>
>Don't have a clue how to get started. How would I go about doing it? Any
>pointers or examples appreciated.
>
>TIA
>Sanjay
>
>
>
>p.s. My skill set of perl is very limited, but I will learn enough to get
>the job done. :-)
>
>
>
>
>
------------------------------
Date: 7 Mar 2001 14:02:06 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: creating dos exectable from perl script
Message-Id: <3aa6afde@news.victoria.tc.ca>
C J Sinha (cj@sinha.cncdsl.com) wrote:
: Greetings,
: I have written a small perl program which is very useful to my
colleagues.
: When someone wants it, I have go over and install perl on their NT
machines,
: so that they can run this script.
: I understand that it is possible to convert a perl script to a self
: contained .exe file that will run in windows/dos. That way I just pass
: along the .exe file and the do not have to install perl on their
machine.
: Don't have a clue how to get started. How would I go about doing it? Any
: pointers or examples appreciated.
You could just "install" a minimal perl system. Last time I checked the
windows version only required three files to run generic perl scripts.
perl.exe
perlcore.dll
PerlCRT.dll
If you already have a network drive mapped and in the PATH (likely for
utility programs) then you could put the core files there.
Otherwise copy them locally, either way it's only three files, and then
any simple perl script can be run.
------------------------------
Date: Wed, 07 Mar 2001 20:52:15 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: DeCSS in Perl
Message-Id: <3AA6916F.97982D8E@schaffhausen.de>
Hi,
some of you might find this interesting. It's an article about
a 7 line implementation of the DeCSS algorithm to decipher DVDs
in Perl:
http://www.wired.com/news/culture/0,1284,42259,00.html
Bye,
->malte
------------------------------
Date: 07 Mar 2001 19:38:18 +0000
From: nobull@mail.com
Subject: Re: Defining Global Script Variables
Message-Id: <u9snkpl68l.fsf@wcl-l.bham.ac.uk>
"Jason Mowat" <jmowat@digitalpraxis.com> writes:
> I am wondering what is the best way to set up global defines in Perl. I
> would like to have a centralized configuration file that contains all of my
> "user settable" variables, so that I don't have to hard code them in the
> scripts.
The most obvious way would be to write the configuration file as an
Exporter module. For details "perldoc Exporter".
Rather than having you module export lots os variables it's probably
better to have it export just a single hash.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 07 Mar 2001 20:26:49 GMT
From: martellm@aol.com (MartelLM)
Subject: Detecting User Country in CGI Script
Message-Id: <20010307152649.22055.00000458@ng-ch1.aol.com>
Does anyone know of a way in Perl or any other langues for that matter that
will allow me to detect a user's country in a CGI script.
ie. if user from Canada go to x
elseif user from USA go to y
I am totally stumped and any suggestions are appreciated.
Thanks!
Lance.
------------------------------
Date: Wed, 7 Mar 2001 12:51:15 -0800
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: Detecting User Country in CGI Script
Message-Id: <3aa69f44@news.microsoft.com>
"MartelLM" <martellm@aol.com> wrote in message
news:20010307152649.22055.00000458@ng-ch1.aol.com...
> Does anyone know of a way in Perl or any other langues for that matter
that
> will allow me to detect a user's country in a CGI script.
>
> ie. if user from Canada go to x
> elseif user from USA go to y
No this is not possible. You can do some guessing based on e.g. the user
agent string, the accept language header, the IP address of the user, etc.
But even then it is crystal ball reading at best.
jue
------------------------------
Date: Wed, 07 Mar 2001 16:03:15 -0500
From: Shane McDaniel <shanem@ll.mit.edu>
Subject: Re: Detecting User Country in CGI Script
Message-Id: <3AA6A213.1BFD5A22@ll.mit.edu>
Just to note: perl != CGI, and this is not a CGI newsgroup.
With CGI you are passed info, IP, name, etc.., from the requesting
browser. If you don't have details on this info you should go look it
up somewhere. You won't always get all the info as some of it is based
on what the user has set in the browsers prefs, and it may not
specifically give the country but you might be able to deduce it say on
the IP. (I'm not sure if IP's can be tied to a certain country)
MartelLM wrote:
>
> Does anyone know of a way in Perl or any other langues for that matter that
> will allow me to detect a user's country in a CGI script.
>
> ie. if user from Canada go to x
> elseif user from USA go to y
>
> I am totally stumped and any suggestions are appreciated.
>
> Thanks!
> Lance.
------------------------------
Date: 07 Mar 2001 21:10:47 +0000
From: nobull@mail.com
Subject: Re: Detecting User Country in CGI Script
Message-Id: <u9n1axl1yg.fsf@wcl-l.bham.ac.uk>
martellm@aol.com (MartelLM) writes:
> Does anyone know of a way in Perl or any other langues for that matter that
> will allow me to detect a user's country in a CGI script.
They didn't when it was asked last week, or the week before that, or
the week before that...
Although they did point out that this was off-topic.
Note: you can get their preferred lanuage.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 07 Mar 2001 21:31:51 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Detecting User Country in CGI Script
Message-Id: <8e9datcej44nu62v5rdsogvliriu0apafm@4ax.com>
MartelLM wrote:
>Does anyone know of a way in Perl or any other langues for that matter that
>will allow me to detect a user's country in a CGI script.
No you can't. Not easily. For example, there are Belgian websites which
use a ".com" for a root domain. And what country is ".net" from? Heaven
knows. It could, for example, be Holland, or the Phillipines.
You could, in principle, do a Whois search on the domain name, and parse
the record you get back. See for example
<http://www.geektools.com/cgi-bin/proxy.cgi>. (That's a site that works
with international domains, too).
And getting back on topic for Perl: there's a Net::Whois module
available on CPAN, but the docs of it say:
The server consulted is "whois.internic.net". You can only get
.org, .edu, .net, .com domains from Internic. Other whois
servers for other Top-Level-Domains (TLD) return information in
a different syntax and are not supported at this time.
There you have it. Oops.
--
Bart.
------------------------------
Date: Wed, 07 Mar 2001 17:33:41 -0500
From: Andras Malatinszky <andras@mortgagestats.com>
Subject: Re: Detecting User Country in CGI Script
Message-Id: <3AA6B745.A8BE7887@mortgagestats.com>
MartelLM wrote:
> Does anyone know of a way in Perl or any other langues for that matter that
> will allow me to detect a user's country in a CGI script.
>
> ie. if user from Canada go to x
> elseif user from USA go to y
>
> I am totally stumped and any suggestions are appreciated.
>
> Thanks!
> Lance.
How about asking them?
------------------------------
Date: Wed, 07 Mar 2001 19:31:55 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: FAQ 5.4: How do I make a temporary file name?
Message-Id: <tad35bksspfmd1@corp.supernews.com>
PerlFAQ Server <faq@denver.pm.org> wrote:
> This message is one of several periodic postings to comp.lang.perl.misc
> intended to make it easier for perl programmers to find answers to
> common questions. The core of this message represents an excerpt
> from the documentation provided with every Standard Distribution of
> Perl.
> +
> How do I make a temporary file name?
> Use the `new_tmpfile' class method from the IO::File module to get a
> filehandle opened for reading and writing. Use this if you don't need to
> know the file's name.
[snip]
> Or you can use the `tmpnam' function from the POSIX module to get a
> filename that you then open yourself. Use this if you do need to know
> the file's name.
[snip]
I seem to remember a big discussion about using one of these over the
other because of an insecurity in one or the other. Is this still the
case, or was it never the case and just my mind playing tricks?
Chris
--
Christopher E. Stith
Try not. Do, or do not. The Force is binary. -- Yoda,
The Empire Strikes Back (paraphrased)
------------------------------
Date: 6 Mar 2001 21:20:21 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: flock and close with empty read strangeness
Message-Id: <983kal$2eh$1@orpheus.gellyfish.com>
On Tue, 06 Mar 2001 01:42:52 -0500 ZepHead wrote:
> In article <980uh3$820$1@orpheus.gellyfish.com>,
> Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>
>
>>
>> Get a grip. If I am creating a private temporary file for the use of
>> my process then if locking was to become an issue then someone would
>> really be in need of treatment - either me or the OS designer :)
>>
> we are NOT talking about a private process we are talking
> about a SHARED system that can have race condidtions.
>
> of course if it is a closed system with no file sharing
> you do not need the locks ; )
Perhaps you should have made it clear what you meant then :
"IMHO any function that messes with a file (in any sway)
should never mess with that file unless there is a lock."
Makes it sound very much like you believe all file access requires a lock.
/J\
--
Jonathan Stowe |
<http://www.gellyfish.com> | This space for rent
|
------------------------------
Date: Wed, 07 Mar 2001 15:49:18 -0500
From: Shane McDaniel <shanem@ll.mit.edu>
Subject: Re: general documentation about computer languages; as motivated by discussions in programming perl
Message-Id: <3AA69ECE.AD4BB593@ll.mit.edu>
well it's not specific to perl but you should go looking for compiler
theory, they tend to be what define those things.
"Walter Tautz [MFCF]" wrote:
>
> Basically I would like a book or article that describes some of the
> higher CS programming language concepts like lexically scoped, call by value,
> in Programming Perl. Explanation in the perl book are clear, I just want to
> have more formal reference. I have a strong math background albeit in pure mathematics
> so I do not have any aversion to books with equations ;-)
>
> -walter
------------------------------
Date: 7 Mar 2001 19:32:06 GMT
From: wtautz@math.uwaterloo.ca (Walter Tautz [MFCF])
Subject: general documentation about computer languages; as motivated by discussions in programming perl
Message-Id: <slrn9ad35l.d6m.wtautz@pythagoras.math.uwaterloo.ca>
Basically I would like a book or article that describes some of the
higher CS programming language concepts like lexically scoped, call by value,
in Programming Perl. Explanation in the perl book are clear, I just want to
have more formal reference. I have a strong math background albeit in pure mathematics
so I do not have any aversion to books with equations ;-)
-walter
------------------------------
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 437
**************************************