[26079] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8280 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 26 18:05:19 2005

Date: Tue, 26 Jul 2005 15:05:06 -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           Tue, 26 Jul 2005     Volume: 10 Number: 8280

Today's topics:
        Active State Perl jane@rifill.com
        Convert hash values to list <null@void.0>
    Re: Convert hash values to list <null@void.0>
    Re: copy contructor (Anno Siegel)
    Re: copy contructor <abigail@abigail.nl>
    Re: kill 0 <bmetcalf@nortel.com>
    Re: Numeric or character ? <sven-thorsten.fahrbach@gmx.net>
    Re: OT: Social responsibility when writing HTML axel@white-eagle.invalid.uk
    Re: OT: Social responsibility when writing HTML <abigail@abigail.nl>
    Re: pattern match <someone@example.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 26 Jul 2005 19:41:18 GMT
From: jane@rifill.com
Subject: Active State Perl
Message-Id: <3u2de1d3ou13segj8ardeut4lnm174u9e9@4ax.com>

Hi All

I'm sorry to be so dum girl BUT

I have been advised that I want Active State Perl 

http://www.activestate.com/Products/ActivePerl/?psbx=1

to run on my WinXp Pro computer With Apache2

I have been to the Active state Perl site and I'm more confused to what I want for WinXp
Pro.
I think this is the one
ActivePerl-5.8.7.813-MSWin32-x86-148120.msi

Also I was informed that I wanted imagemagick also inside this is a  PerlMagick

http://studio.imagemagick.org/script/binary-releases.php#windows

BUT which one do I need for my system

Any help for a dum Girl

Thank you

Jane


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

Date: Tue, 26 Jul 2005 18:54:58 GMT
From: Shea Martin <null@void.0>
Subject: Convert hash values to list
Message-Id: <6GvFe.65584$Ph4.2055896@ursa-nb00s0.nbnet.nb.ca>

Is there a canned method converting a hash to a list of values. i.e.,

@v = values( %myhash );
@k = keys( %myhash );

BTW - I know how to do it with a loop, just wondering if there was a 
builtin...

Thanks,

~S


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

Date: Tue, 26 Jul 2005 18:58:13 GMT
From: Shea Martin <null@void.0>
Subject: Re: Convert hash values to list
Message-Id: <9JvFe.65586$Ph4.2055896@ursa-nb00s0.nbnet.nb.ca>

Shea Martin wrote:
> Is there a canned method converting a hash to a list of values. i.e.,
> 
> @v = values( %myhash );
> @k = keys( %myhash );
> 
> BTW - I know how to do it with a loop, just wondering if there was a 
> builtin...
> 
> Thanks,
> 
> ~S

I found the answer.  Man looked for about 10 mins on google, with 
nothing, usually that means it doesn't exist. I just found the answer on 
page 138 of Perl in a Nutshell.

Note to self, RTF! :-)

~S


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

Date: 26 Jul 2005 18:34:45 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: copy contructor
Message-Id: <dc5vo5$iuc$1@mamenchi.zrz.TU-Berlin.DE>

Abigail  <abigail@abigail.nl> wrote in comp.lang.perl.misc:
> Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMMCCCXLV
> September MCMXCIII in <URL:news:dc0ndi$7pg$1@mamenchi.zrz.TU-Berlin.DE>:
> 
> [ Inside-Out Objects ]
> 
> {}  
> {}  Well, paradise.  A sunlit Caribbean island with no inheritance tax.  The
> {}  one thing I don't see at a glance is how you would do multiple inheritance
> {}  that way.  Your object *is* an object of the base class, only blessed
> {}  into yours.  It can't be physically be many structures at once.
> 
> 
> If you're inheriting from two classes who use a different structure,
> it's going to be hard. With different structures, you'll have to resort
> to a has-a relationship, and dispatch all the methods of said class.

Right.  Base it on a has-a.  The crux is how to do the dispatching.

> If you are inheriting from two classes that use the same structure, you
> might be lucky, and will be able to do something by breaking encapsulation
> and merging the objects. If both classes use refs to hashes, and they don't
> use the same attributes, you can fill on hash with the content of the other.

Okay, same old same old.  Except it is now two prospective base classes
that are coupled too close for comfort, not subclass and base class.
Not sure if that's generally better, but it's an alternative, and as
such yields some leeway in design.

