[27057] in Perl-Users-Digest
Perl-Users Digest, Issue: 8962 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 16 11:05:49 2006
Date: Thu, 16 Feb 2006 08:05:04 -0800 (PST)
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, 16 Feb 2006 Volume: 10 Number: 8962
Today's topics:
Re: Overriding a hard coded ISA module (Anno Siegel)
Re: PDF:: <samwyse@gmail.com>
XML namespaces in (pure) perl parsers? <bugbear@trim_papermule.co.uk_trim>
Re: XML namespaces in (pure) perl parsers? <keshlam-nospam@comcast.net>
Re: XML namespaces in (pure) perl parsers? <bugbear@trim_papermule.co.uk_trim>
Re: XS - Variable creation (Anno Siegel)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 Feb 2006 11:07:30 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Overriding a hard coded ISA module
Message-Id: <dt1mdi$33m$2@mamenchi.zrz.TU-Berlin.DE>
<xhoster@gmail.com> wrote in comp.lang.perl.misc:
> Is there an elegant way to tell other modules which are ISA some parent
> (either directly or indirectly) that they should be ISA something else
> instead?
Change their @ISA?
> For example, GD::Graph::lines, GD::Graph::points, and
> GD::Graph::linespoints.pm are all subclasses of GD::Graph::axestype.
>
> I want to subclass GD::Graph::axestype and override a method in it, and
> have that override exist for the three end-use modules. Currently the way
> I do it is to subclass each of the end-use modules individually:
I'd try this (untested):
Make your own less buggy Xho::axestype:
package Xho::axestype;
use base 'GD::Graph::axestype';
sub buggy_method {
# your non-buggy override
}
1;
Then, before using GD::Graph, but after its @ISA is set up, do something
like this:
for ( \ (
GD::Graph::lines::ISA,
GD::Graph::points::ISA,
GD::Graph::linespoints::ISA,
) ) {
$_ eq 'GD::Graph::linespoints' and $_ = 'Xho::linespoints' for @$_;
}
That should make the three modules use your improved version. The
@ISA-modifying code could go in a CHECK- or INIT-block to make sure[1]
everything is set up when it is called.
Anno
[1] Well, make it likely that everything is set up.
--
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.
--
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: Thu, 16 Feb 2006 12:07:41 GMT
From: Samwyse <samwyse@gmail.com>
Subject: Re: PDF::
Message-Id: <hWZIf.33396$H71.26691@newssvr13.news.prodigy.com>
Guesstimating a translation from German...
Steffen Netz wrote:
You have this program:
> use PDF::Parse;
> $pdf = PDF::Parse->new();
> $pdf->TargetFile($ARGV[0]);
> $pdf->LoadPageInfo;
> $info = $pdf->GetInfo ("Title");
> print $info;
You get this message:
> Can't use string ("8506") as a SCALAR ref while "strict refs" in use
> at /sw/opensrc/lib/perl5/site_perl/5.8.3/PDF/Core.pm line 236.
[ Something about PDF::Core and PDF::Core::PDFGetPrimitive ]
Your version of Perl is:
> This is perl, v5.8.3 built for sun4-solaris
> Die PDF-Version:
> Version Installed 1.11
OK, it looks like somewhere in the bowels of PDF::Core, a value of
"8506" is being used as a reference. I would advice using the Perl
debugger: perl -d myprogram.pl
Then, use the 'n' command to step through your program until things die,
then look at the line in question ("l 236") and examine any variables
that are being used as references ("p $self"). You may want to "use
Data::Dumper;" in your main program, it allows you to do things like
this: "p Dumper $self"
------------------------------
Date: Thu, 16 Feb 2006 11:03:34 +0000
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: XML namespaces in (pure) perl parsers?
Message-Id: <43f45c07$0$82661$ed2619ec@ptn-nntp-reader03.plus.net>
I need to do some fairly simple processing
of XML files; I would like to be able to do this
in perl.
However, the XML I'm handling uses namespaces.
In practice, the tags do not overlap,
so I could achieve the functionality I need
by simply stripping namespace information.
Question: what XML parsers, callable from perl
support namespaces (either properly, or by
carefully ignoring them)?
And, of these, which (if any) of them do not require
compilation to install (i.e. which are "pure" perl).
The reason for the latter restriction is ease
of installation on some nasty, obscure, old
hardware (don't ask, you DON'T want to know ;-)
BugBear
------------------------------
Date: Thu, 16 Feb 2006 08:26:17 -0500
From: Joe Kesselman <keshlam-nospam@comcast.net>
Subject: Re: XML namespaces in (pure) perl parsers?
Message-Id: <nNWdnalXZczr4GneRVn-qg@comcast.com>
I don't use perl, so I can't recommend specific packages, but any modern
XML parser *should* support namespaces...
------------------------------
Date: Thu, 16 Feb 2006 15:47:32 +0000
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: XML namespaces in (pure) perl parsers?
Message-Id: <43f49e94$0$82627$ed2619ec@ptn-nntp-reader03.plus.net>
Joe Kesselman wrote:
> I don't use perl, so I can't recommend specific packages, but any modern
> XML parser *should* support namespaces...
You're right, and yet wrong. Many modern perl parsers don't.
Hence my question.
BugBear
------------------------------
Date: 16 Feb 2006 12:37:57 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: XS - Variable creation
Message-Id: <dt1rn5$6mv$1@mamenchi.zrz.TU-Berlin.DE>
Sisyphus <sisyphus1@nomail.afraid.org> wrote in comp.lang.perl.misc:
>
> "Ferry Bolhar" <bol@adv.magwien.gv.at> wrote in message
> news:1140081855.20121@proxy.dienste.wien.at...
> > Hi Ilya,
> >
> > > get_sv(): TRUE argument will create.
> >
> > My situation is as follows: a routine returns a SV and I want to make
> > it available from Perl, (currently) mainly for debugging purposes.
> >
> > IIUC, get_sv() creates a new Perl variable with an empty SV ('undef'
> > in Perl). But the SV already exists (as SVPV), I just want to make it
> > visible from Perl!
Then copy the value into the SV associated with the variable.
> Perhaps this simple Inline::C demo helps:
>
> use warnings;
>
> use Inline C => Config =>
> CLEAN_AFTER_BUILD => 0, # see below
> BUILD_NOISY => 1; # see build output
>
> use Inline C => <<'EOC';
>
> SV * foo() {
> SV * ret;
> ret = newSVpv("hello world", 0);
> return ret;
> }
>
> EOC
>
> $z = foo();
> print $z, "\n";
[...]
That returns a value to Perl. The OP wants to set a package variable
as a side effect of calling the function. This may come closer:
foo();
no warnings 'once';
print "$Some::Package::auto\n";
exit;
#########################################################################
use Inline C => <<'EOC';
void foo() {
SV* package_var;
SV* any_sv = newSVpv("a wonderful scalar", 0); /* the given SV */
package_var = get_sv("Some::Package::auto", 1);
SvSetSV(package_var, any_sv);
}
EOC
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: 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 8962
***************************************