[30411] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1654 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 18 06:09:49 2008

Date: Wed, 18 Jun 2008 03:09:08 -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           Wed, 18 Jun 2008     Volume: 11 Number: 1654

Today's topics:
        [regex] grep for chars in any order <vikimun@gmail.com>
    Re: [regex] grep for chars in any order <benkasminbullock@gmail.com>
    Re: Help with Hash of Hashes sharma__r@hotmail.com
    Re: Learning Perl <sbour@niaid.nih.gov>
    Re: Learning Perl <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: Learning Perl <jurgenex@hotmail.com>
    Re: Learning Perl <dragnet\_@_/internalysis.com>
    Re: Learning Perl <uri@stemsystems.com>
        new CPAN modules on Wed Jun 18 2008 (Randal Schwartz)
        Ripping out parts of a DOM using XML::XSLT <NiallBCarter@googlemail.com>
    Re: Ripping out parts of a DOM using XML::XSLT <bjoern@hoehrmann.de>
    Re: Ripping out parts of a DOM using XML::XSLT <NiallBCarter@googlemail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 18 Jun 2008 00:06:12 -0700 (PDT)
From: viki <vikimun@gmail.com>
Subject: [regex] grep for chars in any order
Message-Id: <4a43915e-e84a-4fc8-a56f-507bcf79de4d@w7g2000hsa.googlegroups.com>

How can I build regex that matches all characters of the string $STR
in any order with  .* added between any two characters: ?
And without generating all N! transpositions (where N is length of
$STR) ?
Example.
For $STR "abc", I want to match equivalent to:
/(a.*b.*c)|(a.*c.*b)|(b.*a.*c)|(b.*c.*a)|(c.*a.*b)|(c.*b.*a)/

Generating all transpositions is not feasible for larger legths of
$STR.
/[abc].*[abc].*[abc]/ is easy and fast but gives false positives.
What is good solution ?

Thanks
vkm


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

Date: Wed, 18 Jun 2008 09:47:55 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: [regex] grep for chars in any order
Message-Id: <g3alkb$o98$1@ml.accsnet.ne.jp>

On Wed, 18 Jun 2008 00:06:12 -0700, viki wrote:

> How can I build regex that matches all characters of the string $STR
> in any order with  .* added between any two characters: ?
> And without generating all N! transpositions (where N is length of
> $STR) ?
> Example.
> For $STR "abc", I want to match equivalent to:
> /(a.*b.*c)|(a.*c.*b)|(b.*a.*c)|(b.*c.*a)|(c.*a.*b)|(c.*b.*a)/
> 
> Generating all transpositions is not feasible for larger legths of
> $STR.
> /[abc].*[abc].*[abc]/ is easy and fast but gives false positives.
> What is good solution ?

I don't think a single regular expression can do that, because there is 
some logic involved which doesn't fit the regular expression mentality - 
you have to work out what the first character matched was, then change 
the second character to match depending on that, and so on.

I would use the easy and fast method and then remove the false positives 
by checking that the matched string contained all n characters, perhaps 
using s or tr n times and dropping out of the loop if one of my 
substitutions failed.

The following seems to work, although I haven't tested it extensively:

#!/usr/local/bin/perl
use warnings;
use strict;

sub matches
{
    my ($s, $STR) = @_;
    my %chars = map {$_ => 1} split ('', $STR);
    my @chars = sort keys %chars;
    my $anychar = join '', @chars;
    my $matchany = join '.*',map "[$anychar]", @chars; # there's a better 
way
    if ($s =~ /$matchany/) {
	my $copy = $s;
	for my $c (@chars) {
	    return unless $copy =~ s/$c//g;
	}
	return 1;
    }
    return;
}

print "OK\n" if (matches('naninuneno','aeiou'));
print "OK\n" if (matches('naninunene','aeiou'));


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

Date: Wed, 18 Jun 2008 01:11:01 -0700 (PDT)
From: sharma__r@hotmail.com
Subject: Re: Help with Hash of Hashes
Message-Id: <5d368c28-27d1-4bc5-a3a3-8772c5f718ff@c19g2000prf.googlegroups.com>

On Jun 17, 9:25 am, Kevin Brammer <kncb...@mapson.hawaii.rr.com> wrote
[...snipped...]


#!/usr/local/bin/perl

use strict;
use warnings;

my $NL = qq{\n};

