[26043] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8251 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 14 18:05:29 2005

Date: Thu, 14 Jul 2005 15:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 14 Jul 2005     Volume: 10 Number: 8251

Today's topics:
        filter characters from libcurses. <sheam@hb-studios.com>
    Re: In basic I say Dim var$(50,50), how to make 2 dimen <RedGrittyBrick@SpamWeary.foo>
    Re: OT: Higher Order Perl and Amazon axel@white-eagle.invalid.uk
        Problem With WWW::Mechanize With <SELECT MULTIPLE> (may <hal@thresholddigital.com>
    Re: stat/mtime on Windows changes with daylight saving <obetz@despammed.com>
        Tk: Text works with TIE, Scrolled doesn't <stfhostf@kartos.de>
        use / circular dependency issue <jens.luedicke@gmail.com>
        Writing directly to system memory <rm@nospam.popeslane.clara.co.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 14 Jul 2005 20:32:27 GMT
From: "Shea Martin" <sheam@hb-studios.com>
Subject: filter characters from libcurses.
Message-Id: <vZzBe.61177$Ph4.1832749@ursa-nb00s0.nbnet.nb.ca>

Not sure if I have the terminoly right, but basically, I have a handfully of 
command line executables that use various sorts of progress bars.  In *nix 
one would use libcurses to generate such things, but I am in WIn32 now, so 
not sure what they used.

Anyway, I am piping the output of these commands to a file with perl, and I 
would like to strip out these characters.  Is there a simple way to do this, 
or do I have to manually strip out one bad char at a time?

~S 




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

Date: Thu, 14 Jul 2005 19:51:02 +0000 (UTC)
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: In basic I say Dim var$(50,50), how to make 2 dimensional aray in Perl?
Message-Id: <db6fn6$j50$1@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com>

Abigail wrote:
>     my @power;
> 
>     for (my $x = 0; $x < 3; $x ++) {
>         for (my $y = 0; $y < 5; $y ++) {
>             $power [$x] [$y] = $x ** $y;
>         }
>     }
> 

I much prefer ...

     for my $x (0..2) {
         for my $y (0..4) {
             $power [$x] [$y] = $x ** $y;
         }
     }

 ... perhaps because I'm not a C programmer.


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

Date: Thu, 14 Jul 2005 18:43:13 GMT
From: axel@white-eagle.invalid.uk
Subject: Re: OT: Higher Order Perl and Amazon
Message-Id: <5nyBe.39132$O22.34988@fe1.news.blueyonder.co.uk>

Steven Vasilogianis <stevenv@operamail.com> wrote:
> axel@white-eagle.invalid.uk writes:
>> A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
 
>>> Take a look at ref=pd_bbs_ur_1. That is someone's Amazon affiliate ID. 
>>> If you click on this link, then but something from Amazon a month from 
>>> now, that person will make money (if you haven't clicked on someone 
>>> else's affiliate link in the mean time).
  
>> Indeed. May I draw attention to the _author's_ site:

>> http://hop.perl.plover.com/#free

>>       "My contract says that after the book is published I can
>>       distribute the complete text from my web site. The content
>>       of my book will be available to everyone everywhere for
>>       free. Watch this space for updates."
 
> I think this portion of an interview with the Mark Jason Dominus (author of
> _Higher Order Perl_) is also worth mentioning for those who would still like
> to buy it:
 
>  TPR: In the past, you have expressed strong feelings about Amazon.com. Where
>  would you like people to buy your book? Do you have an affiliate link?
> 
>  MJD: I'm still upset about Amazon's ridiculous "one-click" patent, and I'm
>  still boycotting them. Software patents like Amazon's threaten the
>  livelihoods of all programmers, including mine, and I don't want to give my
>  support to a company that means me ill. They dropped their suit against
>  Barnes & Noble, but the terms of the settlement were never disclosed, so we
>  don't know what happened, and Amazon could turn around at any moment and sue
>  anyone for violating their patent. So the issue is unresolved.
> 
>  I'd like people to buy my book from anyone but Amazon. My web site has an
>  affiliate link to either to Barnes and Noble or to Powell's Books, depending
>  on who isn't out of stock at the moment. I get a small kickback from this,
>  but I really don't feel strongly about it. I do feel strongly about not
>  supporting Amazon. There are a lot of places to get books online; it's not
>  hard to buy books from a company with less abusive business practices than
>  Amazon.

Thank you. I will order it via Barnes and Noble.

I belive in supporting authors.

Axel



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

Date: Thu, 14 Jul 2005 13:05:25 -0400
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Problem With WWW::Mechanize With <SELECT MULTIPLE> (maybe be with HTTP::Form too?)
Message-Id: <p-idnZ47NfLIBkvfRVn-sQ@comcast.com>

I'm having problems with a <SELECT MULTIPLE> element in a form, and this
seems like it is not just Mech, but a problem with HTTP::Form as well.  In
short, this item is a <SELECT MULTIPLE> object and when I first tried to
set a value, I got error messages, so I changed my code to retreive the
object and print out the possible values and the value names.  It did not
print out the values available in the code, so I changed my code to
retreive an array of objects and found that this one <SELECT MULTIPLE>
object was being treated as a number of OPTION objects.  The HTML was not
complete (the </OPTION> tags were missing), so I got the page, fixed it
with a few regexes, then replaced the HTML, and that didn't fix the
problem.  After experimenting, I found that once I removed the MULTIPLE
keyword from the <SELECT> tag, the item was then seen as one object, and I
could use it as expected.  I need to know if I'm doing something wrong, or
why a <SELECT MULTIPLE> is not treated as one <SELECT> object, if this is a
bug I need to report, or, if not, how I can select ONE value in a <SELECT
MULTIPLE> object.  I've included much more below.

Here's the code for the form object I'm dealing with (the form itself is
okay, it seems to be this and a few other <SELECT MULTIPLE> objects that
are the problem:

<SELECT NAME=location  MULTIPLE>
<OPTION SELECTED>
<OPTION Value='1' >East End
<OPTION Value='2' >West End
<OPTION Value='3' >Southside
<OPTION Value='4' >Northside
</SELECT>

When I cleaned it up, it was like this:

<SELECT NAME=location  MULTIPLE>
<OPTION SELECTED Value = ''> </OPTION>
<OPTION Value='1' >East End</OPTION>
<OPTION Value='2' >West End</OPTION>
<OPTION Value='3' >Southside</OPTION>
<OPTION Value='4' >Northside</OPTION>
</SELECT>

This did not make a difference.  The only thing that did make a difference
was when I removed "MULTIPLE".  I changed my code to set the <SELECT> value
to get the OPTION object(s), step through each one, and list the possible
values and value names.  Here's the subroutine I used:


sub setselectname {
        my ($form, $option, $name, $val, @obj, @val);
        ($name, $val) = @_;
        if (!checkformelement($name, "option")) {return 0;}
        $form = $mech->current_form();
        @opt = $form->find_input($name, "option");
        print "--------------------------------------------------------\n";
        print "Option name: $name, Count found: $#opt\n";
        foreach (@opt) {
                print "Option:\n";
                @val = $_->possible_values();
                foreach (@val) {
                        print "\tValue: $_\n";
                }
                @val = $_->value_names();
                foreach (@val) {
                        print "\tName: $_\n";
                }
        }
        return 1;
}

Originally, to set the <SELECT> objects value I used: 

$mech->select($name, $val);

And once I realized the problem was with the MULTIPLE keyword, I tried:

$mech->select($name, \@val)

Just in case it needed an array (only the first array element was set).

And here's the code it outputs if the MULTIPLE keyword is left in:

--------------------------------------------------------
Option name: locatoin, Count found: 4
Option:
        Value: 
        Value: 
        Name: off
        Name: 
Option:
        Value: 
        Value: 1
        Name: off
        Name: East End
Option:
        Value: 
        Value: 2
        Name: off
        Name: West End
Option:
        Value: 
        Value: 3
        Name: off
        Name: Southside
Option:
        Value: 
        Value: 4
        Name: off
        Name: Northside


And here's the code it outputs if the MULTIPLE keyword is left out:

--------------------------------------------------------
Option name: location Count found: 0
Option:
        Value: 
        Value: 1
        Value: 2
        Value: 3
        Value: 4
        Name: 
        Name: East End
        Name: West End
        Name: Southside
        Name: Northside

So if the MULTIPLE keyword is in, it sees each <OPTION> as a separate item. 
I can understand that, but there is no way for me to access the entire
<SELECT>...</SELECT> object as one form element so I can set the value of
the <SELECT> object to one of the <OPTION> items.  Am I doing something
wrong?

Thanks!

Hal


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

Date: Thu, 14 Jul 2005 18:13:12 +0200
From: Oliver Betz <obetz@despammed.com>
Subject: Re: stat/mtime on Windows changes with daylight saving
Message-Id: <6g2dd1p28743c5m2supnc3vgj4nb8r5m18@z1.oliverbetz.de>

I wrote:

>is this a Windows or ActivePerl (I'm using 5.8.2) bug?

seemingly both. It's a bug in the MS C stat() function, has been filed
already 2004-01 at ActiveState
http://bugs.activestate.com/show_bug.cgi?id=29239 and (likely) can be
circumvented by using Win32::UTCFileTime from CPAN (which contains a
comprehensive explanation).

Cygwin Perl doesn't need this patch.

I wonder why ActiveState doesn't solve this.

Oliver
-- 
Oliver Betz, Munich


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

Date: Thu, 14 Jul 2005 19:19:55 GMT
From: Stefan H. <stfhostf@kartos.de>
Subject: Tk: Text works with TIE, Scrolled doesn't
Message-Id: <jfedd1pg4707l27fu11d7eg7l1nbppvjhp@4ax.com>

the following code works properly, printing on Text all I print to
STDOUT

my $text = $mw->Text->pack();
tie *STDOUT, ref $text, $text;
print "prova";

but I want scrollbars, so I change to

my  $text = $mw->Scrolled("Text")->pack();

at running time Perl output the following error. What's wrong??

Tk::Error: Failed to AUTOLOAD 'Tk::Frame::TIEHANDLE' at C:\Documents and
Setting
s\manfry\Desktop\perl\prova.pl line 163
 Tk callback for .frame
 Tk callback for .frame.ysbslice
 Tk callback for .frame.ysbslice.corner
 Carp::croak at C:/perl/lib/Carp.pm line 269
 Tk::Widget::__ANON__ at C:/perl/site/lib/Tk/Widget.pm line 347
 main::stampa_struttura at C:\Documents and
Settings\temp\Desktop\perl\prova.pl line 163
 Tk callback for .button1
 Tk::__ANON__ at C:/perl/site/lib/Tk.pm line 252
 Tk::Button::butUp at C:/perl/site/lib/Tk/Button.pm line 111
 <ButtonRelease-1>
 (command bound to event)



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

Date: Thu, 14 Jul 2005 21:44:04 +0200
From: Jens Luedicke <jens.luedicke@gmail.com>
Subject: use / circular dependency issue
Message-Id: <42d6c081$0$28129$9b4e6d93@newsread4.arcor-online.net>

Hiya...

I have a module Filer, which is the baseclass for
a few other modules in the Filer:: namespace.

those modules have Filer in their @ISA array.

the Filer module itself needs a few of those
modules itself and has use statements for them.

If I try to run my program, I get warnings like:

Global symbol "$var" requires explicit package name at
Filer/FilePane.pm line XX.

$var is a variable which is exported by Filer.

It looks like a circular dependency issue to me,
but I probably miss something.

Any hints?

TIA,
Jens

-- 
Jens Luedicke
web: http://perldude.de


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

Date: Thu, 14 Jul 2005 21:51:21 +0100
From: Rob <rm@nospam.popeslane.clara.co.uk>
Subject: Writing directly to system memory
Message-Id: <BbKdnTkl4oPWTUvfRVnyvg@pipex.net>

If I have an SV that contains a real (valid) memory address I can read 
bytes from that memory address using:

   unpack("I", unpack("P4", pack("L", $address)));

Is there a similar perl mechanism that would allow me to write bytes 
back at that memory address?


Background:

Using Win32::GUI a number of callback functions for windows GUI events 
pass the a win32api lParam value to the callback.  For some events the
lParam value is a pointer to windows memory, and for some of those 
events it is necessary to change parts of the structure pointed to in 
order to get specific behaviour.

I am currently using Win32::API and the win32api RtlMoveMemory function 
to achieve what I need, but I would like to remove the Win32::API 
dependency.

Perhaps the best solution is to deal with this XS-side in the Win32::GUI 
source?

TIA for any pointers or advice,
Rob.


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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