[19927] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2122 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 13 09:05:40 2001

Date: Tue, 13 Nov 2001 06: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: <1005660309-v10-i2122@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 13 Nov 2001     Volume: 10 Number: 2122

Today's topics:
        [OT] Re: Unencoding <geoff@REMOVETHISgeoffball.net>
        [OT] Re: Unencoding <geoff@REMOVETHISgeoffball.net>
    Re: Hash Problem (Anno Siegel)
        Infoworld needs a proofreader <clay@panix.com>
    Re: IO::Socket write fail <admin@asarian-host.net>
    Re: Making an array of records (Anno Siegel)
    Re: Making an array of records <usenet@michnet.de>
    Re: Making an array of records <zoltan.kandi@tellabs.com>
        ot: UNIX answer to obl <peter_icaza@REMOVE2REPLYuhc.com>
        Perl Problems (Darlene Murphy)
        Request for comment on socket server code <wyzelli@yahoo.com>
        String Length <jkezar@doc.state.vt.us>
    Re: String Length <peter.sogaard@jubiimail.dk>
    Re: Unencoding <mgjv@tradingpost.com.au>
    Re: Unencoding <Tassilo.Parseval@post.rwth-aachen.de>
    Re: Unencoding <mgjv@tradingpost.com.au>
    Re: Unencoding <mgjv@tradingpost.com.au>
    Re: Unencoding <geoff@REMOVETHISgeoffball.net>
        Win32::Console problem (was Re: Return from subroutine  <andrew_harton@agilent.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 13 Nov 2001 11:33:52 GMT
From: "Geoff" <geoff@REMOVETHISgeoffball.net>
Subject: [OT] Re: Unencoding
Message-Id: <Ay7I7.48166$5e2.8305149@news1.telusplanet.net>

"Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
news:slrn9v1vlm.u69.mgjv@martien.heliotrope.home...
> Who the fsck cares about the original question?

Is that not why it's here?  As a place to ask and answer questions?

> You don't seem to ave much experience with Usenet, do you?

Do I "seem" to?  No, probably not.
Do I, in actuality, have a much experience?........again, no, not really...

> Usenet does not revolve around you. A thread does not revolve
> around you, even if you posted the original question.

I never said it did, but normally a question gets answered.  I can
understand how people get off-topic, but usually the initial question
remains as a factor.

> *plonk*

Congrats to you.

> > "Of course, that's just my opinion.  I could be wrong."
>
> uhuh.

It's a quotation from Dennis Miller, not a statement.  Quotations are put in
quotation marks (makes sense).  Even though he says it, he's using it
sarcastically, and still believes his rants to be true.

> Martien

Well, *now* it's off-topic.

Geoff

"I went to Burns Bog, and all I got was this stupid T-shirt."




------------------------------

Date: Tue, 13 Nov 2001 11:41:09 GMT
From: "Geoff" <geoff@REMOVETHISgeoffball.net>
Subject: [OT] Re: Unencoding
Message-Id: <pF7I7.48190$5e2.8306880@news1.telusplanet.net>

"Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
news:slrn9v1vs8.u69.mgjv@martien.heliotrope.home...
> You don't know what defensive means.
>
> Martien

What are you getting at?




------------------------------

Date: 13 Nov 2001 12:01:58 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Hash Problem
Message-Id: <9sr23m$pns$2@mamenchi.zrz.TU-Berlin.DE>

According to SQLBoy <sqlboy@playway.net>:
> Hi, I've been trying to fix this for awhile and I'm not sure what is
> causing it.
> I'm using perl version 5.005_03.
> 
> I'm coding a perl module to allow easy remote admin to PunkBuster
> server for Half-Life.  The module telnet's into the server and gets a
> list of players that looks like this:
> 
> 7725 "ShortyMac420" 65.92.249.97:27005,154991,4209 0:04:46 [0]
> Disconnected 216.25.206.67:27015
> 7735 "LEO" 66.65.76.50:27005,35005,4216 0:05:12 [2] Disconnected
> 216.25.206.67:27015

[snip code]

> Problem is, when I derefernce, I get strange results.  Every other
> entry in the hash is not a reference.

Speaking of "every other" entry of a hash doesn't make sense because
hash entries have no inherent sequence.

> %pbp = $pbshots->getPlayers();
> foreach $players (%pbp)
                    ^^^^
Here you are expanding the hash into a list of alternating keys and
values.  Each even entry in this *list* is a key and each odd one
is a value.  The keys seem to be (numeric) strings, and the entries
are hash refs.  This is exactly what you'd expect from a HoH.

> {
>                 print $players . "\n";
> }
> 
> Exampe output:
> 
> 45521
> HASH(0x823bfd8)
> 963439
> HASH(0x823bf00)
> 20674
> HASH(0x822ead0)
> 35290
> HASH(0x823c1f4)
> 1403219
> HASH(0x823c11c)
> 
> Can someone tell me what I'm doign wrong?

Nothing is wrong except your interpretation of the printout.

Anno


------------------------------

Date: 13 Nov 2001 13:02:30 GMT
From: Clay Irving <clay@panix.com>
Subject: Infoworld needs a proofreader
Message-Id: <slrn9v26f6.7ah.clay@panix2.panix.com>

  "At this week's O'Reilly Peer-to-Peer and Web Services conference
   in Washington, Sun will show off the Java-compatible version of
   Jxta and will lay out plans for delivering a version that is
   compatible with C, Objective C, and Pearl programming languages."

   Infoworld, 05 Nov 2001
   Sun plans p-to-p splash, p24
   By Ed Scannell

-- 
Clay Irving <clay@panix.com>
Happiness is not something you experience, it's something you remember. 
- Oscar Levant 


------------------------------

Date: Tue, 13 Nov 2001 13:23:11 GMT
From: "Mark" <admin@asarian-host.net>
Subject: Re: IO::Socket write fail
Message-Id: <399I7.39294$Wa.2862699@bin1.nnrp.aus1.giganews.com>

"Uri Guttman" <uri@stemsystems.com> wrote in message
news:x77ksvlpgb.fsf@home.sysarch.com...

> non-blocking writes are tricky. do you really need them? you must check
> the result of the write call and make sure it sent all the data. you then
> have to buffer the unsent data and send it the next time the socket is
> writable. this requires a more complex system and you should think about
> going to an OO one like Stem, POE or Event.pm. IO::Select is too limited
> when handling complex asynch I/o situations.
>
> for many client/server designs, blocking I/O is ok as long as the
> protocol on the pipe works that way.

If I leave the sockets blocking, what will happen if they block? Does the
program just hang in the blocked state? Should I set an alarm to break out
of a blocked write? I know that when I set it to blocking, the write either
succeeds or fails.

Per your suggestion, I have now not set the sockets to non-blocking. I have
actually been able to send rather sizeable chunks (over 256K per write) back
to the clients, without any problem whatsoever.

> also you use send/recv and I think you should be using syswrite/sysread
> which are better as you can control how much is read/written with them.
> send/recv are just different api's for socket I/o. and in either case,
> make sure you check the amount of data written to non-blocking sockets.

Thank you, Uri. Your contribution has been invaluable. :) I have it working
now.