local $\ = $NL;

my %defaults = (
	entry1 => "0",
	entry2 => "0",
	entry3 => "0",
	entry4 => "0",
);

open my $inp_fh, '<', 'inp'
	or die "Cannot open the file [inp]: $!";

my %HoH;

my ($item, $knt);

while (my $line = <$inp_fh>) {
	chomp $line;

	if ($line =~ m/ \A \S+ /xms) {
		$item = $line;
		$HoH{ $item } = { %defaults };
		$knt = 0;
	}
	elsif ($line =~ m/ \A \s+ [-] \s+ \S /xms) {
		(my $entry = $line) =~ s/ \A \s+ [-] \s+ //xms;
		$HoH{ $item }->{ q{entry} . ++$knt } = $entry;
	}
}

close $inp_fh
	or die "Cannot close the file [inp] after reading: $!";
################### End ################


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

Date: Tue, 17 Jun 2008 22:03:39 -0700
From: "Stephan Bour" <sbour@niaid.nih.gov>
Subject: Re: Learning Perl
Message-Id: <MG06k.5514$N87.573@nlpi068.nbdc.sbc.com>

Keith Keller wrote:
} On 2008-06-18, Stephan Bour <sbour@niaid.nih.gov> wrote:
} > Jürgen Exner wrote:
} > } Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> wrote:
} > } >
} > } > ''Gordon'' has been doing many things wrong for some time now;
} >
} > Then please, give an example.
}
} The many morphings; the nitpicking over the documentation without
} writing a patch; the not actually reading the documentation while
} arguing about what Perl functions actually do.  Is that enough?

Those are not examples. Please give actual message-ids or some other citing.

} > } > while Uri and the rest of us would probably be better off
} > ignoring him
} >
} > Who are "the test of us" ?

> "The rest of us" is everyone who posts to clpmisc.

Are you saying "everyone who posts to clpmisc" has given you permission to 
speak for them? If so, please cite.

} > } > (would you argue with
} > the-japanese-lizard-which-shall-not-be-named } > about these
} > topics?),
} >
} > Which topics?
}
} See above.

Above where? You haven't cited anything. You just gave us your opinion, 
which may or may not be accurate.

} > Maybe you should define what you mean by "morphing"? This would
} > appear to be one of those terms with varying definitions.
}
} Surprisingly enough, I couldn't find a definition in the jargon file.
} The definitions I use are "changing one's headers in an attempt to
} evade killfiles" or "changing one's headers excessively".  The From:
} header is the header I see most commonly morphed.

Well that's a rather broad definition. The way I see it, if someone changes 
their name to appear to be someone else, then that is malicious act. If 
someone changes their email address, that's their business. The problem here 
seems to be too many people attempting to impose their own legislations in a 
realm (Usenet) where such rules to not exist.

No one is actually bound to conforming to anyone's killfile or filter. You 
can cry about it all you want. I don't mind killfiles personally, but I do 
mind it when people lay down the last word and end it with "plonk" or so and 
act as if they have won the argument. I would not do it myself, but I'm not 
surprised some people change their email addresses to avoid it. If you 
really don't want to read what someone has to say, then simply don't  :~)

} > In his case, he changed his email, not his name. I've always known
} > "morphing" to mean someone who changes either their name or both
} > their name & email address, but not changing their email address
} > alone.
}
} I hope you're not seriously buying this argument

Rather than being so forward, could you explain what exactly you find wrong 
with it? I have no problem with someone changing their email address - it's 
their information. If they use the same name, you still know who they are, 
so what really is the problem (other than the fact they have gone around 
your filters) ?

} (if so, I'd have to consider seriously whether you are actually
} ''Gordon'' hiding behind yet another alias).

What other aliases has he used? I keep seeing allegation after allegation 
being made but not one single citing. What guarantee do I or anyone have 
that what you say or your information is accurate, and that you're not just 
siding with people like Uri just because they are a regular? Mind you, this 
wouldn't be the first time the latter has caused problems in this group.

} There is no Name: header.  There is no Email: header.

Who said there was?

} There is just the From: header (and the Reply-To: header,
} which is used much less frequently).

Yes, but what is your point? Most ( at least graphical) clients will show 
just the name in the topic list and it's a person's name that tells you who 
they are, not the email address. I consider the email address to be the 
means to contact someone outside of Usenet.

} Since most clients killfile first on the From: header, changing it,
} whether the name or the email address, circumvents any killfile
} entries people have made with the original From: header.