> Or you use a has-a relationship.

Again.  Often, that's the cleanest solution.  You have to support all
methods of the base class one way or another, so why not take an original
on board and support them through that.

> If the classes you want to inherit from are Inside-Out Objects, and their
> constructors only construct (and don't initialize) the object, multiple
> inheritance is easy:

[snip code that leads to]

>     package Perl; {
>         our @ISA = qw /Floor::Wax Dessert::Topping/;
> 
>         sub init {
>             my $self = shift;
>             $self -> Floor::Wax::init;
>             $self -> Dessert::Topping::init;
>         }
> 
>         sub colour {
>             my $self = shift;
>     
>             sprintf "%s and %s" => $self -> Floor::Wax::colour,
>                                    $self -> Dessert::Topping::colour;
>         }
>     }
> 
>     package main;
> 
>     my $p = Perl -> new -> init;
> 
>     print $p -> colour, "\n";
> 
> 
>     __END__
>     yellow and white

That's a very pretty bit of machinery.  I'll use it to study the
significance of keeping construction and initialization apart, thanks
for the example.

So "Perl" inherits whichever ->new happens to be first on @ISA, it doesn't
matter because they're all equivalent.  And if another class (not
necessarily inside-out) also had separate construction and initialization,
it should be easy to thread it into the scheme.  Correct me if I'm wrong,
but it looks like an inside-out class could inherit from such a base class
of *any* type without any further measures.

Of course, few real-world classes are like that.

Anno
-- 
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on 
"show options" at the top of the article, then click on the 
"Reply" at the bottom of the article headers.


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

Date: 26 Jul 2005 19:21:21 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: copy contructor
Message-Id: <slrnded39h.7fo.abigail@alexandra.abigail.nl>

Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMMCCCXLVII
September MCMXCIII in <URL:news:dc5vo5$iuc$1@mamenchi.zrz.TU-Berlin.DE>:
^^  
^^  So "Perl" inherits whichever ->new happens to be first on @ISA, it doesn't
^^  matter because they're all equivalent.  And if another class (not
^^  necessarily inside-out) also had separate construction and initialization,
^^  it should be easy to thread it into the scheme.  Correct me if I'm wrong,
^^  but it looks like an inside-out class could inherit from such a base class
^^  of *any* type without any further measures.


Indeed. By design. ;-)


