[18241] in Perl-Users-Digest
Perl-Users Digest, Issue: 409 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 3 21:05:55 2001
Date: Sat, 3 Mar 2001 18:05:09 -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: <983671509-v10-i409@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 3 Mar 2001 Volume: 10 Number: 409
Today's topics:
#ifndef ???? <pmckenna@writeme.com>
Re: #ifndef ???? (Martien Verbruggen)
Re: check open files ? (Martien Verbruggen)
Re: comp.infosystems.www.authoring.cgi <parrot0123@yahoo.ca>
Re: Customized Error Messages <godzilla@stomp.stomp.tokyo>
Re: FAQ 4.49: How do I permute N elements of a list? (David Combs)
Re: gif problems!!! (David Efflandt)
Re: handling arrows keys (Martien Verbruggen)
Re: Is Perl right for me? <parrot0123@yahoo.ca>
Re: Is Perl right for me? (Tad McClellan)
Re: Is Perl right for me? <godzilla@stomp.stomp.tokyo>
Re: Is Perl right for me? <maximom@mindspring.com>
Re: Is Perl right for me? <maximom@mindspring.com>
Re: Opening STDERR for input <bernie@fantasyfarm.com>
Re: Problem with #! line using RedHat 7 (Ben Okopnik)
Re: question on how to code a program (David Combs)
Reading non-ASCII from XML file using DOM module <thomastk@prodigy.net>
Re: retrieving ip adress (Martien Verbruggen)
Re: retrieving ip adress <flavell@mail.cern.ch>
Re: retrieving ip adress (Ben Okopnik)
Re: retrieving ip adress (Martien Verbruggen)
Re: REVISED: Hash/array woes... (Tad McClellan)
Re: REVISED: Hash/array woes... <ron@savage.net.au>
Re: something unique (Martien Verbruggen)
unlink problems <Ken.Brown@DIALWRAP.COM>
using blat in a perl script to send form input <plpolk@mediaone.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 03 Mar 2001 23:32:28 GMT
From: paul <pmckenna@writeme.com>
Subject: #ifndef ????
Message-Id: <3AA17D4C.E61B018C@writeme.com>
Does Perl have anything like the #ifndef from C++? I want to be sure
that once a certain very large hash is never loaded more than once. I
want to load it once and make a reference available to it globally. I
seemed to be having a problem with it being loaded more than once which
was really impacting preformance. Thanks
Paul
------------------------------
Date: Sun, 4 Mar 2001 12:36:53 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: #ifndef ????
Message-Id: <slrn9a371l.300.mgjv@martien.heliotrope.home>
On Sat, 03 Mar 2001 23:32:28 GMT,
paul <pmckenna@writeme.com> wrote:
> Does Perl have anything like the #ifndef from C++? I want to be sure
> that once a certain very large hash is never loaded more than once. I
> want to load it once and make a reference available to it globally. I
> seemed to be having a problem with it being loaded more than once which
> was really impacting preformance. Thanks
That is not at all equivalent to #ifndef. #ifndef happens at compile
time. What you want to do happens at runtime.
There are many ways in which you can do what you want, the two most
obvious ones being:
1) keep a state variable:
my $hash_loaded = 0;
sub load_hash
{
return if $hash_loaded;
%hash = get_hash_content()
$hash_loaded = 1;
}
2) Only lad it once, with a begin block, and only refer to it in your
code:
my %hash;
BEGIN {
%hash = get_hash_content();
}
# Never refer to get_hash_content anywhere in the code ever again.
Other options could be to use a tied hash of some description.
Martien
--
Martien Verbruggen |
Interactive Media Division | We are born naked, wet and hungry.
Commercial Dynamics Pty. Ltd. | Then things get worse.
NSW, Australia |
------------------------------
Date: Sun, 4 Mar 2001 10:34:20 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: check open files ?
Message-Id: <slrn9a2vrs.300.mgjv@martien.heliotrope.home>
On Sat, 03 Mar 2001 18:56:19 GMT,
Garry Williams <garry@zvolve.com> wrote:
> On Sat, 03 Mar 2001 16:19:53 +0100, Joel Nyholm <joel.nyholm@home.se> wrote:
>>Hello,
>>
>>How can i check if a file is open with perl ?
>
> Wrap your I/O operation in eval {}; and examine $@ after that.
I'm a bit confused.. How is that going to show me whether a file is
open?
$ cat foo
#!/usr/local/bin/perl -w
open FH1, "data" or die $!;
eval { open FH2, "data" or die $! };
print $@ || "no worries\n";
open FH1, ">data" or die $!;
eval { open FH2, ">data" or die $! };
print $@ || "no worries\n";
$ ./foo
no worries
no worries
$
Are you maybe thinking about systems where there is mandatory locking?
To the OP: Do you mean in the same program, or across all programs on
the system? In the first case, it may be possible to figure it out, but
it would probably be platform dependent, and there is no need for it.
Your program should _know_ what it has open. If you mean across the
whole system, then it becomes totally platform dependent. On systems
with mandatory locking, a subsequent open may fail, and in that case an
eval block may work. On systems that don't have mandatory locking, like
most unices, you can't tell reliably.
Martien
--
Martien Verbruggen |
Interactive Media Division | In the fight between you and the
Commercial Dynamics Pty. Ltd. | world, back the world - Franz Kafka
NSW, Australia |
------------------------------
Date: Sun, 04 Mar 2001 00:32:00 GMT
From: "Parrot" <parrot0123@yahoo.ca>
Subject: Re: comp.infosystems.www.authoring.cgi
Message-Id: <42go6.362834$JT5.11714523@news20.bellglobal.com>
BUCK NAKED1 <dennis100@webtv.net> wrote in message
news:1106-3A8AC2D1-38@storefull-247.iap.bryant.webtv.net...
>
>Re: comp.infosystems.www.authoring.cgi
>
>Maybe so. But I, for one, have tried to post all of my cgi questions
>there recently instead of here, and so have a few others. I posted 3
>messages there this week that disappeared into thin air. I brought this
>up because Abigail refered someone to that group yesterday. No need to
>refer someone to a group that's not accepting posts. We're forced to
>post our perl CGI questions here now, like it or not.
>
I've been trying to post there too, but they don't seem to be going through.
I'm curious to know what's happening there, because others seem to be able
to post there well enough.
------------------------------
Date: Sat, 03 Mar 2001 15:35:44 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Customized Error Messages
Message-Id: <3AA17FD0.11FC3098@stomp.stomp.tokyo>
Steve Wells wrote:
> Godzilla wrote:
(snippage)
( )
==\ __ __[oo
\/ /\@
## l_____|
#### ll ll
###### LL LL
Godzilla!
------------------------------
Date: 4 Mar 2001 00:48:34 GMT
From: dkcombs@panix.com (David Combs)
Subject: Re: FAQ 4.49: How do I permute N elements of a list?
Message-Id: <97s3d2$obd$1@news.panix.com>
In article <dyzk6.291$zN2.189028864@news.frii.net>,
Chris Fedde <cfedde@fedde.littleton.co.us> wrote:
>
>There are 303 files in the rotation right now. 4 are posted every day.
>That makes the rotation 75.75 days or about 2.5 months per 'lap.'
>
What would be *especially* worth while would be
the UPDATED (ie FIXED) faqs.
Perhaps a prefix "UPDATED: " for subject-line.
Also, we need to know which are "mere" changes
in english text (style, spelling, and the like),
and those that change the CODE.
(change from the current release's faqs)
(perhaps you already do this, and I am just
blind...)
Thanks
David
------------------------------
Date: Sun, 4 Mar 2001 01:51:50 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: gif problems!!!
Message-Id: <slrn9a37tk.pb3.efflandt@efflandt.xnet.com>
On Sat, 3 Mar 2001 14:58:08 +0100, ToDa <to.da@spray.se> wrote:
>Why doesn't my gif-images shows? It works when I run the code as html
>document but not as perl code.
>
>print <<"HTML";
>
><body bgcolor="#FFFFFF">
><img src="img/hr.gif" width="500" height="3">
></body>
>
>HTML
What shows up in your browser? Somewhere before that do you have a proper
Content-type: header and <html> tag, etc. or:
use CGI qw/:standard/;
print header,start_html();
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: Sun, 4 Mar 2001 10:37:34 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: handling arrows keys
Message-Id: <slrn9a301u.300.mgjv@martien.heliotrope.home>
On Sat, 03 Mar 2001 16:46:44 +0100,
Ardok <Ardok.f@voila.fr> wrote:
> I would like to use the down and up arrow keys to pass from a screen
> to another one. Here is my question: How can I know that the user
> hit one of the these keys?
Are you trying to write a pger, like more or less?
The Term::ReadKey module can probably help here. If you also use the
Term::Size module, you may not even need to hardcode screen sizes. ave a
look at the various Term::* modules on CPAN
http://www.cpan.org/
http://search.cpan.org/
Martien
--
Martien Verbruggen |
Interactive Media Division | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd. | from a rich salesperson.
NSW, Australia |
------------------------------
Date: Sat, 03 Mar 2001 23:18:08 GMT
From: "Parrot" <parrot0123@yahoo.ca>
Subject: Re: Is Perl right for me?
Message-Id: <QYeo6.362608$JT5.11709127@news20.bellglobal.com>
Holly Bortfeld <maximom@mindspring.com> wrote in message
news:97rqaj$qfl$1@nntp9.atl.mindspring.net...
> Hi, I am trying to create a website that would need scripting and was told
> to learn Perl by a young man at the book store. I was looking for a piece
> of software that might help me first, then if not, I will learn to program
> Perl, if that is the right language to do what I need. I can write HTML
> from scratch without an editor.
>
Perl's pretty popular for writing CGI's, and if you ask me, it's not that
hard of a language to learn. If you want a good tutorial, there are some
nice ones at www.webmonkey.com
There are a number of good options for making dynamic web pages - including
Java, Javascript, VBscript, Cold Fusion, and others. See what looks best to
you.
------------------------------
Date: Sat, 3 Mar 2001 17:34:36 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Is Perl right for me?
Message-Id: <slrn9a2sbr.qel.tadmc@tadmc26.august.net>
Holly Bortfeld <maximom@mindspring.com> wrote:
>Hi, I am trying to create a website that would need scripting and was told
>to learn Perl by a young man at the book store.
Clever young man, him :-)
>I was looking for a piece
>of software that might help me first,
This newsgroup is for the discussion of the Perl programming
language rather than for locating programs that happen to be
written in Perl. That part of your article is off-topic here.
>then if not, I will learn to program
>Perl,
Come on back with questions when you get stuck (after seeing if
the standard docs can help you first).
>if that is the right language to do what I need.
Perl can certainly do it, and probably without much difficulty,
that is why it is so popular :-)
>I can write HTML
>from scratch without an editor.
Surely you use some form of editor? Perhaps you meant "without an
HTML editor" instead?
>I want to create a website for parents of kids with multiple food allergies
>that allows users to click boxes as to what thier child cannot have in a
>recipe, then the search engine or script would sort through the 25,000+
>tagged recipes to show the site user only the recipes that fit their entered
^^^^^^
Is this to imply that "ingredients" are clearly marked-up somehow
in your data?
>criteria in a particular category.
How easy or hard this will be depends on how you have structured
the data. Are the ingredients easily "identified" somehow? Or must
they be plucked from running text? Are the checkbox values _exact_
matches for the corresponding ingredients when those ingredients
are used in a recipe?
Hate to have someone check "apple" only to get a recipe that
called for "Apples". Or check "apples" and get recipes
that call for "one apple".
If someone checked "buffalo" a program might omit recipes that
contain "buffalo wings". (a little silly, but you get the idea)
>Do you know of a software that
>would?
You have the cart before the horse.
Choice of programming language at this point would be premature. There
are likely several languages that could get the job done, including Perl.
Your first task is more related to the data than to the code.
You need to analyse the data to see if what you want is even
possible within "acceptable" levels of inaccuracy.
Doesn't sound like you have done that part yet...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 03 Mar 2001 16:14:29 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Is Perl right for me?
Message-Id: <3AA188E5.1FD2CFCF@stomp.stomp.tokyo>
Holly Bortfeld wrote:
(snippage)
> Hi, I am trying to create a website that would need scripting
> and was told to learn Perl by a young man at the book store.
> I was looking for a piece of software that might help me first,
> then if not, I will learn to program Perl, if that is the right
> language to do what I need. I can write HTML from scratch
> without an editor.
Perl is not right for you. To write an effective and efficient
program to accomplish your task, you will need a minimum of
one year's worth of intensive working experience with Perl.
Learning Perl itself, will take you at least a year as well.
> I want to create a website for parents of kids with multiple
> food allergies that allows users to click boxes as to what
> thier child cannot have in a recipe, then the search engine
> or script would sort through the 25,000+ tagged recipes to
> show the site user only the recipes that fit their entered
> criteria in a particular category.
You don't want to do this. My experience as a well seasoned teacher
being inanely and idiotically held responsible for spotting students
with medical problems, both mental and physical, has taught me a list
of the most common food allergies or substance allergies, just the
most common, would be some five-hundred to one-thousand items in length,
quite easily. This would make for a lot of check boxes and lead to a
high percentage of erroneous returns for this type of programming.
A program offering textual term search abilities based on a hierarchy
sorting scheme would be the logical methodolgy for such complexiety
as this presents. You should be looking at database software such as
File Maker Pro and Microsoft Access, both being web ready.
Are you and your friends prepared to be sued and possibly lose just
about everything you own and possess? You are preparing to provide
advice which easily qualifies as 'medical' advice. Litigation is
highly likely should a child fall ill or die as result of using
a recipe provided by you and your friends.
I would think carefully on this.
Godzilla!
------------------------------
Date: Sat, 3 Mar 2001 19:25:58 -0500
From: "Holly Bortfeld" <maximom@mindspring.com>
Subject: Re: Is Perl right for me?
Message-Id: <97s1mi$e26$1@slb6.atl.mindspring.net>
Hi, thanks for writing. Please see my responses interspersed below.
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrn9a2sbr.qel.tadmc@tadmc26.august.net...
> Holly Bortfeld <maximom@mindspring.com> wrote:
> > >I want to create a website for parents of kids with multiple food
allergies
> >that allows users to click boxes as to what thier child cannot have in a
> >recipe, then the search engine or script would sort through the 25,000+
> >tagged recipes to show the site user only the recipes that fit their
entered
> ^^^^^^
>
My understanding of this is that each recipe file would have on it a tag
that the search engine would find. The tags would be something like
WF,GF,CF,MF,NF (etc) to mean wheat free, gluten free, corn free, milk free,
nut free. so the engine would only pull up recipes that included those
items in the tag. The actual information in the file below the tag would
not matter to the search engine as I would instruct it only to files that
had the right tag assigned and not search the text of the whole file.
> Is this to imply that "ingredients" are clearly marked-up somehow
> in your data?
>
>
> >criteria in a particular category.
>
I think this would be unecessary as the above should cover it. Ingredients
are too vague so I would want to place a value tag on each file outside the
text so that the engine only searched for that tag. But if I cannot put an
external tag on each file then I would be more particular to the search
engine and instruct it to find the tag code within certain codes and make
sure those codes aren't used in the recipe wording (ie I would place a tag
of ###WF,GF,CF,MF,NF and instruct the engine to find files with those tags
including the ###)
Am I way off? Perl is starting to look like something I want to learn
either way as it seems to fit with every platform so it may be good to learn
regardless. Thanks in advance.
Holly
>
> How easy or hard this will be depends on how you have structured
> the data. Are the ingredients easily "identified" somehow? Or must
> they be plucked from running text? Are the checkbox values _exact_
> matches for the corresponding ingredients when those ingredients
> are used in a recipe?
>
> Hate to have someone check "apple" only to get a recipe that
> called for "Apples". Or check "apples" and get recipes
> that call for "one apple".
>
> If someone checked "buffalo" a program might omit recipes that
> contain "buffalo wings". (a little silly, but you get the idea)
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Sat, 3 Mar 2001 19:27:51 -0500
From: "Holly Bortfeld" <maximom@mindspring.com>
Subject: Re: Is Perl right for me?
Message-Id: <97s1s9$jmt$1@slb3.atl.mindspring.net>
thank you very much.
"Parrot" <parrot0123@yahoo.ca> wrote in message
news:QYeo6.362608$JT5.11709127@news20.bellglobal.com...> >
> Perl's pretty popular for writing CGI's, and if you ask me, it's not that
> hard of a language to learn. If you want a good tutorial, there are some
> nice ones at www.webmonkey.com
>
> There are a number of good options for making dynamic web pages -
including
> Java, Javascript, VBscript, Cold Fusion, and others. See what looks best
to
> you.
>
>
------------------------------
Date: Sat, 03 Mar 2001 19:45:34 -0500
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: Opening STDERR for input
Message-Id: <si23at8s2dfmulfff5v359oslgrdng70h2@news.supernews.net>
ilya@math.ohio-state.edu (Ilya Zakharevich) wrote:
} [A complimentary Cc of this posting was sent to Bernard Cosell
} <bernie@fantasyfarm.com>],
} who wrote in article <j4bv9t4g736m74qs4890f7k9gqeor4c282@4ax.com>:
} > } > It is not passing data around inside the program -- it is a relatively
} > } > standard Unix hack [that I've used before, just never before from
} > } > Perl] for getting user input when you have a program that is running
} > } > as a proper filter. you can't print out prompts and read responses
} > } > using stdin/stdout else you'll mess up the pipeline, so it was always
} > } > SOP to use stderr.
} > }
} > } This is what Term::ReadLine is for. At least you can use it (or just
} > } the ::Stub part) to get the i/o handles to the TTY.
} >
} > Probably true, but that really feels like overkill. It was always
} > traditional in Unix that STDERR/fd2 would stay pointed at the user's
} > tty even as stdin and stdout were piped around from here to there.
}
} I thought that we were discussing Perl, not Unix. Given that there is
} not such thing as "THE Unix", it is even more pronounced.
Well, that's not exactly true. Ever since *I've* used Unix [6th Edition],
FD 2/stderr has been used for user-interaction when you're in the middle of
a pipeline. I don't know of a *single* variant of Unix in which in a
pipeline the stderr/fd2 file descriptor doesn't stay pointed at the
controlling tty. [although I note that in somewhat later versions of Unix
[can't remember the first one but we're still talking decades ago in any
event] they added /dev/tty to provide for-sure access to the controlling
tty. And similarly here: I can't recall seeing a version of
Unix/Linux/whatever that didn't have a /dev/tty]
As for discussing Perl and not Unix, that's a bit parochial -- there are
lots of discussions about signals, file locking, forks, and other such
things involve the interactions with Perl and its real "home" OS [Unix] and
what works and doesn't in other environments. My question was about how to
do something in Perl that's easy to do in "plain Unix"... and my answer was
that "apparently read/write stream to a tty-like file doesn't work quite
right". No problem, no need for fancy packages.. I just need to use two
streams, one for I and one for O, instead of one for I/O... As far as I
can see there's no need for subtle logic or fancy code or the like to get
this to be function.. just 'two streams'...
That does leave me with a meta-question:
1) what *are* the rules on which sorts of files can be opened for
read/write?
2) if perl can't open the file for read/write [since I get an error when I
try to read from the stream], why did the open succeed?
I'll probably file a perlbug about it...
} If you look into Term/ReadLine.pm, you will see that the logic is not
} *that* straightforward as you expect.
I've looked at it and I didn't see anything that seemed appropriate. The
GNU "ReadLine" stuff has always struck me as a massively overcomplicated
and overfeatured mess [that's the machinery that manages history,
substitutions, in-line editing and all that, right] and I guess that's the
same kind of machinery that Term/ReadLine hooks you up with, yes? In terms
of "logic", I would argue that there's nothing much that ReadLine can do
for me that's much more effective than:
open (ASK, "+</dev/tty") or die ....;
print ASK "Can't open connection, should I try the alternate server? ";
return unless <ASK> =~ /^y/i ;
what's complicated about that?
In fact, on virtually every modern Unix system [and most legacy ones],
that's *ALL* that ReadLine does [at least as far as this need is concerned]
-- if you look at findConsole you realize that you've just loaded 300+
lines of Perl code and executed a giant mess of stuff to .... open
/dev/tty... Granted that if I port my code to the AS/400 or to Win2K or the
like using /dev/tty directly will break (and wouldn't if I used
ReadLine/findConsole), but I suspect that that'd be the least of my
troubles..:o).
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: 4 Mar 2001 00:43:08 GMT
From: ben-fuzzybear@geocities.com (Ben Okopnik)
Subject: Re: Problem with #! line using RedHat 7
Message-Id: <slrn9a340m.1v2.ben-fuzzybear@Odin.Thor>
The ancient archives of Sat, 03 Mar 2001 18:11:34 GMT showed
Garry Williams of comp.lang.perl.misc speaking thus:
>On 2 Mar 2001 22:24:05 GMT, Ben Okopnik <ben-fuzzybear@geocities.com> wrote:
>>
>>...which makes this the FOURTH wrong answer, by your count, since it
>>_still_ will not execute.
>>
>>./hello.pl
>>
>>And it may _still_ fail to execute if the path to perl is wrong.
>
>But _that_ reason will not produce the error message that the OP
>posted. _That_ reason will produce:
>
> bash: ./hello.pl: No such file or directory
Please note that I had already stated that upthread, along with the error
message. I said that it may still fail to execute, not "fail with the same
error". The solution to OP's error is precisely what I've shown above.
Ben Okopnik
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
"I was brought up in that other service; but I knew from the first
that the Devil was my natural master and captain and friend. I saw
that he was in the right, and that the world cringed to his conqueror
only from fear." -- George Bernard Shaw, "The Devil's Disciple"
------------------------------
Date: 4 Mar 2001 01:45:10 GMT
From: dkcombs@panix.com (David Combs)
Subject: Re: question on how to code a program
Message-Id: <97s6n6$q8e$1@news.panix.com>
In article <3a96d6fc.15701003@nntp.ix.netcom.com>,
Torque <gifg@netzero.netNOSPAM> wrote:
>I'm trying to code a cgi program with perl to count the number of
>years, months, days, hours, minutes, and seconds since a given date.
>
>I thought I could use Matt's Script archive's countdown.pl as an
What, where, and what is opinion on "Matt's Script Atchive"?
Thanks
David
------------------------------
Date: Thu, 1 Mar 2001 15:54:49 -0600
From: "Thomas Theakanath" <thomastk@prodigy.net>
Subject: Reading non-ASCII from XML file using DOM module
Message-Id: <97s05d$5sk8$1@newssvr05-en0.news.prodigy.com>
Hi:
I use XML::DOM module to read a simple XML file with following format, that
has non-ASCII chars in the text nodes.
<?xml version="1.0" encoding="ISO-8859-1"?>
<content>
<matter>rrÎ aÏkA d]ukA ejgjuRCADkA Lisx |MkilÍj[
rrÎ akmjujqdX Qfk]jiØk;
do}AsfMju Qgk dkc{fjÙjg[
Lixksm sdlhkckdX djhk]jSrl]j;</matter>
</content>
I use getData method to read the values of text nodes. But the non-ascii
letters are replaced with some junk characters in the result. I have not
tested the DOM methods to write the data, because the XML files get created
without using DOM methods.
We have tested the programs using only English. And this problem was noticed
when we started using a non-English language.
The requirement here is to just retrieve the data from nodes without any
changes done to chars. I read that it is possible to use some Encodings
option to get around this issue, but I don't know how to use that with DOM
module.
Please give me some suggestions.
Bye, Thomas Theakanath
------------------------------
Date: Sun, 4 Mar 2001 10:20:08 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: retrieving ip adress
Message-Id: <slrn9a2v18.300.mgjv@martien.heliotrope.home>
On Sat, 3 Mar 2001 10:06:40 -0600,
Charles K. Clarkson <c_clarkson@hotmail.com> wrote:
> Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
>: On Sat, 03 Mar 2001 09:28:06 GMT,
>: Waarddebon <Waarddebon@chello.nl> wrote:
>: > How can I retrieve the ip adress of a person ?
>:
>: If you wait a little while, IPv6 will be in use everywhere,
>: and you will have enough IP addresses to allocate one for each cell in
>: each living organism on Earth.
>
> Rumor has it the implementation of IPv6 has a small bug in it.
> Seems everyone is assigned 6.6.6 as an IP address. ;)
That'll make life easy for spammers.
Martien
--
Martien Verbruggen |
Interactive Media Division | +++ Out of Cheese Error +++ Reinstall
Commercial Dynamics Pty. Ltd. | Universe and Reboot +++
NSW, Australia |
------------------------------
Date: Sun, 4 Mar 2001 01:03:18 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: retrieving ip adress
Message-Id: <Pine.LNX.4.30.0103040057240.20072-100000@lxplus003.cern.ch>
On Sat, 3 Mar 2001, Martien Verbruggen wrote:
> PPS. If you're writing a CGI program, and you want to know what 'the' IP
> address of the client requesting the page is, then you need to check
> your environment variables (consult a group that cares about CGI for
> that), or, if you use the CGI.pm module, you might want to use the
> remote_addr() function, described in the documentation.
Which will give you the IP address of the proxy which our proxy uses.
Which could be the same for any of the thousands of users on campus.
<prayerwheel>
The O.P could learn more by reading an appropriate CGI FAQ and
investigating the CGI authoring group already cited.
</>
------------------------------
Date: 4 Mar 2001 00:48:35 GMT
From: ben-fuzzybear@geocities.com (Ben Okopnik)
Subject: Re: retrieving ip adress
Message-Id: <slrn9a34au.1v2.ben-fuzzybear@Odin.Thor>
The ancient archives of Sat, 3 Mar 2001 21:23:21 +1000 showed
Gregory Toomey of comp.lang.perl.misc speaking thus:
>I just implanted a Bluetooth device in my brain.
>I'm changing my name to "132.20.23.147".
ping -f 132.20.23.147
"Whoa, duuude. Who needs drugs, anyway?"
~ÿ}#.!}!}!} }8}!}$}%Ü}"}&ÿÿÿÿ}%}&aÉ>û}'}"}(}"}.²~ CARRIER LOST
Ben Okopnik
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
There are two secrets to sucess:
1) Never tell everything you know.
------------------------------
Date: Sun, 4 Mar 2001 12:32:41 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: retrieving ip adress
Message-Id: <slrn9a36pp.300.mgjv@martien.heliotrope.home>
On Sun, 4 Mar 2001 01:03:18 +0100,
Alan J. Flavell <flavell@mail.cern.ch> wrote:
> On Sat, 3 Mar 2001, Martien Verbruggen wrote:
>
>> PPS. If you're writing a CGI program, and you want to know what 'the' IP
>> address of the client requesting the page is, then you need to check
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> your environment variables (consult a group that cares about CGI for
>> that), or, if you use the CGI.pm module, you might want to use the
>> remote_addr() function, described in the documentation.
>
> Which will give you the IP address of the proxy which our proxy uses.
> Which could be the same for any of the thousands of users on campus.
Which is why I wrote it the way I did :)
he client requesting the page is the machine that opened the socket to
here. If that's a proxy, it's a proxy. I didn't want to explain, yet
again, all the possible ways in which people can share IP addresses. If
the OP did a little tiny bit of work, they could have found that out by
searching this newsgroup, or various other ones. A reference to a more
appropriate group was provided.
><prayerwheel>
> The O.P could learn more by reading an appropriate CGI FAQ and
> investigating the CGI authoring group already cited.
></>
Indeed :)
Martien
--
Martien Verbruggen |
Interactive Media Division | I took an IQ test and the results
Commercial Dynamics Pty. Ltd. | were negative.
NSW, Australia |
------------------------------
Date: Sat, 3 Mar 2001 17:06:14 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: REVISED: Hash/array woes...
Message-Id: <slrn9a2qmm.qel.tadmc@tadmc26.august.net>
scott <scott@scott.com> wrote:
>I have an interesting problem (well, interesting to me!). :-)
I found it a bit interesting too. If I had data to work with,
I might have tried solving it for you (hint).
[snip wants to expose a hierarchy of "categories"]
>where the output might look like:
>
>CATEGORY 1
> Subcategory 1
> Subcategory 2
> Sub-Subcategory 1
> Sub-Subcategory 2
>CATEGORY 2
> Subcategory 1
> Subcategory 2
>CATEGORY 3
>CATEGORY 4
>
>I know there has to be a simple way to do this in perl ...
That seems likely.
You have shown what you want the output to look like. Good.
You have not shown what input would make that output. Bad. (hint again)
You are asking potential answerers to synthesize input data
so that they can test their answers before posting them.
That amount of extra work put me "over the top" on my per-article
time budget, so I can' work on answering your post. On to the next one.
Post some input data, and the corresponding desired output
(and don't fluff up the output with HTML, you can add that later).
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 4 Mar 2001 12:36:01 +1100
From: "Ron Savage" <ron@savage.net.au>
Subject: Re: REVISED: Hash/array woes...
Message-Id: <S7go6.1968$o4.97434@ozemail.com.au>
See below.
--
Cheers
Ron Savage
ron@savage.net.au
http://savage.net.au/index.html
scott <scott@scott.com> wrote in message news:3AA18473.851A44BF@scott.com...
[snip]
> What I am trying to do is build an HTML select list using this data,
> where the output might look like:
>
> CATEGORY 1
> Subcategory 1
> Subcategory 2
> Sub-Subcategory 1
> Sub-Subcategory 2
> CATEGORY 2
> Subcategory 1
> Subcategory 2
> CATEGORY 3
> CATEGORY 4
>
CGI::Explorer is designed to display this sort of data: http://savage.net.au/Perl.html
------------------------------
Date: Sun, 4 Mar 2001 10:26:22 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: something unique
Message-Id: <slrn9a2vct.300.mgjv@martien.heliotrope.home>
On Sat, 03 Mar 2001 12:06:06 GMT,
Waarddebon <Waarddebon@chello.nl> wrote:
> How can I retrieve something unique (there may not be 2 the same) from each
> visitor to my website ? Idea is that I store that data and recall it at a
> later moment.
Make them log in with a unique usercode-password combination.
> I heard that not everyone has got an ip number so that isn't what I search.
No, not everyone has a unique IP address, but that isn't the issue. None
of this has anything to do with Perl. Please, if you need to know
CGI-specific stuff, use the CGI newsgroups. There's at least one if the
comp.infosystems.www.* hierarchy. You've been told before that that
group exists. Please _use_ it.
Martien
--
Martien Verbruggen |
Interactive Media Division | Can't say that it is, 'cause it
Commercial Dynamics Pty. Ltd. | ain't.
NSW, Australia |
------------------------------
Date: Sat, 3 Mar 2001 23:51:24 -0000
From: Ken Brown <Ken.Brown@DIALWRAP.COM>
Subject: unlink problems
Message-Id: <25B11499EC0272449DD9D7BC33FCCB610AAEC9@dw2.dialwrap.com>
OK I'm new to this so I took the example from unlink and changed it a
little bit pp236 seems to work fine until it comes across wild carded
filenames
I originally had it as you suggested but my *.txt files still failed so
I went back to the book.
I usually try and get the program working first then clean up at the end
otherwise (as a newbie) I get bogged down to often.
That still leaves me with my delete problem - I don't particularly want
to go down the file::find route unless I have to.
As for the die I will be pushing this out to s sub I use to record the
error in the NT registry.
Thoughts? Any way of recovering why the delete failed?
-----Original Message-----
From: tadmc@augustmail.com (Tad McClellan) [mailto:tadmc@augustmail.com]
Posted At: 03 March 2001 15:51
Posted To: misc
Conversation: unlink problems
Subject: Re: unlink problems
Ken Brown <Ken.Brown@DIALWRAP.COM> wrote:
>Requirement delete *.txt in a given directory
>
>Code
>
>push @DelFiles, $LogDir."\\*.txt";
>DiskCleanup();
>
>sub DiskCleanup
>{
> foreach $i (0 .. $#DelFiles)
> {
> print "@DelFiles[$i]\n";
> $FailedUnlink = grep {not unlink} @DelFiles[$i];
^
^
You should enable warnings on ALL of your Perl programs. Then fix
your program so that it does not generate any warnings.
># pinch from programming PERL
^^^^^^^^^^^^^^^^
Where in "Programming Perl" (note the proper spelling)?
What you have there is NOT from "Programming Perl".
Your code is using grep() in a scalar context.
The Camel uses grep() in a list context.
Not the same thing at all...
If you do not need to report _which_ files failed, you can just
do this for the same effect:
unlink($DelFiles[$i]) or
die "could not unlink one of: $DelFiles[$i] $!";
Avoiding the temporary variable and the grep()ing.
But that still has the unexpanded glob pattern problem. Fix that:
unlink(glob $DelFiles[$i]) or
^^^^
die "could not unlink one of: $DelFiles[$i] $!";
> die "$0: could not unlink @DelFiles[$i]\n" if
^
^ yet another warning!
>$FailedUnlink;
You should include the $! special variable in your die() message.
You should probably not have a newline at the end of your die() message,
then you can leave out the $0.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 04 Mar 2001 00:57:32 GMT
From: "Pamela Polk" <plpolk@mediaone.net>
Subject: using blat in a perl script to send form input
Message-Id: <0qgo6.18245$__6.5154156@typhoon.southeast.rr.com>
I have a situation that I am having a problem with. I have successfully done
the below on linux with the sendmail command. I tested the last portion of
the email on linux and it works.
Background:
Hardware is an HP Netserver LX Pentium Pro 180 384mb of Ram
MS Windows 2000 Advanced Server
IIS 5
ActivePerl 5.0 Build 521
The user will fill out a form and click submit. A perl script is called. I
need the form input emailed to the designated recipient. Blat is correctly
defined. I have tried to first troublshoot it by trying to send a file to
get the syntax correct. That did not work. There were no perl errors but
the email was not sent. Below is that script:
----
----
$recipients = "dkolb\@zooatlanta.org";
$ccaddress = "dkolb\@zooatlanta.org";
$fromsender = "dkolb\@zooatlanta.org";
$subject = "Blat test 1 - script is blat1.pl";
# The message must be a file that will be included
# in the body of the message. You can't pipe a message.
$message = "d:/blat186/readme.txt ";
#Note the difference in the quoting - single verses double. We will try
single quotes first.
#$blatpath = "d:/blat186/blat.exe ";
$blatpath='d:/blat186/blat.exe ';
$commandline = $blatpath;
$commandline .= $message;
$commandline .= "-s \"$subject\" " if $subject;
$commandline .= "-t $recipients " if $recipients;
$commandline .= "-f $fromsender " if $fromsender;
$commandline .= "-c $ccaddress " if $ccaddress;
#$commandline .= "-server $server " if $server;
# Send mail using blat and the system command #
system($commandline);
# We need to see if this works. A lot of scripts use the system command to
send blat
--
--
What I really need is the proper syntax to emulate the sendmail section that
does work on linux:
--
--
#local testing
#$sendmail="/usr/lib/sendmail";
#$recepient= "root\@localhost";
#$cc= "clark\@localhost";
#$subject="Join the Varner Elementary PTA On Line Form";
#server testing
$sendmail="/usr/lib/sendmail";
$recepient= "pam.polk\@mindspring.com";
$cc= "dkolb\@zooatlanta.org";
$subject="I.T Help Desk Ticket Form";
open ( MAIL, "| $sendmail -t") or die "Cannot open this file";
print MAIL "To: $recepient\n";
print MAIL "Cc: $cc\n";
print MAIL "From: $form{'username'}\n";
print MAIL "Subject: $subject\n";
print MAIL <<"EOF";
The below user has just submitted a Help Desk Ticket Form:
INFORMATION TECHNOLOGY DEPARTMENT:
_______________________________________________________
Date of Request: $date
User Name: $username
Extension: $ext
Department: $dept
Location: $loc
SERVICE AREA
_______________________________________________________
$service_area
SERVERS
_______________________________________________________
$servers
DESCRIPTION OF SERVICE
_______________________________________________________
$descserv
ERROR MESSAGE
_______________________________________________________
$errmesg
EOF
--
--
Any help would be so appreciated. My email is plpolk@mediaone.net
Pam Polk
Pamela L. Polk
Netdoodle Web Site Design & Consulting
http://people.atl.mediaone.net/plpolk/
(770)-943-1696
------------------------------
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 409
**************************************