Most decent clients I've seen allow you to filter on any part, though 
filtering on From: and Reply-To: are inherently unreliable, in that you can 
not fully filter out anyone who makes the slightest change, must like the 
problems associated with filtering mass email spammers. Advanced filter will 
go further, such as filtering other headers.

} I can already hear your response: but you can use a regexp in
} killfiles! Sure, but I find that I seldom need a regexp except for
} real trolls.

Actually regex did pop into mind, maybe it's because I'm practically joined 
at the hip with them when using Perl :->

} (And, by the way, ''Gordon'' has already used at least three different
} versions of his name; I have a hard time coming up with a reasonable
} explanation for this morphing.)

All I've seen is a middle name. I've seen people occasionally do that, as 
it's no crime, though it's unusual if it happens frequently.

} > That aside, what appears to be happening here is people like Uri
} > ganging up on this guy because they are not seeing eye to eye. This
} > to me is just wrong.
}
} I agree.  In general, replies should be mostly civil; since it's not
} generally possible to be civil with a troll, they should be ignored
} except to correct blatant errors in their posts (which ''Gordon''
} seems to make less frequently, though still at a nonzero rate, than
} other trolls).

There you go again, tossing around the "troll" label much to easily. I 
haven't really seen him acting like a troll. What I have seen is him being 
forced onto the defensive by people like Uri, which to me is not the same as 
a real troll who waltzes in just to get attention.

} > On Usenet many people like yourself and Uri use words like "troll"
} > much to easily. I don't think it was ever meant to be a crutch to be
} > used by people of influence to win arguments and discredit those
} > they do not agree with. Like with any term that's over used, it
} > becomes ever the more meaningless.
}
} Have you come to this conclusion based on an extensive research of
} mine (and Uri's) posting history?  Because by my count I have about
} five in my killfile.  I wouldn't call that excessive, would you?

By the count of your killfile, no, but that isn't what I was referring to. I 
was talking about the usage of the word. Some of you use it much to 
casually, so it's hard to give it much worth just by it simply being 
uttered.

} (And I'm flattered that you seem to think I am a person of influence,
} but I can tell you, at least in the Perl community, I'm not.)

Well you are better known here than I. What I meant is anyone who has been 
around and knows better should not be such mechanisms to achieve the upper 
hand in an argument. That isn't what Usenet was originally about.



Stephan. 




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

Date: Tue, 17 Jun 2008 22:14:01 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Learning Perl
Message-Id: <p5imi5x2h4.ln2@goaway.wombat.san-francisco.ca.us>

On 2008-06-18, Stephan Bour <sbour@niaid.nih.gov> wrote:
> If you 
> really don't want to read what someone has to say, then simply don't  :~)

Good idea.

--keith



-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information



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

Date: Wed, 18 Jun 2008 05:42:23 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Learning Perl
Message-Id: <4t6h54pbtbp14hsm3lp2qe6djk9qufgvc5@4ax.com>

"Stephan Bour" <sbour@niaid.nih.gov> wrote:
>[about filtering]
>surprised some people change their email addresses to avoid it. 

I dare to claim the right to select whom I want to listen to. While
everyone has the right to express himself, there is no right that he has
to be heard. 

I don't care what a certain nutcase posts. I don't want to read it. I
don't want anything to do with it. I am happy to do anything reasonable
on my part to avoid his posts. 
However if someone deliberately changes his FROM header with the
expressed purpose(!) of avoiding not being heard, then that is simply
stalking and in many jurisdictions a criminal act.

>If you 
>really don't want to read what someone has to say, then simply don't  :~)

Don't worry, I won't be reading you any more.

jue


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

Date: Wed, 18 Jun 2008 01:48:00 -0500
From: Marc Bissonnette <dragnet\_@_/internalysis.com>
Subject: Re: Learning Perl
Message-Id: <Xns9AC11C7BA545Fdragnetinternalysisc@216.196.97.131>

Jürgen Exner <jurgenex@hotmail.com> fell face-first on the keyboard. This 
was the result: news:4t6h54pbtbp14hsm3lp2qe6djk9qufgvc5@4ax.com:

