[17424] in Perl-Users-Digest
Perl-Users Digest, Issue: 4844 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 8 09:11:18 2000
Date: Wed, 8 Nov 2000 06:10:20 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <973692620-v9-i4844@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 8 Nov 2000 Volume: 9 Number: 4844
Today's topics:
Re: percent-underscore: %_ (Alan Barclay)
Re: percent-underscore: %_ (Alan Barclay)
Re: percent-underscore: %_ (Martien Verbruggen)
Re: percent-underscore: %_ (Mark-Jason Dominus)
perl and HTK problems on windows NT <Gina.Joue@ucd.ie>
Perl prototype for program in c <vortex@ptt.yu>
Perl prototype for program in c <vortex@ptt.yu>
Re: Perl prototype for program in c (Gwyn Judd)
Re: Perl prototype for program in c <vortex@ptt.yu>
Re: Perl SendMessage() ? <gellyfish@gellyfish.com>
Problem converting data (second try with more info) <peter.heinsbroek@siemens.nl>
Problem with Inline C <vidulats@yahoo.co.uk>
Re: Pushing a hash on to a stack... (Gwyn Judd)
Re: Pushing a hash on to a stack... (Gwyn Judd)
Re: Pushing a hash on to a stack... (Gwyn Judd)
Re: Pushing a hash on to a stack... (Martien Verbruggen)
Re: Pushing a hash on to a stack... (Martien Verbruggen)
Re: Pushing a hash on to a stack... (Martien Verbruggen)
Re: Pushing a hash on to a stack... (Martien Verbruggen)
Re: Pushing a hash on to a stack... (Martien Verbruggen)
Re: Pushing a hash on to a stack... (Martien Verbruggen)
Re: Pushing a hash on to a stack... <james@NOSPAM.demon.co.uk>
Re: Pushing a hash on to a stack... nobull@mail.com
Re: Pushing a hash on to a stack... (Mark-Jason Dominus)
Re: Quick short easy question <gellyfish@gellyfish.com>
Re: Quick short easy question donoddy@my-deja.com
Re: Split and clean data? <bart.lateur@skynet.be>
Re: strip html tags from string $text <Aidan.Finn@ucd.ie>
Using Perl Win32::OLE to control Adobe Acrobat. (Fergus McMenemie)
Re: Using Perl Win32::OLE to control Adobe Acrobat. (Aandi Inston)
Re: Using Perl Win32::OLE to control Adobe Acrobat. (Fergus McMenemie)
virtual directories - ActivePerl <freek@lodestar.be>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Nov 2000 12:05:07 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: percent-underscore: %_
Message-Id: <973685104.137113@elaine.furryape.com>
In article <slrn90hp55.7ck.mgjv@verbruggen.comdyn.com.au>,
Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
>On Wed, 08 Nov 2000 05:20:21 GMT,
> Mark-Jason Dominus <mjd@plover.com> wrote:
>> In article <973660002.812211@elaine.furryape.com>,
>> Alan Barclay <gorilla@elaine.furryape.com> wrote:
>>>
>>>There are also a lot of other not-special hashs, just like %_, for
>>>example "%!".
>>
>> You picked the wrong one. %! is special as of 5.005 or so.
>
>But not documented :)
>
>It's the first time I heard of it, so I started looking. perl5005delta
>says it's tied to the Errno module. perldiag contains an error
>message, that states more or less the same. perllocale has a vague
>reference.
I'll admit I've never used the Errno module, but looking at the
code for that module, I'd disagree that it's special. The module
ties it. If you don't use that module, or use another module, then
%! could be tied in a totally different way. This makes it no
different to XML::Parser's use of %! discussed earlier IMO.
------------------------------
Date: 8 Nov 2000 12:09:14 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: percent-underscore: %_
Message-Id: <973685353.144804@elaine.furryape.com>
In article <973685104.137113@elaine.furryape.com>,
Alan Barclay <gorilla@elaine.furryape.com> wrote:
>%! could be tied in a totally different way. This makes it no
>different to XML::Parser's use of %! discussed earlier IMO.
Should be %_ obviously...
------------------------------
Date: Wed, 8 Nov 2000 23:28:41 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: percent-underscore: %_
Message-Id: <slrn90ihnp.22p.mgjv@martien.heliotrope.home>
On 8 Nov 2000 12:05:07 GMT,
Alan Barclay <gorilla@elaine.furryape.com> wrote:
> In article <slrn90hp55.7ck.mgjv@verbruggen.comdyn.com.au>,
> Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
>>On Wed, 08 Nov 2000 05:20:21 GMT,
>> Mark-Jason Dominus <mjd@plover.com> wrote:
>>> In article <973660002.812211@elaine.furryape.com>,
>>> Alan Barclay <gorilla@elaine.furryape.com> wrote:
>>>>
>>>>There are also a lot of other not-special hashs, just like %_, for
>>>>example "%!".
>>>
>>> You picked the wrong one. %! is special as of 5.005 or so.
>>
>>But not documented :)
>>
>>It's the first time I heard of it, so I started looking. perl5005delta
>>says it's tied to the Errno module. perldiag contains an error
>>message, that states more or less the same. perllocale has a vague
>>reference.
>
> I'll admit I've never used the Errno module, but looking at the
> code for that module, I'd disagree that it's special. The module
> ties it. If you don't use that module, or use another module, then
No more special than %FIELDS if you use the fields pragma. I don't know
whether these should or shouldn't be documented in perlvar. They're
close enough to the core of Perl to get a mention in perldelta. However,
they're, unlike $_, only used on the load of a module/pragma, as you
note.
> %! could be tied in a totally different way. This makes it no
> different to XML::Parser's use of %! discussed earlier IMO.
Well, XML::Parser isn't part of the standard distribution, but fields
and Errno are. There's a bit more ambiguity here.
Martien
--
Martien Verbruggen |
Interactive Media Division | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd. | cynical. It's perfectly easy to be
NSW, Australia | cynical.
------------------------------
Date: Wed, 08 Nov 2000 13:42:31 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: percent-underscore: %_
Message-Id: <3a095847.1b32$2e5@news.op.net>
In article <973685104.137113@elaine.furryape.com>,
Alan Barclay <gorilla@elaine.furryape.com> wrote:
>I'll admit I've never used the Errno module, but looking at the
>code for that module, I'd disagree that it's special. The module
>ties it. If you don't use that module, or use another module, then
>%! could be tied in a totally different way.
But you are mistaken. %! is special, because it gets tied into Errno
*even if* you do not use the Errno module directly. If you look
into gv.c in the source distribution, you will see that when you use
%! Perl automatically loads the Errno module and ties %! into it.
>This makes it no different to XML::Parser's use of %! discussed
>earlier IMO.
Perl does not automatically load any other modules when it sees you
use %_.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Wed, 8 Nov 2000 13:47:56 -0000
From: "gina" <Gina.Joue@ucd.ie>
Subject: perl and HTK problems on windows NT
Message-Id: <newscache$10lp3g$wtj$1@weblab.ucd.ie>
Hi,
We're trying to install HTK (Hidden Markov Model Toolkit) on Windows NT,
which uses Perl -- and we have version Perl 5.6.0 for NT installed. One of
the problem we are encountering is that
system("");
doesn't seem to work.
For instance,
system("echo WORK DAMMIT");
fails.
Any ideas? And anyone with any help on getting HTK to work on NT -- HELP!!
Thanks,
g
------------------------------
Date: Wed, 08 Nov 2000 09:54:43 GMT
From: Milan Miladinovic <vortex@ptt.yu>
Subject: Perl prototype for program in c
Message-Id: <8ub7t1$7ig$1@nnrp1.deja.com>
Sorry for disturbing group by I have one more problem,
my teacher ask me next question:
*
"
If you were writing a perl program as a prototype for
a program you would like to eventually write in C (not C++),
would this alter how you write the Perl prototype? In what ways? "
*
Where I can find answer? Or could anyone help me with this
--
____________________
Milan Miladinovic
vortex@ptt.yu
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 08 Nov 2000 10:33:23 GMT
From: Milan Miladinovic <vortex@ptt.yu>
Subject: Perl prototype for program in c
Message-Id: <8uba5j$95h$1@nnrp1.deja.com>
Hello
I need help once more.
If this message posted twice, I'm sorry, because my brawser is ill.
I have to answer this question:
*
"
If you were writing a perl program as a prototype for
a program you would like to eventually write in C (not C++),
would this alter how you write the Perl prototype? In what ways?
"
*
Could anyone help me with answer or with literature to use. I did not
find this in few books I have
Thanks a lot
--
____________________
Milan Miladinovic
vortex@ptt.yu
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 08 Nov 2000 10:59:47 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Perl prototype for program in c
Message-Id: <slrn90ich1.hbr.tjla@thislove.dyndns.org>
I was shocked! How could Milan Miladinovic <vortex@ptt.yu>
say such a terrible thing:
>Sorry for disturbing group by I have one more problem,
>my teacher ask me next question:
What makes you think we're here to do your homework?
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Military intelligence is a contradiction in terms.
-- Groucho Marx
------------------------------
Date: Wed, 08 Nov 2000 11:30:43 GMT
From: Milan Miladinovic <vortex@ptt.yu>
Subject: Re: Perl prototype for program in c
Message-Id: <8ubdh4$bkv$1@nnrp1.deja.com>
Be shocked on the other place!
Here is people who need help. I'm asking only to give me right way to
resolve my problem... like the others do.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 8 Nov 2000 06:59:38 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl SendMessage() ?
Message-Id: <8uatkq$j26$1@orpheus.gellyfish.com>
On 7 Nov 2000 04:08:21 GMT Todd McLaughlin wrote:
>
> Is there a Win32 library that has FindWindow() and SendMessage()? Looked on
> ActiveState's site but didn't see anything.
>
I guess these are Win32 API calls - In which case you will probably want to
look at the Win32::API module ...
/J\
--
Jonathan Stowe |
<http://www.gellyfish.com> | This space for rent
|
------------------------------
Date: Wed, 08 Nov 2000 14:22:35 +0100
From: "P.A.G. Heinsbroek" <peter.heinsbroek@siemens.nl>
Subject: Problem converting data (second try with more info)
Message-Id: <3A09539B.D86D9285@siemens.nl>
--------------BEC92BF7CB1CA5BE0EF70B5A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I have a variable containing a binairy/hex value 07cf
This is representing the year 1999
How kan I print this variable so that it says "1999"
The data looks like this
0000 30 31 30 34 38 39 36 34 33 30 30 31 20 20 20 20
0010 20 20 20 20 20 20 20 20 20 20 20 20 07 cf 00 01
I already tried hex and unpack and printf
head -1 file | test.pl |hd ----> 0000 30
0a 0.
#!/usr/bin/perl -w
while (<>)
{
#$ident = substr($_,0,28) ;
$date1 = substr($_,28,2) ;
$num = hex $date1 ;
print $num."\n";
}
~
--------------BEC92BF7CB1CA5BE0EF70B5A
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I have a variable containing a binairy/hex value 07cf
<br> This is representing the year 1999
<br> How kan I print this variable so that it says "1999"
<br>
<br>The data looks like this
<br>0000 30 31 30 34 38 39 36 34 33 30 30 31 20
20 20 20
<p>0010 20 20 20 20 20 20 20 20 20 20 20 20 <u>07
cf</u> 00 01
<br>
<br>I already tried hex and unpack and printf
<br> head -1 file | test.pl |hd ---->
0000 30 0a
0.
<p>#!/usr/bin/perl -w
<br>
<br>while (<>)
<br> {
<br>#$ident = substr($_,0,28) ;
<br>$date1 = substr($_,28,2) ;
<br>$num = hex $date1 ;
<br>print $num."\n";
<br> }
<br>~</html>
--------------BEC92BF7CB1CA5BE0EF70B5A--
------------------------------
Date: Wed, 08 Nov 2000 12:30:03 -0000
From: <vidulats@yahoo.co.uk>
Subject: Problem with Inline C
Message-Id: <t0ihqbk7dk9390@corp.supernews.com>
Hello,
In
theoryx5.uwinnipeg.ca/CPAN/data/Inline/Inline/C/Tutorial.html
site
Example 1 is:
greet('Ingy');
greet(42);
use Inline C => <<'END_OF_C_CODE';
void greet(char* name) {
printf("Hello %s!\n", name);
}
END_OF_C_CODE
If I execute the code as it is, its giving error on END_OF_C_CODE Line.
If I remove all the Inline related statements, it works fine.
My First question is: Where I will get "INLINE.h" file?
In Example 5:
greet(qw(Brian Ingerson Ingy Me Myself I));
use Inline C => <<'END_OF_C_CODE';
void greet(SV* name1, ...) {
Inline_Stack_Vars;
int i;
for (i = 0; i < Inline_Stack_Items; i++)
printf("Hello %s!\n", SvPV(Inline_Stack_Item(i), PL_na));
Inline_Stack_Void;
}
END_OF_C_CODE
My Second question is: Inline_Stack_Item, Inline_Stack_Void function is
used. Where I will get all these functions?
If we have to create a INLINE.h file, then What should be contents of that
file.
Will anyone help me.
Thanks in advance,
Regards,
Vidula
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Wed, 08 Nov 2000 10:44:52 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <slrn90ibl1.hbr.tjla@thislove.dyndns.org>
I was shocked! How could Martien Verbruggen <mgjv@tradingpost.com.au>
say such a terrible thing:
>Careful, that would push a reference to the same hash onto @fulldata,
>if you follow the example code that was submitted. Either make a copy,
>or use lexical scoping
oh yeah :)still, who is to know it's not in a loop with my()?
>Not entirely, see my other post. However, it is slightly silly
>not to want to use references. But who are we to doubt the good
>reasons that the OP might have? I'm sure the OP has thought long and
>hard about this, and has made the decision not to use references for
>sound reasons.
Are you sure? Sometimes people like putting purely arbitrary
restrictions on themselves for no good reason
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Any fool can tell the truth, but it requires a man of some sense
to know how to lie well.
-- Samuel Butler, "Notebooks" 1912
------------------------------
Date: Wed, 08 Nov 2000 10:47:48 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <slrn90ibqh.hbr.tjla@thislove.dyndns.org>
I was shocked! How could Christopher Burke <craznar@hotmail.com>
say such a terrible thing:
>I have a reason related to the 'meta language' I am using to program the
>incoming data. Given "%{$fulldata[scalar @fulldata]} = %hash;" does it and
>I don't need references - then I would have thought that push could be
>used.
hate to bust your bubble but %{$fulldata[scalar @fulldata]} = %hash;
does use references
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
"God is the greatest character in all fiction."
[George Santayana]
Atheism/Freethought fortune cookie file
------------------------------
Date: Wed, 08 Nov 2000 10:52:37 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <slrn90ic3i.hbr.tjla@thislove.dyndns.org>
I was shocked! How could Christopher Burke <craznar@hotmail.com>
say such a terrible thing:
>So you believe I should use references, well I know I shouldn't and have
>valid reasons not to.
>
>I am gathering by the tone of these responses that people are incapable of
>answering a question - or that Perl is incapable of pushing hashes onto a
>stack.
Actually it is the latter. An array or hash is only able to store
scalare values (hashes and other arrays don't qualify). To get around
this, when you want to have a mutlti-dimensional array or hash, you
use references which point to the inner structures.
>Either way I will write my on push/pop to get around the problem.
I still don't see why you can't use references though. Perhaps there is
a third possibility, that you have gotten this into your head that you
can't (or wont) and can't see a way around it.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
The rain it raineth on the just
And also on the unjust fella,
But chiefly on the just, because
The unjust steals the just's umbrella.
-- Lord Bowen
------------------------------
Date: Wed, 8 Nov 2000 22:12:34 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <slrn90id92.boe.mgjv@martien.heliotrope.home>
[Please in the future, put your reply after the _suitably trimmed_ text
you reply to. It's less wasteful, easier to follow a thread, and
conforms to the accepted posting guidelines around here, and on Usenet
in general. Thank you]
On 8 Nov 2000 06:47:25 GMT,
Christopher Burke <craznar@hotmail.com> wrote:
> mgjv@tradingpost.com.au (Martien Verbruggen) wrote in
><slrn90he7p.7ck.mgjv@verbruggen.comdyn.com.au>:
>
>>On 8 Nov 2000 01:57:05 GMT,
>> Christopher Burke <craznar@hotmail.com> wrote:
>>> Can any perl experts emulate the following using the push/pop idea.
>>>
>>> %{$fulldata[scalar @fulldata]} = %hash;
[snip idea 1]
>>For a loop, it probably makes more sense to use a lexially scoped
>>hash, and then you actually push it on the stack.
[snip idea 2]
>>> And no - I don't want to use references.
[snip idea 3]
>>[1] Of course, this has no longer any resemblance to a stack at all.
>
> The example code is a trivial example, in actual fact I need to push the
> hash onto a stack in a loop which processes complex incoming data.
If you insist on a stack, and using push and pop, then you have no other
option than to use references, and to use the second of the three
options I presented.
> There is a valid requirement to use push - the real code is way to complex
> to try and post here.
I wasn't saying there wouldn't be a valid requirement to not use push
(use a stack). I was wondering however, what could be the requirement
not to use references. You simply cannot have both. At least, not as far
as I can imagine.
What you fail to say is whether your problem is solved now. Is it? Or is
there still a hidden question somewhere? Was that multidemensional hash
good enough[1]?
Martien
[1] It's not really multidimensional. For that, you'd need references.
--
Martien Verbruggen | Since light travels faster than
Interactive Media Division | sound, isn't that why some people
Commercial Dynamics Pty. Ltd. | appear bright until you hear them
NSW, Australia | speak?
------------------------------
Date: Wed, 8 Nov 2000 22:21:40 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <slrn90idq4.boe.mgjv@martien.heliotrope.home>
On 8 Nov 2000 06:51:02 GMT,
Christopher Burke <craznar@hotmail.com> wrote:
> mjd@plover.com (Mark-Jason Dominus) wrote in <3a08d7ec.758$101
> @news.op.net>:
>
>>In article <8FE677620craznar@130.102.2.1>,
>>Christopher Burke <craznar@hotmail.com> wrote:
>>>And no - I don't want to use references.
>>
>>
>>Hi. Can anyone help me? I am looking for a large gray animal with
>>floppy ears and a long trunk.
>>
>>No elephants, please.
>
> So you believe I should use references, well I know I shouldn't and have
> valid reasons not to.
>
> I am gathering by the tone of these responses that people are incapable of
> answering a question - or that Perl is incapable of pushing hashes onto a
> stack.
I gave you one possibility to solve your problem without references.
There are no others. Perl is not capable of pushing arrays or hashes
onto a 'stack' whatever that is.
As I have already explained, Perl's arrays are perfectly capable to
function as a stack. Perl even has the builtins push and pop to work
with arrays. What you posted originally was NOT a stack. But even what
you posted can be done with a Perl array.
> Either way I will write my on push/pop to get around the problem.
Well, good luck. You will NOT succeed in creating a stack in Perl,
without using references. That is not entirely true, It might be
possible with a set of hashes, and a lot of flattening and restructuring
of stuff. The code to manage it would probably take about 200 lines, and
would be equivalent to
push @stack, \%hash;
# (or push @stack, [%hash];)
$hash_ref = pop @stack;
and very unsafe and slow.
Most of us were incredibly happy when Perl 5 came along, and we finally
didn't have to jump through hoops anymore, and kludge crap together to
get a seemingly workable stack.
But if you want to be bloodyminded, and know it all better, go ahead.
I'm sure you have a much better idea of what's best. If you did, you
would be able to explain in a few words why you believe that references
are not the way to go for you. Failure to even try to explain why you
can't use references just leads me to conclude that you have no clue
about how all this works. Prove me wrong by finally giving some
well-reasoned arguments.
Tell everyone else how you've implemented your reference free stack. I'm
putting you in my killfile, so that you won't annoy me when you want to
build a balanced B-tree and a linked list without references next week.
Martien
--
Martien Verbruggen |
Interactive Media Division | This matter is best disposed of from
Commercial Dynamics Pty. Ltd. | a great height, over water.
NSW, Australia |
------------------------------
Date: Wed, 8 Nov 2000 22:25:21 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <slrn90ie11.boe.mgjv@martien.heliotrope.home>
On 8 Nov 2000 06:54:24 GMT,
Christopher Burke <craznar@hotmail.com> wrote:
> tadmc@metronet.com (Tad McClellan) wrote in
><slrn90hn03.73k.tadmc@magna.metronet.com>:
>
>>On 8 Nov 2000 01:57:05 GMT, Christopher Burke <craznar@hotmail.com> wrote:
>>
>>>Can any perl experts emulate the following using the push/pop idea.
>>
>>>And no - I don't want to use references.
>>
>>
>>*Why* not?
>>
>>You seem to have correctly predicted that the experts would
>>tell you to use references, yet you provide no reasons for
>>your prohibiting them.
>
> The reason is too complex to go into, but it revolves around the fact that
> I am writing a perl routine that will use a meta-language to define its
> operation....
>
>>If you say what the problem with references is, perhaps an
>>expert can show how that problem can be overcome.
>
> Why bother, given it cannot be done I'll just write my own push/pop to
> solve the problem.
I challenge you to come up with a decent solution.
>>I don't think experts can help if you discard potential
>>solutions without saying why they should be rejected.
>
> Using references adds complexity to heaps of places, using my 'push'
> similator adds complexity to one place - and that place is hidden from end
> users.
>
>>So, why are you resisting references?
>
> To solve a problem that requires no references to be used.
You just don't understand them, do you?
Martien
--
Martien Verbruggen |
Interactive Media Division | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd. | make up 3/4 of the population.
NSW, Australia |
------------------------------
Date: Wed, 8 Nov 2000 22:24:34 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <slrn90idvi.boe.mgjv@martien.heliotrope.home>
On 8 Nov 2000 06:55:16 GMT,
Christopher Burke <craznar@hotmail.com> wrote:
> mjd@plover.com (Mark-Jason Dominus) wrote in <3a08d7ec.758$101
> @news.op.net>:
>
>>In article <8FE677620craznar@130.102.2.1>,
>>Christopher Burke <craznar@hotmail.com> wrote:
>>>And no - I don't want to use references.
>>
>>
>>Hi. Can anyone help me? I am looking for a large gray animal with
>>floppy ears and a long trunk.
>>
>>No elephants, please.
>
> Hi, Can anyone help me? I am looking for a large gray animal with floppy
> ears and a long trunk.
>
> Sure - I found this rabbit, will it help.
I suppose you're trying to be clever, and emulate our answers?
We would give that answer if the question was:
I am looking for a large gray animal with floppy ears and a long trunk,
because I need it to dig a hole and eat a carrot.
You asked for something specific, and then excluded the one thing that
specifically exists in Perl to solve that problem. And now you're being
smart. I wish killfiles worked retroactively.
Martien
--
Martien Verbruggen |
Interactive Media Division | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd. | make up 3/4 of the population.
NSW, Australia |
------------------------------
Date: Wed, 8 Nov 2000 22:58:14 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <slrn90ifum.22p.mgjv@martien.heliotrope.home>
On Wed, 08 Nov 2000 10:44:52 GMT,
Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
> I was shocked! How could Martien Verbruggen <mgjv@tradingpost.com.au>
> say such a terrible thing:
>
>>Not entirely, see my other post. However, it is slightly silly
>>not to want to use references. But who are we to doubt the good
>>reasons that the OP might have? I'm sure the OP has thought long and
>>hard about this, and has made the decision not to use references for
>>sound reasons.
>
> Are you sure? Sometimes people like putting purely arbitrary
> restrictions on themselves for no good reason
I was being sarcastic[1], and I believe I was right to be so. In other
responses to this thread the OP has given me only indications that
they don't know what they're doing, and are probably just afraid to use
references, for whatever reason. I have tried to think long and hard
about this, but the only reason I can think of to avoid references is
that the OP is writing for perl 4.
Maybe it's Go*****a in disguise.
Martien
[1] I know. irony and sarcasm don't survive the translation to bits and
back. I refuse to add smilies for this sort of thing though. There's
nothing to smile about. I think most people will get it, after they've
seen about 100 post from me, or so.
--
Martien Verbruggen |
Interactive Media Division | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: Wed, 8 Nov 2000 23:05:29 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <slrn90igc9.22p.mgjv@martien.heliotrope.home>
On 8 Nov 2000 06:48:45 GMT,
Christopher Burke <craznar@hotmail.com> wrote:
Lots of stuff about not wanting to use references.
> I have a reason related to the 'meta language' I am using to program the
> incoming data. Given "%{$fulldata[scalar @fulldata]} = %hash;" does it and
^^^^^^^^^^^^^^^^^^^^^^^^^^^
What do you think this is?
You were going to educate us, and show us how to implement a stack,
decently, without the use of references. Now, show us. But, no
references. The construction you use above is usign a reference, just in
an obscure way. It's much easier to say
$fulldata[scalar @fulldata] = {%hash};
# or even
$fulldata[@fulldata] = {%hash};
# or even
push @fulldata, {$hash};
Now, honestly, which bit looks more like a stack? And they all use the
same sort of construction. They create a hash reference (anonymous)
somewhere, and they copy the contents of %hash somehow.
Have you actually read the perlref documentation?
Martien
--
Martien Verbruggen |
Interactive Media Division | Unix is user friendly. It's just
Commercial Dynamics Pty. Ltd. | selective about its friends.
NSW, Australia |
------------------------------
Date: Wed, 8 Nov 2000 12:11:42 +0000
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: Pushing a hash on to a stack...
Message-Id: <ant0812421cbfNdQ@oakseed.demon.co.uk>
In article <slrn90ibqh.hbr.tjla@thislove.dyndns.org>, Gwyn Judd
<URL:mailto:tjla@guvfybir.qlaqaf.bet> wrote:
> I was shocked! How could Christopher Burke <craznar@hotmail.com>
> say such a terrible thing:
>
> >I have a reason related to the 'meta language' I am using to program the
> >incoming data. Given "%{$fulldata[scalar @fulldata]} = %hash;" does it and
> >I don't need references - then I would have thought that push could be
> >used.
>
> hate to bust your bubble but %{$fulldata[scalar @fulldata]} = %hash;
> does use references
Yes, as do all the other solutions I've seen so far in this thread,
and all the other *sensible* solutions I can think of. I suppose
Christopher could write his own push/pop routines to store hashes flat
in an array with a size indicator so that they can be extracted again,
but what possible benefit this would have to his program I cannot guess.
Christopher, please explain why you don't want to build this data
structure using references. Is the \ button on your keyboard broken?
--
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02
------------------------------
Date: 08 Nov 2000 12:27:03 +0000
From: nobull@mail.com
Subject: Re: Pushing a hash on to a stack...
Message-Id: <u9r94mhco7.fsf@wcl-l.bham.ac.uk>
craznar@hotmail.com (Christopher Burke) writes:
> I have a reason related to the 'meta language' I am using to program the
> incoming data. Given "%{$fulldata[scalar @fulldata]} = %hash;" does it and
> I don't need references
Bzzzt!
The statement...
%{$fulldata[scalar @fulldata]} = %hash;
... _does_ use references. More precisely is uses something called
reference autovivification. Autovivification means that if you use an
undefined scalar lvalue expression in a reference context then a the
said lvalue is automaticially assigned to a reference to a new entity
of the appropriate type.
Your statement is ( assuming $[=0 ) semantically equivalent to:
push @fulldata, { %hash };
I'll say that again in case you missed it. What you have here is a
pachyderm. You can say "no elephants" until you are blue in the face
but if your solution is to use a pachyderm then saying you reject any
solution that involves elephants makes no sense.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 08 Nov 2000 13:27:40 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <3a0954cb.1a90$252@news.op.net>
Keywords: destitute, heroine, imprecise, video
In article <8FE6A4D54craznar@130.102.2.1>,
Christopher Burke <craznar@hotmail.com> wrote:
>I am gathering by the tone of these responses that people are incapable of
>answering a question
> - or that Perl is incapable of pushing hashes onto a
>stack.
There is a third possibility you seem to have omitted:
pushing hashes onto a stack in Perl requires references.
This is the conclusion that a more thoughtful person might have drawn
from our responses, some of which said so in so many words.
>Either way I will write my on push/pop to get around the problem.
When you do, I would love to see it. Your previous suggestion did
indeed involve references.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: 8 Nov 2000 07:52:35 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Quick short easy question
Message-Id: <8ub0o3$j8n$1@orpheus.gellyfish.com>
On Tue, 07 Nov 2000 14:52:01 GMT donoddy@my-deja.com wrote:
> Hi!
>
> I would like to modify this line of my script:
>
> print "<A HREF=\"$advert_url\">";
>
> so it opens the link in a new window. Is this
> the correct way to do it:
>
> print "<A HREF=\"$advert_url\" target=\"_top\">";
>
You are using print correctly although you would probably benefit from using
some alternate quoting mechanism in order to get rid of the backslashes.
What it is that you are printing is not anything to do with Perl - you will
want to ask in an HTML newsgroup about that.
To bring some more Perl content to this you can generate that HTML using
the facilities provided by the CGI module - you are using that arent you ?
#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);
print a({-href => 'http://www.foo.com/', -target => '_top'},'Link');
/J\
--
Jonathan Stowe |
<http://www.gellyfish.com> | This space for rent
|
------------------------------
Date: Wed, 08 Nov 2000 12:18:01 GMT
From: donoddy@my-deja.com
Subject: Re: Quick short easy question
Message-Id: <8ubg9l$deq$1@nnrp1.deja.com>
Thanks to all you guys who helped me out!
comp.lang.perl.misc seems like a really nice newsgroup.
Donald
Ps Yes it works now!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 08 Nov 2000 10:53:22 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Split and clean data?
Message-Id: <6ubi0tcjvimj0p5llkq8pf8h1v7rudh0vi@4ax.com>
vivekvp wrote:
>I have data in the format of:
>
>1|Name|Phone|screwed up formatted data|screwed up formatted
>data|spouse|address|date|open|
>
>
>The problem is the screwed up fields have multiple lines - but each line
>is appearing as a separate line.
>
>I am trying to load this data into a database - but the 2 'screwed up'
>fields have odd characters in them. How do I strip out all characters
>except text and number from those 2 fields? That inludes tabs, line
>feeds etx?
As Jon wrote: you need a way to recognize the borders of your records.
One thing that looks a good candidate, is that your line ends with a
vertical bar. Could that be a trick?
In that case, set $/ to "|\n", and you can read in one record at a time.
You can then clean up the contents of each record, and either insert
them into the database, or print out the cleaned up version.
--
Bart.
------------------------------
Date: Wed, 8 Nov 2000 13:26:53 -0000
From: "Aidan" <Aidan.Finn@ucd.ie>
Subject: Re: strip html tags from string $text
Message-Id: <newscache$u0kp3g$7fj$1@weblab.ucd.ie>
or use tom christiansons striphtml script.
http://www.perl.com/CPAN-local/authors/Tom_Christiansen/scripts/html-hacking
.html
________________
<dobrocinitelj@my-deja.com> wrote in message
news:8u9ua3$774$1@nnrp1.deja.com...
> I have a string $text containing multiple lines of text, how can I
> strip all the html tags?
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
------------------------------
Date: Wed, 8 Nov 2000 08:10:00 +0000
From: fergus@twig.demon.co.uk (Fergus McMenemie)
Subject: Using Perl Win32::OLE to control Adobe Acrobat.
Message-Id: <1ejrq5r.1l24vs9z72pcqN%fergus@twig.demon.co.uk>
Hello
The following snippet seems to update the expected docinfo fields OK.
However I cant save any changes. Also the Win32::OLE::Const("ACROBAT")
doesnt seem to work, or I am using the wrong VALUE. I tried "acrobat"
and "acroexch" but I still couldn't get constants such as PDSaveFull to
work.
#! /usr/local/bin/perl -w
use Win32::OLE;
use Win32::OLE::Const "Acrobat";
MAIN: {
my $filename = "./JSSpec.pdf";
my($status,$p);
my $xl = Win32::OLE::Const->Load(Acrobat);
printf "OLE Library contains %d constants:\n",scalar keys %$xl;
foreach my $key ( sort keys %$xl) {
print "$key = $xl->{$key}\n";
}
# Create our Exchange application object
my $acrobat = Win32::OLE->new("AcroExch.App","Quit");
# Create our PDDoc object
my $doc = Win32::OLE->new("AcroExch.PDDoc");
$doc->Open($filename) or die("Could not open $filename: $!\n");
# Allow the acrobat app to be seen.
$acrobat->Show;
# how do we allow the users to see the document ??????
# Play with the doc info fields
print "Title=",$doc->GetInfo("Title"),"\n\n";
$status=$doc->SetInfo("Title","Me messing about\n");
print "Status=$status Title=",$doc->GetInfo("Title"),"\n";
# Now try and save the work we have done.
$status=$doc->Save(1,$filename);
unless ($status==1) {
print "Save failed!\n\n ",Win32::OLE->LastError(),"\n\n";
} # is LastError being used in a string or a integer context?
}
Has anybody else played with Perl, OLE and acrobat?
The Adobe Acrobat SDK documentation is not quite detailed enough to be
useful!
------------------------------
Date: Wed, 08 Nov 2000 10:07:31 GMT
From: quite@dial.pipex.com (Aandi Inston)
Subject: Re: Using Perl Win32::OLE to control Adobe Acrobat.
Message-Id: <3a092486.129902820@reading.news.pipex.net>
fergus@twig.demon.co.uk (Fergus McMenemie) wrote:
>Hello
>
>The following snippet seems to update the expected docinfo fields OK.
>However I cant save any changes. Also the Win32::OLE::Const("ACROBAT")
>doesnt seem to work, or I am using the wrong VALUE. I tried "acrobat"
>and "acroexch" but I still couldn't get constants such as PDSaveFull to
>work.
1. Is the full Acrobat installed?
2. Are you on a web (or other) server, or in an NT service
environment?
>The Adobe Acrobat SDK documentation is not quite detailed enough to be
useful!
What detail is missing?
---------------------------------------
Aandi Inston quite@dial.pipex.com
Imposition and booklets for PDF - http://www.quite.com/imposing/
------------------------------
Date: Wed, 8 Nov 2000 12:08:05 +0000
From: fergus@twig.demon.co.uk (Fergus McMenemie)
Subject: Re: Using Perl Win32::OLE to control Adobe Acrobat.
Message-Id: <1ejs1cl.z2arlj45w3jiN%fergus@twig.demon.co.uk>
Aandi Thanks for replying...
Aandi Inston <quite@dial.pipex.com> wrote:
> fergus@twig.demon.co.uk (Fergus McMenemie) wrote:
> >The following snippet seems to update the expected docinfo fields OK.
> >However I cant save any changes. Also the Win32::OLE::Const("ACROBAT")
> >doesnt seem to work, or I am using the wrong VALUE. I tried "acrobat"
> >and "acroexch" but I still couldn't get constants such as PDSaveFull to
> >work.
>
> 1. Is the full Acrobat installed?
Yes. As far as I know. Acrobat Exchange plus all the bits v 4.05
> 2. Are you on a web (or other) server, or in an NT service
> environment?
I am running on a win98 machine. With no web server installed.
> >The Adobe Acrobat SDK documentation is not quite detailed enough to be
> useful!
>
> What detail is missing?
Well looking at the save command. It would be nice see a clearer
indication of what is the equiv of "optimized" checkbox in Acrobats
save as dialog.
Lots more examples would really help.
> ---------------------------------------
> Aandi Inston quite@dial.pipex.com
> Imposition and booklets for PDF - http://www.quite.com/imposing/
------------------------------
Date: Wed, 08 Nov 2000 10:52:00 GMT
From: "freek" <freek@lodestar.be>
Subject: virtual directories - ActivePerl
Message-Id: <kfaO5.81361$iI2.1756879@afrodite.telenet-ops.be>
Hi,
does anyone know of any bugs/problems with virtual directories?
I have the following problem:
I created a website in IIS (Windows 2000)
The home dir of my site is \websites\site\www\
There is a dir I also need: \websites\site\htbin (This is CGI bin I use -
with ActivePerl on WINDOWS 2000)
So I created a virtual directory to this directory (Default Application,
/htbin, user rights, ...)
And everything works fine. I can access scripts in \websites\site\htbin via
the browser: http://www.site.com/htbin/scriptfile
The problem I experience is after a while this doesn't work anymore?? Its
like IIS forgets it has a virtual directory for this site? When I restart
the website process it works again but again oly fr a while.
The error I get is:
CGI Error
The pecified CGI application misbehaved by not returning a complete set of
HTTP headers.
Can't open perl script: \websites\site\htbin\htbin\script
(notice two times htbin?)
Please help
hvanlint@lodestar.be
------------------------------
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 4844
**************************************