- Mark




------------------------------

Date: 13 Nov 2001 11:43:28 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Making an array of records
Message-Id: <9sr110$pns$1@mamenchi.zrz.TU-Berlin.DE>

According to Sasha <sasha_lui@yahoo.com>:
> Hi
> 
> I was wondering if some one could help me to make an array / hash of
> records. I have an input variables that contains a phone number like :
> 
> $new_phon_nr =(
> "Peter"    =>"46978955",
> )
 
This doesn't make much sense.  You are assigning a list to a scalar,
so $new_phon_nr will be "46978955" after the assignment.  "Peter"
is lost, and under warnings Perl will tell you so.

> And i want to have an hash/array that keep this information with an index,
> like:
> 
> $phon_list{$index}=$new_phon_nr ;
> 
> And each time i receive a new phon number i want to save it in the list and
> increase the index by one so each index contain one phone number. and i
> alwayes want to be able to know the latest index number.

Looks like you want an array @phon_list:

    push @phon_list, $new_phon_nr;

adds an element to the list.  The index last used will always be
$#phon_list.

Anno


------------------------------

Date: Tue, 13 Nov 2001 13:27:50 +0100
From: Michael Velten <usenet@michnet.de>
Subject: Re: Making an array of records
Message-Id: <6k3rs9.2t2.ln@conscious.reno.de>