> "Stephan Bour" <sbour@niaid.nih.gov> wrote:
>>[about filtering]
>>surprised some people change their email addresses to avoid it. 
> 
> I dare to claim the right to select whom I want to listen to. While
> everyone has the right to express himself, there is no right that he has
> to be heard. 
> 
> I don't care what a certain nutcase posts. I don't want to read it. I
> don't want anything to do with it. I am happy to do anything reasonable
> on my part to avoid his posts. 
> However if someone deliberately changes his FROM header with the
> expressed purpose(!) of avoiding not being heard, then that is simply
> stalking and in many jurisdictions a criminal act.

I have to agree strongly with this point: While one may have the "right" to 
change one's From: header ("right" as in, it's your app, your information, 
your computer), it is simply childish attention getting [1] to change your 
From: header for the sole purpose of getting around filters. If someone has 
decided they don't want to read - and therefore respond - to your content, 
who are you [2] to force them to see your content ?

The "simply don't read it" argument doesn't wash: Killfiles and regexes 
being used in said killfiles are there to give the choice *not* to read 
even the subject line in the group display. 

I hadn't quite thought of it this way, but Jürgen raises an excellent 
point: It is akin to stalking. Imagine, if you will, a parent telling their 
kid to stay away from the dark alley to avoid the bullies - Using your 
killfile is akin to exactly that - Avoiding the unpleasantness. 
Constantly/frequently (as in - more than once per year) changing your From: 
header is the bullies leaving the alley to follow you around the 
neighbourhood. 




[1] I'll admit to doing this myself about three times in fifteen years - 
Twice when the heat of an online argument got the better of me and once to 
respond to a nutjob who supposedly had me killfiled, but used Google Groups 
to reply to my posts when others were agreeing with them - In all three 
cases, still childish and plain dumb. Other than that, my dragnet@ address 
has remained the same for ten years or so, with only one change to add \_ 
and _/ around the @ to mildly mess up harvesters.

[2] "You" in the generic sense, not specifically aimed at any one person in 
this thread.



-- 
Marc Bissonnette
Looking for a new ISP? http://www.canadianisp.com
Largest ISP comparison site across Canada.


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

Date: Wed, 18 Jun 2008 08:02:26 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Learning Perl
Message-Id: <x74p7ruq5o.fsf@mail.sysarch.com>

>>>>> "GCE" == Gordon Corbin Etly <g....c.e@gmail.com> writes:

  >> use strict ;
  >> use warnings ;
  >> 
  >> foreach ( 1 .. 3 ) {
  >> 
  >> my @array ;
  >> print "defined $_\n" if defined @array ;
  >> print "empty $_\n" unless @array ;
  >> @array = (1) ;
  >> }

  GCE> Yes you've already posted this. It actually shows what appears to
  GCE> be broken behavior, given how a new @array is created each time
  GCE> through the loop. And you still haven't answered my question of
  GCE> why it would be bad to fix define in a way that it works with
  GCE> scalars - it doesn't seem unreasonable, especially when that's
  GCE> almost how it works currently, deprecated or not.

see you don't get it. it isn't broken behavior but behavior that
shouldn't have been there to begin with. like my $x = 1 if 0 stuff which
does something that was bad but not deprecated until recently.

