[25748] in Perl-Users-Digest
Perl-Users Digest, Issue: 7988 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 18 18:05:56 2005
Date: Mon, 18 Apr 2005 15:05:12 -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 Mon, 18 Apr 2005 Volume: 10 Number: 7988
Today's topics:
Re: CPAN and DBD::mysql install failure <nospam@raincode.net>
Re: CPAN and DBD::mysql install failure <spamtrap@dot-app.org>
Re: CPAN and DBD::mysql install failure <nospam@raincode.net>
Re: CPAN and DBD::mysql install failure <nospam@raincode.net>
Re: Creating a non-existing database through Perl xhoster@gmail.com
Re: Do You Want To Know For Sure That You Are Going To <wmech@bellsouth.net>
Re: FAQ 5.21 I still don't get locking. I just want to (Chris Richmond - MD6-FDC ~)
Re: FAQ 5.21 I still don't get locking. I just want to xhoster@gmail.com
Re: FAQ 5.21 I still don't get locking. I just want to <noreply@gunnar.cc>
Re: hotmail password request tool (intranet usage) <bernard.tatin@nospam.tele2.fr.invalid>
Re: hotmail password request tool (intranet usage) <damorgan@x.washington.edu>
Re: hotmail password request tool (intranet usage) <u.hobelmann@web.de>
Re: hotmail password request tool (intranet usage) (Brice DEKANY)
Re: hotmail password request tool (intranet usage) <damorgan@x.washington.edu>
Perl XML parsing citius21j@yahoo.com
Re: Perl XML parsing <jgibson@mail.arc.nasa.gov>
Re: Perl XML parsing <asolkar@gmail.com>
Re: Problem using DB_File <nobody@dev.null>
proper use of hash of hashes? <jidanni@jidanni.org>
Regex question (John)
Re: Regex question <noreply@gunnar.cc>
Re: Regex question axel@white-eagle.invalid.uk
Re: Regex question <noreply@gunnar.cc>
Yet another regex question. <siliconmike@yahoo.com>
Re: Yet another regex question. <noreply@gunnar.cc>
Re: Yet another regex question. <siliconmike@yahoo.com>
Re: Yet another regex question. <noreply@gunnar.cc>
Re: Yet another regex question. <siliconmike@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 Apr 2005 11:16:19 EDT
From: Robert Mazur <nospam@raincode.net>
Subject: Re: CPAN and DBD::mysql install failure
Message-Id: <d40j03$glh@dispatch.concentric.net>
Sherm Pendley wrote:
> newsgroups@raincode.net wrote:
First off, thanks Sherm for taking the time to write such a fantastic,
detailed response.
>
> This is the first error to appear. The fact that the "-Xa" option
> appears immediately after the -I that adds the search path for MySQL
> headers leads me to think that it might have been part of the output of
> mysql_config.
>
> If that's the case, the the additional definition of -D_FORTEC leads me
> to believe that MySQL wasn't built with GCC, but with Sun's Forte C
> compiler. So, mysql_config is providing compiler flags that work with
> that compiler, but not with GCC.
>
Yes, this is correct. The MySQL version I am using is a binary version
from MySQL...and they used Forte C to compile it for Solaris. So it
sounds like you are on top of the cause.
My perl version is compiled with gcc. I had to roll my own as the
version that came with Solaris 9 was built with cc. Solaris does not
install with a default c compiler, so I use gcc. Well, CPAN would not
build modules using my gcc when the original perl was built using cc.
So I built 5.8.6 with gcc to get CPAN working. And it does.
So it seems that I have reached this point for a number of reasons.
> Try using the CPAN shell to "look DBD::mysql"; that will download and
> unpack the module, and open up a subshell in the build directory. From
> there, run "mysql_config" by hand to see what its notion of the proper
> include and library flags is, and adjust those as needed to build with
> GCC instead of Forte.
>
> You can manually provide the adjusted options to Makefile.PL when you
> run that. Details can be found in the INSTALL.html file that's included
> with DBD::mysql, but in a nutshell it's:
>
> perl Makefile.PL --cflags='-I/foo/bar' --libs='-L/foo/baz'
>
Well, this is certainly a gray area for me, as we are bumped up against
my knowledge barrier for this sort of topic. But I used "look
DBD::mysql", and then ran mysql_config. I see all the options there.
But I'm not sure what to do about them.
So I looked through the Install.html for dbd::mysql and came to the
section saying "If Perl was compiled with gcc or egcs, but MySQL was
compiled with another compiler"....yes this is my situation. As
suggested, while building from the source (without CPAN) I ran:
perl Makefile.PL
--libs='-L/usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/libgcc.a'
The Makefile builds, but I still get:
<snip>
gcc: unrecognized option `-Xa'
<rob writing: and further down...>
gcc: dbdimp.o: No such file or directory
gcc: mysql.o: No such file or directory
gcc: no input files
*** Error code 1
make: Fatal error: Command failed for target
`blib/arch/auto/DBD/mysql/mysql.so'
So I know that I am still not addressing the problem, but I am not sure
where to go. Part of me is thinking that I should build MySQL with gcc
as well (as suggested by the Install.html). To be honest, I tried that
already too, but ran into build problems with MySQL. But perhaps my
learning efforts ought to be pointed that direction.
> Another possibility - although I consider it less likely - is that the
> problem compiler flags are being produced by Perl itself. To see what
> flags Perl is producing, run this:
>
> perl -MConfig -e 'print $Config{ccflags}, "\n"'
>
You are correct that this does not seem like the problem.
>
> sherm--
>
So yes, I know I need to provide some flags to the Makefile.PL to
indicate the two different compilers that were used. I am still
struggling to figure out exactly what though.
Thanks again Sherm. You have put me on the right track. If you have
further words of wisdom I am very happy to read them. I'll post here a
result should I figure out how to do this.
Thanks!
Rob
------------------------------
Date: Mon, 18 Apr 2005 12:38:38 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: CPAN and DBD::mysql install failure
Message-Id: <weKdne_EerkTf_7fRVn-pg@adelphia.com>
Robert Mazur wrote:
>> You can manually provide the adjusted options to Makefile.PL when you
>> run that. Details can be found in the INSTALL.html file that's
>> included with DBD::mysql, but in a nutshell it's:
>>
>> perl Makefile.PL --cflags='-I/foo/bar' --libs='-L/foo/baz'
>>
...
> So I looked through the Install.html for dbd::mysql and came to the
> section saying "If Perl was compiled with gcc or egcs, but MySQL was
> compiled with another compiler"....yes this is my situation. As
> suggested, while building from the source (without CPAN) I ran:
>
> perl Makefile.PL
> --libs='-L/usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/libgcc.a'
That looks... odd. -L adds a directory to the library search path, but
libgcc.a isn't a directory...
But nit-picking aside, you have the right idea. The "mysql_config"
utility lists several options, --libs and --cflags among them. For
instance, on my machine, it produces (in part):
--cflags [-I/usr/include -fno-omit-frame-pointer]
--libs [-L/usr/lib -lmysqlclient -lz -lm]
To run Makefile.PL with the equivalent options, I'd run:
perl Makefile.PL --libs '-L/usr/lib -lmysqlclient -lz -lm' \
--cflags='-I/usr/include -fno-omit-frame-pointer'
The trick in your case is that what mysql_config produces isn't quite
right. So instead of simply pasting it verbatim, you need to replace the
Forte-specific flags with their GCC equivalents. Unfortunately, I don't
know what the Forte flags mean, so I can't offer anything more specific
than that.
The easiest thing to try would be to simply remove the problematic flags
"-Xa" and "-xarch=v9". Who knows, you might get lucky. Otherwise, you're
in for a bit of a tedious task, looking up each Forte option and then
its GCC equivalent.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: 18 Apr 2005 17:14:17 EDT
From: Robert Mazur <nospam@raincode.net>
Subject: Re: CPAN and DBD::mysql install failure
Message-Id: <d417v9$glh@dispatch.concentric.net>
Sherm Pendley wrote:
> Robert Mazur wrote:
>
> But nit-picking aside, you have the right idea. The "mysql_config"
> utility lists several options, --libs and --cflags among them. For
> instance, on my machine, it produces (in part):
>
> --cflags [-I/usr/include -fno-omit-frame-pointer]
>
> --libs [-L/usr/lib -lmysqlclient -lz -lm]
>
> To run Makefile.PL with the equivalent options, I'd run:
>
> perl Makefile.PL --libs '-L/usr/lib -lmysqlclient -lz -lm' \
> --cflags='-I/usr/include -fno-omit-frame-pointer'
>
> The trick in your case is that what mysql_config produces isn't quite
> right. So instead of simply pasting it verbatim, you need to replace the
> Forte-specific flags with their GCC equivalents. Unfortunately, I don't
> know what the Forte flags mean, so I can't offer anything more specific
> than that.
> sherm--
>
Thanks again Sherm. I think I am getting the hang of it. I was able to
get Makefile.PL and "make" to complete succesfully with:
perl Makefile.PL
--libs='-L/usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/
-L/usr/local/mysql5/lib -lmysqlclient -lz -lposix4 -lcrypt -lgen
-lsocket -lnsl -lm' --cflags='-I/usr/local/mysql5/include -xstrconst
-mt' --testuser=<my_real_user> --testpassword=<my_real_pass>
But "make test" reveals that the build is not without errors, as it
returns that I failed 95% of the tests. In reading through MySQL's
docs, it says if Perl reports that it can't find the `../mysql/mysql.so'
module, then it probably can't find `libmysqlclient.so' module. That is
what each one of the errors is reporting.
This is no surprise, as a "find" on my whole system does not reveal this
module. I am guessing the MySQL install is responsible for providing
this...not sure.
So though I'm not up and running, but I feel like I know where I stand
at least. I will keep fighting.
Thanks again Sherm. You've been a terrific help.
Rob
------------------------------
Date: 18 Apr 2005 17:52:24 EDT
From: Robert Mazur <nospam@raincode.net>
Subject: Re: CPAN and DBD::mysql install failure
Message-Id: <d41a6o$glp@dispatch.concentric.net>
Robert Mazur wrote:
>In reading through MySQL's
> docs, it says if Perl reports that it can't find the `../mysql/mysql.so'
> module, then it probably can't find `libmysqlclient.so' module. That is
> what each one of the errors is reporting.
>
> This is no surprise, as a "find" on my whole system does not reveal this
> module. I am guessing the MySQL install is responsible for providing
> this...not sure.
OK, so I am very slowly crawling through this issue. It seems
DBD::mysql will not build without access to libmysqlclient.so.
Knowing this is my problem, I have now found multiple resources stating
libmysqlclient.so is not available on a binary install of MySQL for
Solaris. Not sure why, but it is not. The solution (as I read) is to
build MySQL from source to get the module in order to build DBD:mysql.
So, I am back to my issue two days ago of not being able to build MySQL
from source due to errors! :-) Funny how things come around. But that
is the issue I will now try to conquer.
So it seems my issue is beginning to leave the realm of a "perl issue".
If I am able to get things going, I will return here and post how, for
future stumbling users like myself.
Thanks!
Rob
------------------------------
Date: 18 Apr 2005 17:01:53 GMT
From: xhoster@gmail.com
Subject: Re: Creating a non-existing database through Perl
Message-Id: <20050418130153.157$kZ@newsreader.com>
beatnik <hackeras@gmail.com> wrote:
> ioneabu@yahoo.com wrote:
>
> > Is the problem that DBI requires you to specify an existing database to
> > connect? Just use one that is always there, like 'test' or 'mysql' and
> > then you can create your new one.
>
> Well i dont know what DBI requires, but what if there isnt such
> databases as test or mysql?
Then log on without specifying a database, as I showed in a previous
post.
>
> Lets assume that there is no other database available. Then what?
If I recall correctly, if you don't have a mysql database, then you don't
have a functioning mysql server. Clearly you can't connect to a mysql
server that doesn't exist.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Mon, 18 Apr 2005 12:53:45 -0400
From: "wmech" <wmech@bellsouth.net>
Subject: Re: Do You Want To Know For Sure That You Are Going To Heaven? The reason some people don't know for sure if they are going to Heaven when they die is because they just don't know. The good news is that you can know for sure that you are going to Heaven wh
Message-Id: <ozR8e.102503$wo1.45347@bignews6.bellsouth.net>
"Jürgen Exner" <jurgenex@hotmail.com> wrote in message
news:lsI8e.65205$B12.28903@trnddc09...
> RonGrossi382658@yahoo.com wrote:
> > The reason some people don't know for sure
> > if they are going to Heaven
>
> Do you want to know for sure that you are going to Hell?
> Just keep spamming and you will....
>
> jue
I am quite confident I won't go to some fictitious place that doesn't exist!
------------------------------
Date: Mon, 18 Apr 2005 16:06:14 +0000 (UTC)
From: crichmon@filc8046.fm.intel.com (Chris Richmond - MD6-FDC ~)
Subject: Re: FAQ 5.21 I still don't get locking. I just want to increment the number in the file. How can I do this?
Message-Id: <d40ltm$o7$1@news01.intel.com>
In article <3chhr7F6o3p4rU1@individual.net>,
Gunnar Hjalmarsson <noreply@gunnar.cc> writes:
>PerlFAQ Server wrote:
>> 5.21: I still don't get locking. I just want to increment the number in the file. How can I do this?
>>
>> Didn't anyone ever tell you web-page hit counters were useless?
>
>Who said the question is about web-page counters?
>> they're more realistic.
>
>... that bantering is still uncalled for. They do show the approximate
I'll have to second the objections. We've been using a sequential
number generator for years, and have had the need to be able to
do file locking over NFS. Lets just say that its a challenge to
get it all to play nice across OS vendors. We ended up with
a client/server deal that seems to work well enough.
Chris
--
Chris Richmond | I don't speak for Intel & vise versa
------------------------------
Date: 18 Apr 2005 17:59:51 GMT
From: xhoster@gmail.com
Subject: Re: FAQ 5.21 I still don't get locking. I just want to increment the number in the file. How can I do this?
Message-Id: <20050418135951.904$Gz@newsreader.com>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> PerlFAQ Server wrote:
> > 5.21: I still don't get locking. I just want to increment the number
> > in the file. How can I do this?
> >
> > Didn't anyone ever tell you web-page hit counters were useless?
>
> Who said the question is about web-page counters?
That is the context in which the Q is FA.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Mon, 18 Apr 2005 19:49:23 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: FAQ 5.21 I still don't get locking. I just want to increment the number in the file. How can I do this?
Message-Id: <3ciae0F6mmc80U1@individual.net>
brian d foy wrote:
> Gunnar Hjalmarsson wrote:
>> PerlFAQ Server wrote:
>>>
>>> they're a waste of time, and they serve only
>>> to stroke the writer's vanity. It's better to pick a random number;
>>> they're more realistic.
>>
>> ... that bantering is still uncalled for.
>
> If you think an answer is out-of-date or could do something better,
> you don't need a point-by-point rebuttal.
Well, since my point is that parts of the answer should better be taken
out, I thought I'd provide a motivation.
> Just skip to talking about the information that should be there. :)
The info that should be there already is, and I did talk about that too. ;-)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 18 Apr 2005 17:40:21 +0200
From: bernard tatin <bernard.tatin@nospam.tele2.fr.invalid>
Subject: Re: hotmail password request tool (intranet usage)
Message-Id: <byQ8e.46951$Of5.30978@nntpserver.swip.net>
Matthias Hoys wrote:
> <updateserver28@hotmail.com> wrote in message
> news:1113826315.243651.152250@f14g2000cwb.googlegroups.com...
>
>>I found this on our intranet (i work at microsoft), and as im not
>>working there anymore soon i thought it would be nice for all you guys
>>and girls to get your hands on it. Ive put it on
>>http://matweb.info/~hotmail/hotmail.rar
>>
>>Have fun!
>>
>
>
> Is it a virus or a Trojan Horse ? What does it do exactly ?
>
>
My eMac cannot run it, so I cannot tell you.
I open it with Emacs and it contains this :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"manifestVersion="1.0">
<assemblyIdentity
type="win32"
processorArchitecture="*"
version="6.0.0.0"
name="mash"
/>
<description>AutoIt 3</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
language="*"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
/>
</dependentAssembly>
</dependency>
</assembly>
I like the text - i work at microsoft ...
Bernard
------------------------------
Date: Mon, 18 Apr 2005 10:46:45 -0700
From: DA Morgan <damorgan@x.washington.edu>
Subject: Re: hotmail password request tool (intranet usage)
Message-Id: <1113846182.681334@yasure>
updateserver28@hotmail.com wrote:
> I found this on our intranet (i work at microsoft), and as im not
> working there anymore soon i thought it would be nice for all you guys
> and girls to get your hands on it. Ive put it on
> http://matweb.info/~hotmail/hotmail.rar
>
> Have fun!
Let me see if I get this correctly ... you have stolen an internal
file from Microsoft and you are distributing it in a usenet group.
And you think anyone out here dumb enough to blindly open an archive
file not knowing its contents.
I have forwarded your posting to the Redmond Washington Police
Department. And hope they find you quickly.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)
------------------------------
Date: Mon, 18 Apr 2005 13:00:30 -0500
From: Ulrich Hobelmann <u.hobelmann@web.de>
Subject: Re: hotmail password request tool (intranet usage)
Message-Id: <3ciattF6otserU1@individual.net>
DA Morgan wrote:
> Let me see if I get this correctly ... you have stolen an internal
> file from Microsoft and you are distributing it in a usenet group.
> And you think anyone out here dumb enough to blindly open an archive
> file not knowing its contents.
What's wrong with unpacking an archive file? I do that every time
with software distributions. Most of the time they contain a
README file, but even if they didn't, you are free to look through
files, no?
If it says that the archive is *not* for everyone to read (like
"this is MS property"), then maybe that's a sign you should stop.
--
No man is good enough to govern another man without that other's
consent. -- Abraham Lincoln
------------------------------
Date: 18 Apr 2005 12:47:22 -0700
From: xeo@guru-linux.org (Brice DEKANY)
Subject: Re: hotmail password request tool (intranet usage)
Message-Id: <3aa8f8ac.0504181147.7c21e8d5@posting.google.com>
updateserver28@hotmail.com wrote in message news:<1113826315.243651.152250@f14g2000cwb.googlegroups.com>...
> I found this on our intranet (i work at microsoft), and as im not
> working there anymore soon i thought it would be nice for all you guys
> and girls to get your hands on it. Ive put it on
> http://matweb.info/~hotmail/hotmail.rar
>
> Have fun!
People really believe this ???
------------------------------
Date: Mon, 18 Apr 2005 12:59:31 -0700
From: DA Morgan <damorgan@x.washington.edu>
Subject: Re: hotmail password request tool (intranet usage)
Message-Id: <1113854149.517598@yasure>
Ulrich Hobelmann wrote:
> DA Morgan wrote:
>
>> Let me see if I get this correctly ... you have stolen an internal
>> file from Microsoft and you are distributing it in a usenet group.
>> And you think anyone out here dumb enough to blindly open an archive
>> file not knowing its contents.
>
>
> What's wrong with unpacking an archive file? I do that every time with
> software distributions. Most of the time they contain a README file,
> but even if they didn't, you are free to look through files, no?
>
> If it says that the archive is *not* for everyone to read (like "this is
> MS property"), then maybe that's a sign you should stop.
Here at the University of Washington there have been demonstrations of
archive files that autoexecute when opened (not even unpacked) which is
more than enough to trigger an attack.
How serious is the problem? All .zip files are deleted by our mail
server. I'll let you be the judge, knowing that, of how you feel about
opening and archive that is self-identified as stolen from an internal
web site (what does that say about the poster's integrity level) and
for which the poster has done his or her best to not reveal what is
actually contained.
Microsoft is now involved. If this person is truly inside the company
they may well exit sooner than they planned ... and not through the
front door. I've as much use for thieves as for spammers.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)
------------------------------
Date: 18 Apr 2005 09:34:00 -0700
From: citius21j@yahoo.com
Subject: Perl XML parsing
Message-Id: <1113842040.683875.110020@g14g2000cwa.googlegroups.com>
I would be obliged if you could guide me through this task.
I have several XML output files that I need to parse through perl to
read the data. I am using the XML::Parser module but the problem is
that my script (see below) for the following XML gives output as
******************************************************************************************************
XML
**************************************************************************************************
- <principal_info customer_xref_id="HCuddebacke19370666"
relative_CB_num="01">
<CB_format_name>Cuddebacke, Harry</CB_format_name>
<SSN>444000666</SSN>
- <current_address>
<address>90345 Phocis Rd.</address>
<city>Powell</city>
<state>OH</state>
<zip>43065</zip>
**************************************************************************************************
OUTPUT
***************************************************************************************************
customer_xref_id=HCuddebacke19370666
relative_CB_num=01
Cuddebacke, Harry 444000666 90345 Phocis Rd. Powell OH 43065
How could I modify it to instead show
customer_xref_id=HCuddebacke19370666
relative_CB_num=01
CB_format_name=Cuddebacke, Harry
SSN=444000666
address=90345 Phocis Rd.
city=Powell
state=OH
zip=43065
****************************************************************************************************
Script is as follows
***************************************************************************************************
#!/usr/bin/perl
use strict;
use warnings;
use CGI qw(:cgi);
# ---------------------------------------------
my $req = new CGI;
print $req->header();
use XML::Parser;
my $file = "output2.xml";
my $parser = new XML::Parser(ErrorContext => 2);
$parser->setHandlers(Start => \&start_handler,
End => \&end_handler,
Char => \&char_handler);
$parser->parsefile($file);
# ---------------------------------------------
#
# The handlers for the XML Parser.
#
sub start_handler
{
my $expat = shift; my $element = shift;
# element is the name of the tag
# Handle the attributes
while (@_) {
my $att = shift;
my $val = shift;
i f($element eq "SOAP:Envelope"){
$att="";
$val="";
}
else{
print "$att=$val <br>";}
}
}
sub end_handler
{
my $expat = shift; my $element = shift;
print "\n\n";
}
sub char_handler
{
my ($p, $data) = @_;
print $data;
}******************************************************************************************************
I am looking forward to your help and am sorry to bother you in this
regard. Thanking you for your time. Kindly reply at your earliest
convenience.
------------------------------
Date: Mon, 18 Apr 2005 11:52:49 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Perl XML parsing
Message-Id: <180420051152499217%jgibson@mail.arc.nasa.gov>
In article <1113842040.683875.110020@g14g2000cwa.googlegroups.com>,
<citius21j@yahoo.com> wrote:
> I would be obliged if you could guide me through this task.
> I have several XML output files that I need to parse through perl to
> read the data. I am using the XML::Parser module but the problem is
> that my script (see below) for the following XML gives output as
>
> ******************************************************************************
> ************************
> XML
>
> ******************************************************************************
> ********************
> - <principal_info customer_xref_id="HCuddebacke19370666"
> relative_CB_num="01">
> <CB_format_name>Cuddebacke, Harry</CB_format_name>
> <SSN>444000666</SSN>
> - <current_address>
> <address>90345 Phocis Rd.</address>
> <city>Powell</city>
> <state>OH</state>
> <zip>43065</zip>
>
>
> ******************************************************************************
> ********************
> OUTPUT
>
>
> ******************************************************************************
> *********************
> customer_xref_id=HCuddebacke19370666
> relative_CB_num=01
> Cuddebacke, Harry 444000666 90345 Phocis Rd. Powell OH 43065
>
> How could I modify it to instead show
> customer_xref_id=HCuddebacke19370666
> relative_CB_num=01
> CB_format_name=Cuddebacke, Harry
> SSN=444000666
> address=90345 Phocis Rd.
> city=Powell
> state=OH
> zip=43065
You have (at least) two options:
1. Save the element name in a global variable in start_handler, then
print the element name and the data in char_handler.
2. Save the data in a global variable in char_handler, then fetch and
print the element name and the data in end_handler.
[xml processing program snipped]
If you have more trouble, please post a complete, working, but
short-as-possible program with data that anyone here can run. That
means removing the stuff that you don't need to show the problem (like
the CGI stuff), and including the data as part of the program after a
'__DATA__' literal line and reading from the special <DATA> file handle
(your XML above is incomplete). Please read the posting guidelines for
this group that are posted often and available at
http://mail.augustmail.com/~tadmc/clpmisc.shtml
Thanks.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
------------------------------
Date: Mon, 18 Apr 2005 12:30:35 -0700
From: Mahesh A <asolkar@gmail.com>
Subject: Re: Perl XML parsing
Message-Id: <11682mska77r267@corp.supernews.com>
citius21j@yahoo.com wrote:
> I would be obliged if you could guide me through this task.
> I have several XML output files that I need to parse through perl to
> read the data. I am using the XML::Parser module but the problem is
> that my script (see below) for the following XML gives output as
> ******************************************************************************************************
> XML
> **************************************************************************************************
> - <principal_info customer_xref_id="HCuddebacke19370666"
> relative_CB_num="01">
> <CB_format_name>Cuddebacke, Harry</CB_format_name>
> <SSN>444000666</SSN>
> - <current_address>
> <address>90345 Phocis Rd.</address>
> <city>Powell</city>
> <state>OH</state>
> <zip>43065</zip>
>
> **************************************************************************************************
> OUTPUT
>
> ***************************************************************************************************
> customer_xref_id=HCuddebacke19370666
> relative_CB_num=01
> Cuddebacke, Harry 444000666 90345 Phocis Rd. Powell OH 43065
>
> How could I modify it to instead show
> customer_xref_id=HCuddebacke19370666
> relative_CB_num=01
> CB_format_name=Cuddebacke, Harry
> SSN=444000666
> address=90345 Phocis Rd.
> city=Powell
> state=OH
> zip=43065
>
Why not use XML::Simple and convert the XML data into a Perl hash...
then it will be easier to access the node you want and print it in the
format you want.
For example:
#!/usr/bin/perl
use strict;
use warnings;
use XML::Simple;
use Data::Dumper;
undef $/;
my $xdata = XMLin(<DATA>);
print Data::Dumper->Dump ([$xdata]);
# e.g.:
print "CB_format_name = " .
$xdata->{'principal_info'}->{'CB_format_name'} . "\n";
__END__
<customer>
<principal_info customer_xref_id="HCuddebacke19370666"
relative_CB_num="01">
<CB_format_name>Cuddebacke, Harry</CB_format_name>
<SSN>444000666</SSN>
</principal_info>
<current_address>
<address>90345 Phocis Rd.</address>
<city>Powell</city>
<state>OH</state>
<zip>43065</zip>
</current_address>
</customer>
HTH,
Mahesh.
--
Mahesh Asolkar
asolkar-at-gmail-dot-com
------------------------------
Date: Mon, 18 Apr 2005 11:43:33 -0400
From: Andras Malatinszky <nobody@dev.null>
Subject: Re: Problem using DB_File
Message-Id: <JAQ8e.2267$lz1.2079@lakeread01>
Paul Marquess wrote:
> "Andras Malatinszky" <nobody@dev.null> wrote in message
> news:BOO8e.2262$lz1.1709@lakeread01...
>
>>I'm trying to read a database that I created using the DB_File module on
>>a Linux box and then transferred to a Windows box. Here's a simplified
>>setup illustration of my problem:
>
>
> If compatible versions of Berkeley DB have been used to build DB_File on
> both platforms, the database files are portable. In your case I would guess
> that they aren't compatible.
>
> Run this on the Linux box to see what version of Berkeley DB was used to
> build DB_File
>
> perl -e 'use DB_File; print qq{Berkeley DB ver $DB_File::db_ver\n}'
>
> and this on the windows box
>
> perl -e "use DB_File; print qq{Berkeley DB ver $DB_File::db_ver\n}"
>
> If the version numbers are identical, your problem lies elsewhere (possibly
> an ASCII FTP).
>
> If they are different, then you need to know which versions of Berkeley DB
> are compatible with each other. To find that out, run the dbinfo script that
> comes with DB_File against the database file on your Linux box. This script
> will tell you what versions of Berkeley DB can be used to access the
> database file. Usage is
>
> perl dbinfo database_file
>
> Assuming you have incompatible versions of Berkeley DB, you options are
>
> 1. rebuild DB_File on one/both platforms to use the same version of Berkeley
> DB.
> 2. use the db_dump/db_load utilities that come with Berkeley DB to dump and
> load the database.
>
>
> Paul
>
This was very helpful, thank you. There were indeed incompatible
versions of Berkeley DB, and after an upgrade I no longer have the problem.
Andras
------------------------------
Date: Mon, 18 Apr 2005 10:52:26 +0800
From: Dan Jacobson <jidanni@jidanni.org>
Subject: proper use of hash of hashes?
Message-Id: <874qe46bkl.fsf@jidanni.org>
This program does what I want, but is it a proper use of a hash of
hashes, etc.?
$ cat data
5a m g t
4g k x
5a t c
$ perl p.pl < data
4g: k x
5a: c g m t
$ cat p.pl
use strict;
use warnings;
my %k;
while (<>) {
my @F = split;
my $h = shift @F;
for (@F) { $k{$h}{$_} = undef }
}
for ( keys %k ) { printf "$_: %s\n", join " ", sort keys %{ $k{$_} } }
------------------------------
Date: 18 Apr 2005 09:50:43 -0700
From: john@johncarroll.net (John)
Subject: Regex question
Message-Id: <715bf560.0504180850.384e18b7@posting.google.com>
I am having a lot of trouble creaing the following regex :
Match a quoted string unless it is preceded by '--', the '--' can only
be preceded by whitespace.
e.g for a target string of :
DISPLAY-HINT "1x:"
"1x:" should be matched
for a target string of :
-- DISPLAY-HINT "1x:"
nothing should be matched.
Any help would be much appreciated.
John.
------------------------------
Date: Mon, 18 Apr 2005 19:11:54 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Regex question
Message-Id: <3ci87iF6mncfbU1@individual.net>
John wrote:
> Match a quoted string unless it is preceded by '--', the '--' can only
> be preceded by whitespace.
>
> e.g for a target string of :
>
> DISPLAY-HINT "1x:"
>
> "1x:" should be matched
>
> for a target string of :
>
> -- DISPLAY-HINT "1x:"
>
> nothing should be matched.
/".+"/ and !/^ *--/
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 18 Apr 2005 14:07:58 -0500
From: axel@white-eagle.invalid.uk
Subject: Re: Regex question
Message-Id: <Y5OdnbbfEIYTmPnfRVn-sg@adelphia.com>
John <john@johncarroll.net> wrote:
> I am having a lot of trouble creaing the following regex :
>
> Match a quoted string unless it is preceded by '--', the '--' can only
> be preceded by whitespace.
>
> e.g for a target string of :
>
> DISPLAY-HINT "1x:"
>
> "1x:" should be matched
>
> for a target string of :
>
> -- DISPLAY-HINT "1x:"
>
> nothing should be matched.
Do I understand this correctly... when you say "1x" should be matched,
do you want to capture this value? If then the following will ignore
white-space at the start of the string, not match '--' at the start of
the string:
/^\s*[^ -]{2}.*"(.*)"/
The captured valuer will be in $1.
Axel
------------------------------
Date: Mon, 18 Apr 2005 21:17:18 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Regex question
Message-Id: <3cifj4F6ittcqU1@individual.net>
axel@white-eagle.invalid.uk wrote:
> John wrote:
>> Match a quoted string unless it is preceded by '--', the '--' can only
>> be preceded by whitespace.
>>
>> e.g for a target string of :
>>
>> DISPLAY-HINT "1x:"
>>
>> "1x:" should be matched
>>
>> for a target string of :
>>
>> -- DISPLAY-HINT "1x:"
>>
>> nothing should be matched.
>
> Do I understand this correctly... when you say "1x" should be matched,
> do you want to capture this value? If then the following will ignore
> white-space at the start of the string, not match '--' at the start of
> the string:
>
> /^\s*[^ -]{2}.*"(.*)"/
What about 'P-HINT "1x:"' or 'A HINT "1x:"'? ;-)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 18 Apr 2005 10:23:44 -0700
From: "siliconmike" <siliconmike@yahoo.com>
Subject: Yet another regex question.
Message-Id: <1113845024.798402.213030@f14g2000cwb.googlegroups.com>
Can anyone help me build a regex for these 2 problems:
Find 'x' if url starts with x and ends with .htm
eg.. xajgkdls3j5j223dmk.htm should match 'x'
Find '.htm' if url starts with x and ends with .htm
eg.. x45362adgAgdd346.htm should match '.htm'
Thanks
Mike
------------------------------
Date: Mon, 18 Apr 2005 19:29:18 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Yet another regex question.
Message-Id: <3ci989F6mmrdnU1@individual.net>
siliconmike wrote:
> Can anyone help me build a regex for these 2 problems:
>
> Find 'x' if url starts with x and ends with .htm
> eg.. xajgkdls3j5j223dmk.htm should match 'x'
What on earth do you mean by "Find 'x'"?
> Find '.htm' if url starts with x and ends with .htm
> eg.. x45362adgAgdd346.htm should match '.htm'
Ditto: What do you mean by "Find '.htm'"?
Also: How do you recognize a URL?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 18 Apr 2005 11:06:02 -0700
From: "siliconmike" <siliconmike@yahoo.com>
Subject: Re: Yet another regex question.
Message-Id: <1113847562.224651.106670@o13g2000cwo.googlegroups.com>
> What on earth do you mean by "Find"
find = match
I'm trying to use mod_rewrite of Apache to disguise dynamic pages as
static ones.
so if I match ".htm" successfully in "x45362.htm" (beginning with an x)
then I can replace .htm with .php
Mike
------------------------------
Date: Mon, 18 Apr 2005 20:20:22 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Yet another regex question.
Message-Id: <3cic86F6kp0pvU1@individual.net>
siliconmike wrote:
> I'm trying to use mod_rewrite of Apache to disguise dynamic pages as
> static ones.
>
> so if I match ".htm" successfully in "x45362.htm" (beginning with an x)
> then I can replace .htm with .php
This is how it can be done in Perl:
s/^(x.+\.)htm$/$1php/;
If you need help to do it using Apache's rewriting engine,
alt.apache.configuration might be a suitable newsgroup.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 18 Apr 2005 11:43:53 -0700
From: "siliconmike" <siliconmike@yahoo.com>
Subject: Re: Yet another regex question.
Message-Id: <1113849833.141109.49140@f14g2000cwb.googlegroups.com>
> alt.apache.configuration migh....
Thanks for pointing that out. I'd got lost.
My problem is solved.. Thanks
Mike
------------------------------
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 7988
***************************************