* Sasha <sasha_lui@yahoo.com> in clpm:

> [code snipped]

There are several mistakes in the code. I suggest that you maybe first
read the fundamental stuff like how to use scalars, arrays, hashes and
stuff. Take a look at »perldoc perl« to get an overview of the available
sections.

> I want also ask how can i read the array if i want to read these array

TMTOWTDI (There's more than one way to do it)

With your problem you might do something like the following:

| my $new_phon_nr = '46978955';
| push(@phon_list, $new_phon_nr);
| 
| foreach $nr (@phon_list) {
|     print "$nr\n";
| }

Michael


------------------------------

Date: Tue, 13 Nov 2001 13:37:51 GMT
From: Zoltan Kandi <zoltan.kandi@tellabs.com>
Subject: Re: Making an array of records
Message-Id: <3BF12F54.525C1B0A@tellabs.com>

Hi,

Anno Siegel wrote:
> 
> This doesn't make much sense.  You are assigning a list to a scalar,
> so $new_phon_nr will be "46978955" after the assignment.  "Peter"
> is lost, and under warnings Perl will tell you so.
> 
> Looks like you want an array @phon_list:
> 
>     push @phon_list, $new_phon_nr;
> 
> adds an element to the list.  The index last used will always be
> $#phon_list.
> 
> Anno


The following code could also be used:

my @phon_list;
$phon_list[0] = { name  => qw(Peter),
                  phone => qw(46978955)};
$phon_list[1] = { name  => qw(Paul),
                  phone => qw(0012121234567)};
$phon_list[2] = { name  => qw(Maurice),
                  phone => qw(0033123422332)};
$phon_list[3] = { name  => qw(Pamela),
                  phone => qw(09001234)};

foreach (0..$#phon_list)
{ 
  print $phon_list[$_]->{name}." is reachable
at\t".$phon_list[$_]->{phone}."\n";
}

as this is more universal (expandable) than

my @phon_list;
 ...
$phon_list[$myindex]={"John","ext9999"};
 ...

Aother question.
Here I'm doing something wrong. But what??? I've read perldoc but still
 ...

my %phon_list = {Peter => "1234",
                 Julia => "34567",
                 Romeo => "17369"};

foreach $person (sort keys %phon_list)
{ 
    print "Person ".$person." has phone_no ".$phon_list->{$person}."\n";
}

print "Person Romeo has phone_no ".$phon_list->{Romeo}."\n";
exit;

# Result:
# Person HASH(0x1b9efcc) has phone_no
# Person Romeo has phone_no

What am I referencing incorrectly? (Sorry, I'm a newbie...)


Greetz,

Zoltan Kandi, M. Sc.
Product & Application Specialist

Tellabs Netherlands BV
Perkinsbaan 17
3439 ND Nieuwegein

Tel:      +31 30 600 40 75
Fax:      +31 30 600 40 90
GSM:      +31 651 194 291
Email:    Zoltan.Kandi@tellabs.com
Internet: http://www.tellabs.com


------------------------------

Date: Tue, 13 Nov 2001 08:19:49 -0500
From: peter <peter_icaza@REMOVE2REPLYuhc.com>
Subject: ot: UNIX answer to obl
Message-Id: <3BF11DF5.187CB70A@REMOVE2REPLYuhc.com>

http://www.thinkgeek.com/stuff/apparel/57b2.shtml
i rather liked this one and in no way am i associated with this website
or company.
peter




------------------------------

Date: 13 Nov 2001 03:23:44 -0800
From: deemurphy_us@yahoo.com (Darlene Murphy)
Subject: Perl Problems
Message-Id: <dbcc56f5.0111130323.3dbff45e@posting.google.com>

I have written perl scripts on unix and had no problems.  I can not
get my perl script to run on Redhat Linux or Any window systems.  If I
type perl and the .pl
they work, but when called from the .html file it just sits there.

Any help?  Any suggestions?

Please email me also.
Thanks
Darlene D. Murphy
deemurphy_us@yahoo.com


------------------------------

Date: Tue, 13 Nov 2001 22:14:30 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Request for comment on socket server code
Message-Id: <u78I7.8$aA.509@vicpull1.telstra.net>

I would appreciate any comments or suggestions for a small socket server I
have written.

This program accepts a socket connection, takes an IP address, then passes
it to asubroutine (not shown) which parses a radius log-file and returns the
username last assigned that IP address.  I am interested in any obvious
security issues as far as potential input which could cause problems, and
how to deal with them.

One issue I am concerned about is the potential for the socket to keep
reading an unlimited amount of text, and thus keep allocating more and more
RAM (DOS).  Is this an issue, and if so, how would I deal with that (in the
socket reading section somehow?)

Below is the code.  Apologies if wrapping of M$ makes the indenting funny.

#!/usr/bin/perl -w
use strict;
use IO::Socket;
use Net::hostent;
use Socket;
$|=1;

my $logfile = 'd:/radacct/detail';
my $port = '8008';
my $server = IO::Socket::INET->new( Proto     => 'tcp',
                    LocalPort => $port,
                    Listen    => SOMAXCONN,
                    Reuse     => 1);
die "Can't setup server" unless $server;
print "Gossip accepting clients on port $port\n";
my $client;
while ($client = $server->accept()) {
    $client->autoflush(1);
    print $client "Gossip v 1.0 waiting for Innuendo:\015\012";
    my $hostinfo = gethostbyaddr($client->peeraddr);
    printf "Connect from %s\n", $hostinfo->name || $client->peerhost;
    my $ip = <$client>;
    chomp $ip;
    my $user;
    if ($ip =~ m/(\d+\.\d+\.\d+\.\d+)/){
        print "$1\n";
        $user = fetchuser($1); # sub not shown
    }
    else {
        $user = '1 Bad Request: Not IP Address';
    }
    print $client "$user\015\012";
    close $client;
}

Thanks for any comments.

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';




------------------------------

Date: Tue, 13 Nov 2001 08:58:37 -0500
From: Joseph Kezar <jkezar@doc.state.vt.us>
Subject: String Length
Message-Id: <3BF1270D.F6D3CE76@doc.state.vt.us>

Sorry for the begginer question:
How do I determine the length(number of charecters) of a given string.
I am coming from a Java background int x = StringName.length();


--
Joseph Kezar





------------------------------

Date: Tue, 13 Nov 2001 15:01:16 +0100
From: "Peter Søgaard" <peter.sogaard@jubiimail.dk>
Subject: Re: String Length
Message-Id: <3bf12836$0$351$edfadb0f@dspool01.news.tele.dk>


"Joseph Kezar" <jkezar@doc.state.vt.us> wrote in message
news:3BF1270D.F6D3CE76@doc.state.vt.us...
> Sorry for the begginer question:
> How do I determine the length(number of charecters) of a given string.

length EXPR
length
Returns the length in characters of the value of EXPR. If EXPR is omitted,
returns length of $_. Note that this cannot be used on an entire array or
hash to find out how many elements these have. For that, use scalar @array
and scalar keys %hash respectively.

Example:
$str = 'this is my string';
print length $str;




------------------------------

Date: Tue, 13 Nov 2001 22:06:30 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Unencoding
Message-Id: <slrn9v1vlm.u69.mgjv@martien.heliotrope.home>

On Tue, 13 Nov 2001 10:04:16 GMT,
	Geoff <geoff@REMOVETHISgeoffball.net> wrote:
> 
> "Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
> news:slrn9v1mps.f5j.mgjv@martien.heliotrope.home...
> 
> [snipped]
> 
>> > Duly noted, but how many people are going to be:
>> >
>> > 1) Using these computers?  (they look like servers)
>>
>> Many. Especially the AS/400 is very popular. OS/390 machines are
>> also quite frequently used.
> 
>> > 2) Using these computers to browse the internet?
>>
>> What does this have to do with browsing? decoding things like these
>> happen on servers as well.
> 
> Maybe you should read my original post.

I did, and this has nothing to do with your original post. We were long
past that.

>> > > [for] turning all encoded characters in the URL (when submitted in
>> > > a form) into their respective unencoded characters.
> 
> I was going to use it on a perl script, which received data from a form.  So
> in actuality, it had everything to do with browsing.

Your question did. The fact on whether the code worked on anything
besides ASCII machines had absolutely nothing to do with your question,
and even less with browsing.

>>
>> Huh?
>>
>> Who cares how many people do or don't visit that site? And what exactly
>> is the point you're trying to make?
> 
> Well, seeing as how the original question was about unencoding data sent

Who the fsck cares about the original question? You don't seem to ave
much experience with Usenet, do you? Usenet does not revolve around you.
A thread does not revolve around you, even if you posted the original
question.

> practice your reading skills.  I didn't suggest that porting Perl to an

> You, sir, are EBCDIC.

*plonk*

> "Of course, that's just my opinion.  I could be wrong."

uhuh.

Martien
-- 
                                | 
Martien Verbruggen              | If at first you don't succeed, try
                                | again. Then quit; there's no use
                                | being a damn fool about it.


------------------------------

Date: Tue, 13 Nov 2001 12:06:39 +0100
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Unencoding
Message-Id: <9squrv$j2r$04$1@news.t-online.com>

On Tue, 13 Nov 2001 10:04:16 GMT, Geoff wrote:

> "Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message

[...]

>> What does this have to do with browsing? decoding things like these
>> happen on servers as well.
> 
> Maybe you should read my original post.
> 
>> > > [for] turning all encoded characters in the URL (when submitted in
>> > > a form) into their respective unencoded characters.
> 
> I was going to use it on a perl script, which received data from a form.  So
> in actuality, it had everything to do with browsing.

No. But see below.

[...]

>> Who cares how many people do or don't visit that site? And what exactly
>> is the point you're trying to make?
> 
> Well, seeing as how the original question was about unencoding data sent
> from a form to a Perl script, I think it has a lot to do with who visits the
> site.  I was saying, how many people who use these computers are going to
> end up going to this site (implying that out of all the sites on the
> internet, what would be the odds that they would end up going there...).

You are looking at this matter from the wrong side. An encoded URL
always looks the same from whatever platform it was sent. So whether I
request an URL from my Linux box or a massive OS/390 machine wont make
any difference for the server.

Martien wanted to pointed out that you are in process of writing a script
that will not properly run on all machines, that is, server-side. It is
not relevant which machine is browsing, it is just relevant which
machine the server is running on. That was all Martien wanted to say.
There was no hidden offense in his post (I guess;-).

> I was asking *you* if they'd be used frequently enough by my viewers to
> bother supporting anything non-ASCII.  Obviously, it was unclear to you, so
> I'll say it in simpler terms:

I hope you now understand why those people visiting your site don't
really matter in this whole discussion of ASCII versus non-ASCII
machines.

[...]

Tassilo
-- 
Do not use that foreign word "ideals".  We have that excellent native
word "lies".
		-- Henrik Ibsen, "The Wild Duck"


------------------------------

Date: Tue, 13 Nov 2001 22:10:00 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Unencoding
Message-Id: <slrn9v1vs8.u69.mgjv@martien.heliotrope.home>

On Tue, 13 Nov 2001 10:11:21 GMT,
	Geoff <geoff@REMOVETHISgeoffball.net> wrote:
> 
> Upon re-reading: with all the people these days who claim everything is
> *ist, I'll clear things up.  I'm suggesting you're too defensive.  So don't
> go making accusations of anything else [which was NOT intended].

You don't know what defensive means.

Note f'ups

Martien
-- 
                                | 
Martien Verbruggen              | In the fight between you and the
                                | world, back the world - Franz Kafka
                                | 


------------------------------

Date: Tue, 13 Nov 2001 23:43:23 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Unencoding
Message-Id: <slrn9v25ba.uf3.mgjv@martien.heliotrope.home>

On Tue, 13 Nov 2001 12:06:39 +0100,
	Tassilo v. Parseval <Tassilo.Parseval@post.rwth-aachen.de> wrote:
> On Tue, 13 Nov 2001 10:04:16 GMT, Geoff wrote:

[snip]

> Martien wanted to pointed out that you are in process of writing a script
> that will not properly run on all machines, that is, server-side. It is
> not relevant which machine is browsing, it is just relevant which
> machine the server is running on. That was all Martien wanted to say.
> There was no hidden offense in his post (I guess;-).

I was trying to point out that the code submitted potentially was not
portable. And it wasn't even so much trying to point it out, as to ask
whether Perl would do something special (which i doubt very much) to
make that code work on all platforms. Here's what I said:

> Wouldn't the code you give only work on machines where the
> character collation is the same as specified for these escape codes?
> This will be largely true on machines with ASCII based character sets,
> but I doubt it will work correctly on EBCDIC machines, for example.

Note that this was a followup to Bart Lateur, and not to the OP.

I don't know why the OP suddenly jumped in with that weird aggressive
little manner of him, and started asking questions which had nothing at
all to do with the point raised.

Oh well, no matter. I won't see his crud anymore.

>> I was asking *you* if they'd be used frequently enough by my viewers to
>> bother supporting anything non-ASCII.  Obviously, it was unclear to you, so
>> I'll say it in simpler terms:
> 
> I hope you now understand why those people visiting your site don't
> really matter in this whole discussion of ASCII versus non-ASCII
> machines.

He won't understand.

Martien
-- 
                                | 
Martien Verbruggen              | Freudian slip: when you say one thing
                                | but mean your mother.
                                | 


------------------------------

Date: Tue, 13 Nov 2001 13:26:15 GMT
From: "Geoff" <geoff@REMOVETHISgeoffball.net>
Subject: Re: Unencoding
Message-Id: <Xb9I7.48430$5e2.8340326@news1.telusplanet.net>

"Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
news:slrn9v25ba.uf3.mgjv@martien.heliotrope.home...
> Note that this was a followup to Bart Lateur, and not to the OP.
>
> I don't know why the OP suddenly jumped in with that weird aggressive
> little manner of him, and started asking questions which had nothing at
> all to do with the point raised.
>
> Oh well, no matter. I won't see his crud anymore.

Whatever man.  I'm done arguing with you over something so pathetic.

> > I hope you now understand why those people visiting your site don't
> > really matter in this whole discussion of ASCII versus non-ASCII
> > machines.
>
> He won't understand.

Well, we're beyond statements like "real mature," but that's quite a
libelous statement.  You have no idea whatsoever how much I know or don't
know, so I don't see how you can make that claim.




------------------------------

Date: Tue, 13 Nov 2001 12:20:58 -0000
From: "Andrew Harton" <andrew_harton@agilent.com>
Subject: Win32::Console problem (was Re: Return from subroutine behaving unexpectedly)
Message-Id: <1005654060.252161@cswreg.cos.agilent.com>


> Now again: Can you produce a *working* *subset* of your current script
> that reproduces the error you had been mentioning?

After a lot of fiddling, I have determined that the cause of the error was
something completely unrelated to what I first thought it was.  Enclosed is
a small script that illustrates the problem;

#!/usr/bin/perl
use strict;
use warnings;
use Win32::Console;

my $thing = Test();
printf "Return is : $thing\n";  # This never gets printed...

sub Test
{
 my $OUT = new Win32::Console(STD_OUTPUT_HANDLE);
 $OUT->Cls();
 $OUT->WriteChar("Press a key",1,2);
 <STDIN>;
 return 2;
}

Basically, it seems that if a new console object is created in a subroutine,
once the subroutine is exited, it is no longer possible to print to the
screen.  I have tried using $OUT->Free() at the end of the sub before
returning, but that seems to make no difference.
I've discovered that program execution continues just fine (I can write to
an output filehandle, for example), but there's no screen output.

Any pointers would be appreciated.

Thanks,

Andrew




------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.  

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 2122
***************************************


home help back first fref pref prev next nref lref last post