and it doesn't almost work that way. and you don't get how allocation
works or the difference between a scalar value and an aggregate of
them. just let this go as you don't want to learn those things and you
are hanging on your little island hoping to be rescured. p5p ain't
coming to rescue you. defined on aggregates was never meant to be used
and now it will go away like it should.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Wed, 18 Jun 2008 04:42:19 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Jun 18 2008
Message-Id: <K2n6EJ.1MB9@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Algorithm-Evolutionary-0.55
http://search.cpan.org/~jmerelo/Algorithm-Evolutionary-0.55/
Perl extension for performing paradigm-free evolutionary algorithms. 
----
Algorithm-Scale2x-0.03
http://search.cpan.org/~bricas/Algorithm-Scale2x-0.03/
Generic implementation of the Scale2x algorithm 
----
Amazon-Bezos-0.001
http://search.cpan.org/~tima/Amazon-Bezos-0.001/
----
Application-BackupAndRestore-0.02
http://search.cpan.org/~hooo/Application-BackupAndRestore-0.02/
----
Audio-MPD-0.19.2
http://search.cpan.org/~jquelin/Audio-MPD-0.19.2/
class to talk to MPD (Music Player Daemon) servers 
----
B-Debug-1.08
http://search.cpan.org/~rurban/B-Debug-1.08/
Walk Perl syntax tree, printing debug info about ops 
----
Bundle-Perl-Critic-1.021
http://search.cpan.org/~elliotjs/Bundle-Perl-Critic-1.021/
A CPAN bundle for Perl::Critic and related modules 
----
Bundle-Perl-Critic-IncludingOptionalDependencies-1.001001
http://search.cpan.org/~elliotjs/Bundle-Perl-Critic-IncludingOptionalDependencies-1.001001/
Install everything Perl::Critic plus its optional dependencies. 
----
Bundle-Seqsee-0.01
http://search.cpan.org/~amahabal/Bundle-Seqsee-0.01/
Modules required by Seqsee not in core 
----
CGI-Session-4.32
http://search.cpan.org/~markstos/CGI-Session-4.32/
persistent session data in CGI applications 
----
Catalyst-Plugin-CustomErrorMessage-0.03
http://search.cpan.org/~jkutej/Catalyst-Plugin-CustomErrorMessage-0.03/
Catalyst plugin to have more "cute" error message. 
----
Catalyst-Plugin-SmartURI-0.021
http://search.cpan.org/~rkitover/Catalyst-Plugin-SmartURI-0.021/
Configurable URIs for Catalyst 
----
Catalyst-Plugin-StripScripts-0.1
http://search.cpan.org/~xern/Catalyst-Plugin-StripScripts-0.1/
XSS filter plugin 
----
Continuity-0.994
http://search.cpan.org/~awwaiid/Continuity-0.994/
Abstract away statelessness of HTTP, for stateful Web applications 
----
Crypt-Random-Source-0.03
http://search.cpan.org/~nuffin/Crypt-Random-Source-0.03/
Get random weak or strong random data. 
----
Crypt-Random-Source-SSLeay-0.01
http://search.cpan.org/~nuffin/Crypt-Random-Source-SSLeay-0.01/
Net::SSLeay support for Crypt::Random::Source 
----
Crypt-Random-Source-Weak-OpenSSLRand-0.01
http://search.cpan.org/~nuffin/Crypt-Random-Source-Weak-OpenSSLRand-0.01/
Use OpenSSL::Rand as a Crypt::Random::Source 
----
DataExtract-FixedWidth-0.07
http://search.cpan.org/~ecarroll/DataExtract-FixedWidth-0.07/
The one stop shop for parsing static column width text tables! 
----
DateTime-Format-RSS-0.03000
http://search.cpan.org/~dmaki/DateTime-Format-RSS-0.03000/
Format DateTime For RSS 
----
Devel-Hints-Lexical-0.01
http://search.cpan.org/~chocolate/Devel-Hints-Lexical-0.01/
make %^H lexically-scoped 
----
Devel-Hints-Lexical-0.02
http://search.cpan.org/~chocolate/Devel-Hints-Lexical-0.02/
make %^H lexically-scoped 
----
Devel-Hints-Lexical-0.03
http://search.cpan.org/~chocolate/Devel-Hints-Lexical-0.03/
make %^H lexically-scoped 
----
Devel-Hints-Lexical-0.04
http://search.cpan.org/~chocolate/Devel-Hints-Lexical-0.04/
make %^H lexically-scoped 
----
Devel-Hints-Lexical-0.05
http://search.cpan.org/~chocolate/Devel-Hints-Lexical-0.05/
make %^H lexically-scoped 
----
GD-Image-Scale2x-0.06
http://search.cpan.org/~bricas/GD-Image-Scale2x-0.06/
Implementation of the Scale2x algorithm for the GD library 
----
Ganglia-Gmetric-XS-1.00
http://search.cpan.org/~hirose/Ganglia-Gmetric-XS-1.00/
send a metric value to gmond with libganglia C library 
----
Goto-Cached-0.09
http://search.cpan.org/~chocolate/Goto-Cached-0.09/
a fast drop-in replacement for Perl's O(n) goto 
----
HTTP-Server-Singlethreaded-0.10
http://search.cpan.org/~davidnico/HTTP-Server-Singlethreaded-0.10/
a framework for standalone web applications 
----
IO-AIO-3.04
http://search.cpan.org/~mlehmann/IO-AIO-3.04/
Asynchronous Input/Output 
----
IPTables-libiptc-0.06
http://search.cpan.org/~hawk/IPTables-libiptc-0.06/
Perl extension for iptables libiptc 
----
IPTables-libiptc-0.07
http://search.cpan.org/~hawk/IPTables-libiptc-0.07/
Perl extension for iptables libiptc 
----
JSON-2.11
http://search.cpan.org/~makamaka/JSON-2.11/
JSON (JavaScript Object Notation) encoder/decoder 
----
LSF-Base-0.07
http://search.cpan.org/~lsfisv/LSF-Base-0.07/
Object oriented Perl extension for use with the Platform Computing Corporation's Load Sharing Facility (LSF) Base product. 
----
LSF-Batch-0.06
http://search.cpan.org/~lsfisv/LSF-Batch-0.06/
Perl extension for using with the Platform Computing Corporation's Load Sharing Facility (LSF) Batch product. 
----
LWP-Protocol-https-SocksChain-1.6
http://search.cpan.org/~gosha/LWP-Protocol-https-SocksChain-1.6/
Speak HTTPs through Net::SC 
----
LWP-Protocol-https-SocksChain10-1.5
http://search.cpan.org/~gosha/LWP-Protocol-https-SocksChain10-1.5/
Speak HTTPs through Net::SC 
----
LaTeX-Pod-0.18
http://search.cpan.org/~schubiger/LaTeX-Pod-0.18/
Transform LaTeX source files to POD (Plain old documentation) 
----
Lingua-Alphabet-Phonetic-0.101
http://search.cpan.org/~mthurn/Lingua-Alphabet-Phonetic-0.101/
map ABC's to phonetic alphabets 
----
Net-Radius-Client-0.03
http://search.cpan.org/~ilya/Net-Radius-Client-0.03/
Pure-Perl, VSA-empowered RADIUS client 
----
Net-Z3950-ZOOM-1.24
http://search.cpan.org/~mirk/Net-Z3950-ZOOM-1.24/
Perl extension for invoking the ZOOM-C API. 
----
OpenResty-0.3.3
http://search.cpan.org/~agent/OpenResty-0.3.3/
General-purpose web service platform for web applications 
----
OpenResty-0.3.4
http://search.cpan.org/~agent/OpenResty-0.3.4/
General-purpose web service platform for web applications 
----
OpenResty-0.3.5
http://search.cpan.org/~agent/OpenResty-0.3.5/
General-purpose web service platform for web applications 
----
POE-Component-Client-Whois-Smart-0.12
http://search.cpan.org/~nrg/POE-Component-Client-Whois-Smart-0.12/
Provides very quick WHOIS queries with smart features. 
----
POE-Session-GladeXML2-0.40
http://search.cpan.org/~martijn/POE-Session-GladeXML2-0.40/
emit POE events for Gtk2 callbacks 
----
Perl-Critic-Compatibility-1.001
http://search.cpan.org/~elliotjs/Perl-Critic-Compatibility-1.001/
Policies for Perl::Critic concerned with compatibility with various versions of Perl. 
----
Regexp-Assemble-0.34
http://search.cpan.org/~dland/Regexp-Assemble-0.34/
Assemble multiple Regular Expressions into a single RE 
----
Rose-DBx-Object-Renderer-0.12
http://search.cpan.org/~danny/Rose-DBx-Object-Renderer-0.12/
Web UI Rendering for Rose::DB::Object 
----
String-CaseProfile-0.07
http://search.cpan.org/~enell/String-CaseProfile-0.07/
Get/Set the letter case profile of a string 
----
Sub-Contract-0.08
http://search.cpan.org/~erwan/Sub-Contract-0.08/
Pragmatic contract programming for Perl 
----
Sys-Info-0.52_4
http://search.cpan.org/~burak/Sys-Info-0.52_4/
Fetch information from the host system 
----
Test-Environment-0.04
http://search.cpan.org/~jkutej/Test-Environment-0.04/
Base module for loading Test::Environment::Plugin::* 
----
Text-CSV_XS-0.51
http://search.cpan.org/~hmbrand/Text-CSV_XS-0.51/
comma-separated values manipulation routines 
----
Text-MediawikiFormat-0.06
http://search.cpan.org/~dprice/Text-MediawikiFormat-0.06/
Translate Wiki markup into other text formats 
----
Text-Templet-2.9
http://search.cpan.org/~dpetrov/Text-Templet-2.9/
template processor built using Perl's eval() 
----
Video-Xine-0.18
http://search.cpan.org/~stephen/Video-Xine-0.18/
Perl interface to libxine 
----
WSST-0.1.1
http://search.cpan.org/~kawasaki/WSST-0.1.1/
WebService Specification Schema Tool(WSST) 
----
WebService-Linode-0.01
http://search.cpan.org/~mikegrb/WebService-Linode-0.01/
Perl Interface to the Linode.com API. 
----
Wiki-Toolkit-Formatter-Mediawiki-0.03
http://search.cpan.org/~dprice/Wiki-Toolkit-Formatter-Mediawiki-0.03/
A Mediawiki-style formatter for Wiki::Toolkit. 
----
Wiki-Toolkit-Store-Mediawiki-0.06
http://search.cpan.org/~dprice/Wiki-Toolkit-Store-Mediawiki-0.06/
Mediawiki (MySQL) storage backend for Wiki::Toolkit 
----
Win32-FetchCommand-0.04
http://search.cpan.org/~clive/Win32-FetchCommand-0.04/
Filename extension association resolution. 
----
XML-Grammar-ProductsSyndication-0.03
http://search.cpan.org/~shlomif/XML-Grammar-ProductsSyndication-0.03/
an XML Grammar for ProductsSyndication. 
----
XML-Quick-0.03
http://search.cpan.org/~robn/XML-Quick-0.03/
Generate XML from hashes (and other data) 
----
libwww-perl-5.813
http://search.cpan.org/~gaas/libwww-perl-5.813/
----
parrot-0.6.3
http://search.cpan.org/~smash/parrot-0.6.3/


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


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