Abigail
-- 
perl -we '$_ = q ;4a75737420616e6f74686572205065726c204861636b65720as;;
          for (s;s;s;s;s;s;s;s;s;s;s;s)
              {s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'


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

Date: Tue, 26 Jul 2005 19:17:05 +0000 (UTC)
From: Brandon Metcalf <bmetcalf@nortel.com>
Subject: Re: kill 0
Message-Id: <slrndecupg.6bh.bmetcalf@cash.rhiamet.com>

On 2005-07-26, Jim Gibson <jgibson@mail.arc.nasa.gov> wrote:
> In article <20050726113448.218$FQ@newsreader.com>, <xhoster@gmail.com>
> wrote:
>
>> Brandon Metcalf <bmetcalf@nortel.com> wrote:
>> > I'm seeing a behavior with using "kill 0,$pid" to determine if a
>> > process is running that I didn't expect.  It seems that only root can
>> > correctly get the status on processes that root or another user that
>> > is different from the one calling kill() owns.  For example,
>> >
>> ...
>> >
>> > Is this the expected behavior?  I'm sure it is since every platform
>> > and version of Perl I've tried behave the same way.
>> 
>> Given the docs for kill, it is the behavior I would expect (** mine):
>> 
>>                If SIGNAL is zero, no signal is sent to the process.  This
>>                is a useful way to check that the process is alive and
>>                **hasn't changed its UID.**  See perlport for notes on the
>>                portability of this construct.
>
> And from the 'man kill' page:
>
>      "Only the super-user may send signals to other users' processes."


Sure, I read that as well.  But Perl's implementation of signal 0 is
special in that it doesn't actually send a signal to the process.  It
simply checks to see if it's alive.  It doesn't seem that special
permissions would be required to check the existence of a process.

But, per my last post, proper permissions are required.

-- 
Brandon


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

Date: Tue, 26 Jul 2005 20:44:17 +0200
From: Sven-Thorsten Fahrbach <sven-thorsten.fahrbach@gmx.net>
Subject: Re: Numeric or character ?
Message-Id: <20050726204417.78fbf4cc.sven-thorsten.fahrbach@gmx.net>

> In general, one checks if input conforms to a certain format by 
> using  an appropriate regex match. In this case, it is a very 
> simple one:
> 
> #!/usr/bin/perl
> 
> use strict;
> use warnings;
> 
> my $input;
> 
> $| = 1;

I'm just being interested: is there any specific reason why you make output unbuffered here? I think it's not necessary for this script but maybe something has escaped me...

> 
> do {
>    print "Please enter and integer between 0 and 255: ";
>    $input = <STDIN>;
> } until $input =~ /^(\d\d?\d?)$/ and 0 + $1 < 256;
> 
> print "You entered: $input\n";


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

Date: Tue, 26 Jul 2005 19:00:32 GMT
From: axel@white-eagle.invalid.uk
Subject: Re: OT: Social responsibility when writing HTML
Message-Id: <kLvFe.37659$Pf3.14017@fe2.news.blueyonder.co.uk>

James Taylor <spam-block-@-see-my-sig.com> wrote:
> Warning: This thread is seriously off-topic now.
> In fact, I'll change the subject to reflect this.
 
 
> Abigail <abigail@abigail.nl> wrote:

>> Furthermore, I cannot imagine a "good, anticiapting programmer"
>> writing &lt; instead of '<' inside quotes for the "difficulties"
>> someone might have parsing HTML, and then leaving off the quotes.
 
> Which of the following techniques would *you* choose:

Some of your [snipped] examples have nothing to do HTML as such,
but just various things in webpages.

> I could probably go on to fill a book with a list of these
> sort of choices, but then I'm an experienced web developer
> with sufficient clue. The vast majority of kiddie web
> deeziners out there would be completely oblivious to the
> existence of a choice, and anyway would pick (a) from every
> selection just because it's the newest wizzy technology that
> gives them the maximum scope for creativity, "so it *has* to
> be the right choice doesn't it". It would never even occur

That is their problem... as their clients may soon realise.

> to them that using minimal new technology to achieve their
> goals is better than using the maximally new and fragile
> technique. Such deeziners have little understanding of what
> they're doing (beyond the use of whatever wysiwyg editor
> they're using) and they care even less about social niceties,
> such as ensuring accessibility to the widest audience,
> keeping their HTML and graphics small, neat and efficient
> for the benefit dial-up modem users, web caches, etc, or
> allowing people to view the site on any browser, at any font
> size, or in any window size. They don't care about allowing
> people (or bots) to automatically crawl and scrape the site,
> in fact they probably think that's a *bad* thing and would
> prefer everyone to enter their site only from the front page
> so they can throw the right combination of popup advertising
> at the hapless suckers!
 
> Not only does the appallingly fragile construction of most
> websites reduce the general quality of the web, but it also
> imposes a pressure of extinction on minority browsers and
> platforms that don't have sufficient market share and
> financial muscle to keep up with the grubby complexity that
> results from this.

Is that not a reason to keep to standards?

> Furthermore, it raises the barrier for
> entry to anyone wishing to write their own browser, crawler,
> or other web client. Despite being a competent Linux user
> and fan, I still do the majority of my work on an alternative
> platform (RISC OS) because its GUI usability *completely*
> outclasses anything available on Linux. (Of course, I have
> it networked to my Linux box for the best of both worlds.)
> Alternative platforms have much to offer and, just as we
> should look after the bio-diversity of the rainforest, we
> should avoid needlessly killing off computing platforms in a
> mindless lust for the latest kewl thing, otherwise we'll
> look back and wonder why we didn't see it coming when some
> megacorp owns the world and there are no freedoms left.

Which computing platforms are being killed off? Hardly Solaris -
I have both Sparc and Intel editions at home and they run quite
well without regard to any HTML standard.  HP-UX? A system I would
run Oracle on, not a web browser.

> So you see, you might think it's a small thing, but when I
> see someone advocating the use of fragile markup (needlessly)
> in the full knowledge that some browsers won't cope with it
> and suggesting that browsers should just get fixed and
> upgraded, I hope you now see why I oppose this socially
> harmful and myopic attitude as a matter of utmost principle.

No. If a browser cannot cope with good markup - it is the
fault of the browser. Being able to cope with bad markup is
a plus sign.

I design the webpages from my own site (no, I am not going to
make a plug for it as it would be of little interest to anyone)
to be Lynx viewable - except those containing photographs.

Axel

 


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

Date: 26 Jul 2005 20:12:06 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: OT: Social responsibility when writing HTML
Message-Id: <slrnded68m.7fo.abigail@alexandra.abigail.nl>

James Taylor (spam-block-@-SEE-MY-SIG.com) wrote on MMMMCCCXLVII
September MCMXCIII in <URL:news:ant2616467d6fNdQ@riscpc.jtnet>:
;;  
;;  In article <slrndeat4j.7fo.abigail@alexandra.abigail.nl>,
;;  Abigail <abigail@abigail.nl> wrote:
;; > 
;; > Furthermore, I cannot imagine a "good, anticiapting programmer"
;; > writing &lt; instead of '<' inside quotes for the "difficulties"
;; > someone might have parsing HTML, and then leaving off the quotes.
;;  
;;  Perhaps, but the parser has to cope with HTML from both experts
;;  *and* amateurs. To cope with missing quotes from amateurs,
;;  it might choose to treat the first > as the tag terminator
;;  then look to see if it can make sense of the tag contents.

This is the one of the most remarkable pieces of bullshit I've ever
seen. The only reason people (used) to be able "to get away" with not
using a closing quote was the losing coding talents of Marc Andreessen
and his seven little dwarves. They never put anything smart in their
parser "to cope with HTML from both experts and amateurs".  They were
bad programmers themselves, and just assumed any > would close the tag.

;;  It occurs to me that you may be confusing this hypothetical
;;  parser with one that I would write, but that's not my point.

Well, it was you who didn't know you could use a '>' inside an attribute
value, and it was you would said HTML would "get what they deserve" if
they used '>' inside an attribute value (instead of &gt;), so you were
giving me all the reasons to assume you would write an HTML parser in
such a way.

;;  You may also be confusing the poor HTML that the parser is
;;  trying to defend against as something I might write, but
;;  that isn't my point either.
;;  
;;  My point is that anyone writing HTML for public consumption
;;  must be mindful of the fact that it will be interpreted by
;;  all manner of parsers; some good, some bad, some good but old,
;;  some new but poor, and some that for pragmatic reasons are
;;  operating in quirks mode to defend against poor HTML. So,
;;  as long as the HTML author doesn't produce invalid HTML,
;;  they should make sensible choices to guard against likely
;;  faults in HTML parsers (unless they don't give a damn about
;;  the web in the first place, of course).

Well, there *have* been browsers that *didn't* do entity expansion inside
attribute values, so if you would "defend" against those, you wouldn't 
write '&gt;' inside an attribute value, but '>'.

;; > I really hate that attitude. Instead of blaming the people
;; > writing buggy browsers, or other bad parsers, you blame the
;; > people writing HTML!
;;  
;;  That's because web developers should know better and anyway
;;  can make corrections easily, whereas on many minority
;;  computing platforms there is no choice of web browser. The
;;  user has to use what's available, or write their own which
;;  is usually not practical or even possible.


And that's how bad web browsers stay in business. Why bother fixing
your shitty product, if everyone else will fix their correct code?
It's better to spend your time implementing <BLINK>!



Abigail
-- 
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
                                      print } sub __PACKAGE__ { &
                                      print (     __PACKAGE__)} &
                                                  __PACKAGE__
                                            (                )


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

Date: Tue, 26 Jul 2005 20:20:15 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: pattern match
Message-Id: <3WwFe.133362$HI.121115@edtnps84>

Geezer From The Freezer wrote:
> @a contains:-
> 
> abcdefg1234
> 1234 this is a test
> test
> test 1234
> 
> I want to print everything with 1234 so:-
> 
> $list = @a =~ /1234/ ;
> chomp($list);
> print ($list);
> 
> Why doesn't this work? :(

The binding operator (=~) operates on scalars so the array is used in
scalar context which in this case results in the expression

'4' =~ /1234/

and the match operator (m//) is evaluated in scalar context because it
is being assigned to a scalar which in this case is assigned the value
'' (false) because /1234/ doesn't match '4'.

perldoc perlop


> Be grateful if someone can point me in the right direction.

perldoc -f grep


John
-- 
use Perl;
program
fulfillment


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

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


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