Date: Wed, 18 Jun 2008 01:31:48 -0700 (PDT)
From: NiallBCarter <NiallBCarter@googlemail.com>
Subject: Ripping out parts of a DOM using XML::XSLT
Message-Id: <eaaa77db-2914-492f-98f1-18fdaf67cbb4@k37g2000hsf.googlegroups.com>

Hey folks

I have what I think is a simple task but one that I am struggling
with.
I have this KML (Slightly abridged)

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0" xmlns:gml="http://
www.opengeospatial.org/standards/gml">
 <Document>
 <open>0</open>
<name>Gazetteer for Scotland</name>
<Placemark>
    <name> Troon </name>
    <description>A resort town on the coast of Kyle in Ayrshire, Troon
lies at the north end of Ayr Bay on a headland that extends into the
    </description>
    <Point id="t476">
      <coordinates>-4.6562,55.54207,0</coordinates>
    </Point>
    <Link>http://www.geo.ed.ac.uk/scotgaz/towns/townfirst476.html
    </Link>
</Placemark>
<Placemark>
    <name> Niall Home </name>
    <description>Not a lovely little home in the western isles
    </description>
    <Point id="t576">
      <coordinates>-5.3454,53.46532,0</coordinates>
    </Point>
    <Link>http://www.geo.ed.ac.uk/scotgaz/towns/townfirst576.html
    </Link>
</Placemark>
<ExtendedData xmlns:GforS="http://www.geo.ed.ac.uk/scotgaz/">
	 <GforS:Copyright>
		 &lt;p&gt;All Images and Text are Copyright (c) The Gazetteer for
Scotland 1995-2008 &lt;/p&gt;
	 </GforS:Copyright>
</ExtendedData>
</Document>
</kml>

This KML is generated by a perl script lying on the web and so I am
able to 'get' this KML from the web and parse it into a DOM using the
script below:



#!/usr/bin/perl

use XML::DOM;
use Data::Dumper;
use LWP::Simple;
use XML::DOM::XPath;
use LWP::UserAgent;

my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;

 #Gets the contents of the URLs
my $sg_get = $ua->get('http://www.geo.ed.ac.uk/scotgaz/cgi_bin/mid/
module2/scotgaz.pl?xmin=232095&ymin=630744&xmax=232695&ymax=631344');

  #Creates instance of new XML::DOM::Parser and uses to make new DOM
object
my $parser = new XML::DOM::Parser;

  # Parses the contents of the 'got' URL
my $sg_dom = $parser->parse ($sg_get->content);

 #Prints the contents of a DOM::Parsed document to the screen
#print Dumper($sg_dom);

 #Saves the content of the DOM to a file
#$sg_dom->printToFile ("out.kml");

$sg_dom->dispose;



What I would actuallylike to do is use an XSL to pull out only the
Placemarks (including the placemark tags).
The reason for this is that I actually have four of these KML files
and I want to rip out all the Placemarks from each KML and then using
DOM (i know how to) put all the placemarks into one single KML and
serve this out to the user.

So how far have I got?
Well, the XSL file I am using is:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" version="1.0" omit-xml-
declaration ="no"/>

<xsl:template match="/Document/Placemark">
<xsl:for-each select="kml/document/Placemark">
<Placemark>
    <name><xsl:for-each select="kml/document/Placemark/name"></name>
</Placemark>
</xsl:for-each>
);


As you can see it is only getting the name from each Placemark and it
doesn't work! When using with teh perl script:

#!/usr/local/bin/perl

use XML::XSLT;
use strict;
use warnings;

my $xsl="xsl.xsl";
my $xml="out.kml";

# Create an instance of XSLT
my $xslt = eval { XML::XSLT->new($xsl, warnings => 1, debug => 0) };

print $xslt->to_dom;

# Free the memory
$xslt->dispose();

It says that it cannot create an instance of the XSL! For the moment I
have written my KML to a file to ease things up a little.

So can any of you people help? In the past I have found you all really
helpful and so I hope you can help me with this one! Sorry for the
long post but I wanted to try to get all the info down!

Cheers,

Niall



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

Date: Wed, 18 Jun 2008 10:53:36 +0200
From: Bjoern Hoehrmann <bjoern@hoehrmann.de>
Subject: Re: Ripping out parts of a DOM using XML::XSLT
Message-Id: <oqih54t0ho9pbbo6t0af6mpfc4vcaq3kq9@hive.bjoern.hoehrmann.de>

* NiallBCarter wrote in comp.lang.perl.misc:
>I have this KML (Slightly abridged)
>
><?xml version="1.0" encoding="UTF-8"?>
><kml xmlns="http://earth.google.com/kml/2.0" ...

These two specify the name of the element, that is, the tuple

  {'http://earth.google.com/kml/2.0', 'kml'}

The parts are referred to as namespace name and local name. 

><xsl:template match="/Document/Placemark">
><xsl:for-each select="kml/document/Placemark">

Here the 'kml' refers to just

  {'', 'kml'}

Which is a different tuple. Also, the root element in your document is
this kml element, while your template match attribute looks for a root
element called 'Document'. To get the names right you have to either
declare a namespace prefix and use it in your XPath expressions ala

  /kml:kml/kml:Document/...

or use predicates with the namespace-uri() and local-name() functions:

  /*[local-name() = 'kml' and namespace-uri() = 'http://...']/...

Do note that there are more sophisticated XML/XSLT/XPath modules on
CPAN, XML::LibXSLT for example.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 


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

Date: Wed, 18 Jun 2008 02:04:53 -0700 (PDT)
From: NiallBCarter <NiallBCarter@googlemail.com>
Subject: Re: Ripping out parts of a DOM using XML::XSLT
Message-Id: <8cb417e7-4eb1-4b77-bbb5-d5148285ec2e@m3g2000hsc.googlegroups.com>

On Jun 18, 9:53 am, Bjoern Hoehrmann <bjo...@hoehrmann.de> wrote:
>
>   {'', 'kml'}
>
> Which is a different tuple. Also, the root element in your document is
> this kml element, while your template match attribute looks for a root
> element called 'Document'. To get the names right you have to either
> declare a namespace prefix and use it in your XPath expressions ala
>
>   /kml:kml/kml:Document/...
>
> or use predicates with the namespace-uri() and local-name() functions:
>
>   /*[local-name() = 'kml' and namespace-uri() = 'http://...']/...
>

So would I be right in saying that it is not as simple as I thought?



> Do note that there are more sophisticated XML/XSLT/XPath modules on
> CPAN, XML::LibXSLT for example.

I am aware that there are more sophisticated modules but I experience
troubles with each one I try. It was suggested that I stick to
XML::XSLT for the moment and try to come up with a work around rather
than have to hassle the IT staff to install more modules on the
managed computer I work on.

Essentially all I want to do is strip out the <kml>, <Document> parts
and be left with a DOM containing <Placemark> and all contents </
Placemark>
Is there a simple way of doing this?

rgds,

Niall


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

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 V11 Issue 1654
***************************************


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