[28296] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9660 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 29 03:06:12 2006

Date: Tue, 29 Aug 2006 00:05:05 -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, 29 Aug 2006     Volume: 10 Number: 9660

Today's topics:
    Re: Mail-IMAPClient problem and suggestion needed <nospam@somewhere.com>
        Multiple interpreters and data atomicity <dbasch@yahoo.com>
    Re: Multiple interpreters and data atomicity xhoster@gmail.com
    Re: Multiple interpreters and data atomicity <dbasch@yahoo.com>
    Re: Multiple interpreters and data atomicity xhoster@gmail.com
    Re: Multiple interpreters and data atomicity <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: Multiple interpreters and data atomicity <tadmc@augustmail.com>
        new CPAN modules on Tue Aug 29 2006 (Randal Schwartz)
    Re: printing a multidimensional array in table format usenet@DavidFilmer.com
    Re: printing a multidimensional array in table format <joelingram@gmail.com>
    Re: Problem handling a Unicode file <lev.weissman@creo.com>
    Re: Question about socket and other modules <someone@example.com>
        Stupid Q: How to preserve numeric characters <goodarm@gmail.com>
    Re: Stupid Q: How to preserve numeric characters himanshu.garg@gmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 28 Aug 2006 23:10:09 -0400
From: "Thrill5" <nospam@somewhere.com>
Subject: Re: Mail-IMAPClient problem and suggestion needed
Message-Id: <LpmdnSGItoG0LW7ZnZ2dnUVZ_s-dnZ2d@comcast.com>

<debhatta@gmail.com> wrote in message 
news:1156767768.674802.117260@i42g2000cwa.googlegroups.com...
> Hi
>
> There are two issues for which I would like your opinion. First let me
> post a bit of code :
>
> use Mail::IMAPClient;
> use strict;
> use diagnostics;
> my $imap = Mail::IMAPClient->new(
>                Server          => $imap_server ,
>                User            => $user_id ,
>                password        => $password,
>                Uid             => 1, # Optional
>            ) or die "cant connect to imap server, $!";
> $imap->select("INBOX");
> my @msgs = $imap->search("ALL");
> foreach my $msg (@msgs) {
>               print "This is $msg\n";
>             my @flags = $imap->flags($msg) or die " could not flags:
> $!";
>              my $i;
>             for ( $i=0;$i<@flags;$i++) {
>                        print "The flag is $flags[$i]\n";
>            }
> ..... etc.
>
> Say there is one message in the INBOX, then the o/p of the above code
> is
>
> This is 26006
> Uncaught exception from user code:
>         could not flags:  at auto2.pl line 51.
>
> Can anyone tell me why its failing while retrieving the flags ? Is it
> because there are no flags set ?
>
>
> Secondly I want your opinion on my approach. I have a mail account
> where people send their queries and I reply back. Sometimes it leads to
> mail chains, for example, I can ask for more information etc. Finally
> when the issue is completed I move the mails to completed. Now, what I
> want is a auto-reply, which will be sent to every 'new' mail that is
> received. So I do some checks as to where it came from etc. and if it
> fits the criteria, I send an auto-reply and put the subject in the log
> file. Next time my auto-reply script runs in a cron and if it sees a
> mail, it does the same validations and checks whether the subj is
> present in the log file. If iyes, I assume its an old mail and do not
> send an auto-reply. It serves the purpose for most issues but fails if
> two people send a mail with same subject. One then misses the
> auto-reply. Can you suggest any simple mechanism without using any
> extra modules ( like the auto-reply berkely db - I cannot use a db ) ?
> Main problem is identifying whether the mail is a new one or seen
> before ? Note that I remove mails from the inbox every now and then. I
> am thinking of adding a flag to a message , which is not shown to the
> user by Outlook or mozilla and then read that. To that end I was trying
> the first part of my query.
>
> Sorry for the long mail. but any suggestions welcome.
>
>
> Thanks,
> Raj.
>
Instead of just logging the subject, log both the subject and the from 
address of the messages.

Scott




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

Date: 28 Aug 2006 16:44:26 -0700
From: "Derek Basch" <dbasch@yahoo.com>
Subject: Multiple interpreters and data atomicity
Message-Id: <1156808666.002778.54460@m79g2000cwm.googlegroups.com>

Hello All,

I have several servers that share a perl script on a network file
share. This script accesses a telnet server and gets/sets various
attributes.


Server A                Server B
      |                            |
       ---------->script<--------
                     |
                     |
                     v
           Data Store/Telnet

Do I need to worry about the atomicity of the attributes in the Data
Store? How does perl handle a situation like this? What if the Data
Store were simply a flat file instead of a Telnet server?

Thanks for the help,
Derek Basch



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

Date: 28 Aug 2006 23:59:40 GMT
From: xhoster@gmail.com
Subject: Re: Multiple interpreters and data atomicity
Message-Id: <20060828200013.172$0H@newsreader.com>

"Derek Basch" <dbasch@yahoo.com> wrote:
> Hello All,
>
> I have several servers that share a perl script on a network file
> share. This script accesses a telnet server and gets/sets various
> attributes.
>
> Server A                Server B
>       |                            |
>        ---------->script<--------
>                      |
>                      |
>                      v
>            Data Store/Telnet
>
> Do I need to worry about the atomicity of the attributes in the Data
> Store? How does perl handle a situation like this? What if the Data
> Store were simply a flat file instead of a Telnet server?

I have a piece of string.  The piece of string is made out of nylon.  How
long is the piece of string?

Based on your description, I see no reason the situation you describe would
be any different than this one:

   Server A                      Server B
       |                            |
      script--------\   /---------script
                    |   |
                    |   |
                    v   v
            Data Store/Telnet

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: 28 Aug 2006 17:17:43 -0700
From: "Derek Basch" <dbasch@yahoo.com>
Subject: Re: Multiple interpreters and data atomicity
Message-Id: <1156810663.685666.288960@h48g2000cwc.googlegroups.com>

> I have a piece of string.  The piece of string is made out of nylon.  How
> long is the piece of string?

How is this constructive? Have you ever heard the saying "There is no
such thing as a stupid question". I described my problem in detail and
gave exact questions. Questions that you did not answer but instead
mocked me. Why even be on Usenet if you are only going to make people
feel stupid rather than help them?

>
> Based on your description, I see no reason the situation you describe would
> be any different than this one:
>
>    Server A                      Server B
>        |                            |
>       script--------\   /---------script
>                     |   |
>                     |   |
>                     v   v
>             Data Store/Telnet
>
> Xho

Fine, that may be the case. However, you didn't say anything about how
multiple interpreters running on different servers would affect the
atomicity of the data in the Data Store if both interpreters ran the
same function accessing the same attributes in the Data Store at the
same time.

That was my question. Not, "how is this question better expressed". As
far as I can see  your example is different because I do not want to
maintain different copies of the same file on multiple servers. So,
theoretically it may be the same but in reality it is not.

I am sorry if this question is beneath you but I googled for a long
time and read all the related Usenet posts I could find and still don't
have an answer. Google for "perl multiple interpreter atomicity" and
you won't find much of anything. Sorry to have wasted your time.



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

Date: 29 Aug 2006 01:24:31 GMT
From: xhoster@gmail.com
Subject: Re: Multiple interpreters and data atomicity
Message-Id: <20060828212504.460$5G@newsreader.com>

"Derek Basch" <dbasch@yahoo.com> wrote:
> > I have a piece of string.  The piece of string is made out of nylon.
> > How long is the piece of string?
>
> How is this constructive? Have you ever heard the saying "There is no
> such thing as a stupid question".

Yes.  I happen not to believe it.

> I described my problem in detail and
> gave exact questions.

No, you didn't.  We have no idea what this "Data Store/Telnet" is, nor
how you use Perl to access it.  In fact, there was no Perl code at all.
How can you claim to that you gave details in a Perl group when you gave
no Perl code?

> Questions that you did not answer but instead
> mocked me. Why even be on Usenet if you are only going to make people
> feel stupid rather than help them?

I help all kinds of people--ones who ask meaningful questions.  I have
little patience of people who act stupid, whether they *feel* stupid or
not.

> >
> > Based on your description, I see no reason the situation you describe
> > would be any different than this one:
> >
> >    Server A                      Server B
> >        |                            |
> >       script--------\   /---------script
> >                     |   |
> >                     |   |
> >                     v   v
> >             Data Store/Telnet
> >
> > Xho
>
> Fine, that may be the case. However, you didn't say anything about how
> multiple interpreters running on different servers would affect the
> atomicity of the data in the Data Store if both interpreters ran the
> same function accessing the same attributes in the Data Store at the
> same time.

That is an issue to take up with this mysterious Data Store.

>
> That was my question. Not, "how is this question better expressed". As
> far as I can see  your example is different because I do not want to
> maintain different copies of the same file on multiple servers. So,
> theoretically it may be the same but in reality it is not.

If the two situations were different, then there might be some Perl content
to your question.  If (as I proposed as being most likely) the two
situations are not different, then there is no Perl content in your
question.  It is completely a matter of what this "Data Store" is and
exactly what level/type of atomicity is required.

>
> I am sorry if this question is beneath you but I googled for a long
> time and read all the related Usenet posts I could find and still don't
> have an answer. Google for "perl multiple interpreter atomicity" and
> you won't find much of anything. Sorry to have wasted your time.

That is because you are barking up the wrong tree.  Atomicity is primarily
a property of the "Data Store" server, not the Perl (or Java, or Python,
or C++, or Lisp, or Small Talk, or Ruby, or ...) client which talks to it.
I thought that claiming the equivalence of your original diagram to my
re-arranged one would have made this obvious.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Mon, 28 Aug 2006 20:11:23 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Multiple interpreters and data atomicity
Message-Id: <frncs3xpat.ln2@goaway.wombat.san-francisco.ca.us>

On 2006-08-29, Derek Basch <dbasch@yahoo.com> wrote:
>
> How is this constructive? Have you ever heard the saying "There is no
> such thing as a stupid question". I described my problem in detail and
> gave exact questions.

You did not describe your problem in detail.  Whether that's because
you do not know all the details, or simply neglected to include them,
we have no way of knowing.

The answers to your ''exact'' questions depend greatly on the exact
nature of your script and your data store.  So, your aphorism might be
rephrased "There are no stupid questions, but there are foolish ways
of asking."

> Fine, that may be the case. However, you didn't say anything about how
> multiple interpreters running on different servers would affect the
> atomicity of the data in the Data Store if both interpreters ran the
> same function accessing the same attributes in the Data Store at the
> same time.

It depends on the data store.  If the data store is a Perl program,
then your question is entirely appropriate here, but you need to
provide more specifics.  If it's not Perl, then you might try a
different newsgroup/mailing list dedicated to that product, asking
how it handles your scenario; if they say "it is all handled by the
client" then you might ask back here with that information.  (Though
in that case, it seems likely the answer to your question is obvious.)

The bottom line: it depends on the data store!

--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: Mon, 28 Aug 2006 22:42:19 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Multiple interpreters and data atomicity
Message-Id: <slrnef7dsr.d3o.tadmc@magna.augustmail.com>

Derek Basch <dbasch@yahoo.com> wrote:
>> I have a piece of string.  The piece of string is made out of nylon.  How
>> long is the piece of string?
> 
> How is this constructive? 


By pointing out that there is no way to answer the question
with only the given information.


> I described my problem in detail and
                         ^^^^^^^^^

There was no Perl code.


> gave exact questions. Questions that you did not answer 


There is no obligation for followups to answer any question you know.


> Why even be on Usenet if you are only going to make people
> feel stupid rather than help them?
              ^^^^^^^^^^^

Feeling stupid and being helped are not mutually exclusive, 
(it happens to me with distressing frequency).

It _is_ helpful to know that you are looking in the wrong place 
for the solution to your problem.


>> Based on your description, I see no reason the situation you describe would
>> be any different than this one:
>>
>>    Server A                      Server B
>>        |                            |
>>       script--------\   /---------script
>>                     |   |
>>                     |   |
>>                     v   v
>>             Data Store/Telnet
>>
>> Xho
> 
> Fine, that may be the case. However, you didn't say anything about how
> multiple interpreters running on different servers would affect the
> atomicity of the data in the Data Store if both interpreters ran the
> same function accessing the same attributes in the Data Store at the
> same time.


Because that is not a programming language question.

That is a Data Store question. The DB would have to also handle
the situation of two _different_ programs accessing the same 
attributes in the Data Store at the  same time.

The fact that the 2 processes are running the same source code has
no effect on whatever facilities the Data Store has for dealing
with concurrent access.


> As
> far as I can see  your example is different because I do not want to
> maintain different copies of the same file on multiple servers. 


Xho's example does not require different copies of the same file 
on multiple servers.

What makes you think that it does?


Xho's example does require different _processes_ executing on multiple 
servers though.

What matters are processes, they are the only way code gets executed.

Files are just a convenient, and often used, way of supplying some
code to the process for execution.


> So,
> theoretically it may be the same but in reality it is not.


So in reality it _is_ the same. 

You have multiple processes either way.


> I am sorry if this question is beneath you but I googled for a long
> time and read all the related Usenet posts I could find and still don't
> have an answer. Google for "perl multiple interpreter atomicity" and
> you won't find much of anything. 


Because multiple perl interpreters have no effect on atomicity.


> Sorry to have wasted your time.


No you're not.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 29 Aug 2006 04:42:08 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Tue Aug 29 2006
Message-Id: <J4qt28.1t3z@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.

Acme-MetaSyntactic-0.89
http://search.cpan.org/~book/Acme-MetaSyntactic-0.89/
Themed metasyntactic variables names
----
Business-OnlinePayment-PayPal-0.10
http://search.cpan.org/~plobbes/Business-OnlinePayment-PayPal-0.10/
PayPal backend for Business::OnlinePayment
----
Catalyst-Plugin-CRUD-0.13
http://search.cpan.org/~bayside/Catalyst-Plugin-CRUD-0.13/
CRUD (create/read/update/delete) Plugin for Catalyst
----
CharsetDetector-1.0.0
http://search.cpan.org/~foolfish/CharsetDetector-1.0.0/
Detect charset
----
Class-DBI-Replicated-0.040
http://search.cpan.org/~hdp/Class-DBI-Replicated-0.040/
Replication from single master to multiple slaves
----
Crypt-Tea-2.12
http://search.cpan.org/~pjb/Crypt-Tea-2.12/
The Tiny Encryption Algorithm in Perl and JavaScript
----
Crypt-Tea_JS-2.18
http://search.cpan.org/~pjb/Crypt-Tea_JS-2.18/
The Tiny Encryption Algorithm in Perl and JavaScript
----
Data-Hive-0.040
http://search.cpan.org/~hdp/Data-Hive-0.040/
convenient access to hierarchical data
----
Email-FolderType-0.812
http://search.cpan.org/~rjbs/Email-FolderType-0.812/
determine the type of a mail folder
----
Email-Store-0.252
http://search.cpan.org/~rjbs/Email-Store-0.252/
Framework for database-backed email storage
----
Excel-Template-TT-0.0.1
http://search.cpan.org/~tawan/Excel-Template-TT-0.0.1/
wrapper class for Excel::Template to using TT
----
Gtk2-Notify-0.02
http://search.cpan.org/~flora/Gtk2-Notify-0.02/
Perl interface to libnotify
----
HTTP-Daemon-Threaded-0.90
http://search.cpan.org/~darnold/HTTP-Daemon-Threaded-0.90/
Apartment threaded HTTP::Daemon-based server
----
Nagios-Report-0.003
http://search.cpan.org/~hopcrofts/Nagios-Report-0.003/
Perl class to filter and munge Nagios availability data
----
Net-Pcap-0.13
http://search.cpan.org/~saper/Net-Pcap-0.13/
Interface to pcap(3) LBL packet capture library
----
Net-Traceroute-PurePerl-0.10
http://search.cpan.org/~ahoying/Net-Traceroute-PurePerl-0.10/
----
Object-Array-0.060
http://search.cpan.org/~hdp/Object-Array-0.060/
array references with accessors
----
Object-Enum-0.070
http://search.cpan.org/~hdp/Object-Enum-0.070/
replacement for if ($foo eq 'bar')
----
POE-Component-Server-IRC-0.99_01
http://search.cpan.org/~bingos/POE-Component-Server-IRC-0.99_01/
a fully event-driven networkable IRC server daemon module.
----
POE-Component-Server-IRC-0.99_02
http://search.cpan.org/~bingos/POE-Component-Server-IRC-0.99_02/
a fully event-driven networkable IRC server daemon module.
----
SMS-Send-TW-PChome-0.01
http://search.cpan.org/~snowfly/SMS-Send-TW-PChome-0.01/
SMS::Send driver for sms.pchome.com.tw
----
Shell-EnvImporter-1.02
http://search.cpan.org/~dfaraldo/Shell-EnvImporter-1.02/
Perl extension for importing environment variable changes from external commands or shell scripts
----
Sys-Syslog-0.18
http://search.cpan.org/~saper/Sys-Syslog-0.18/
Perl interface to the UNIX syslog(3) calls
----
Term-Menus-1.19
http://search.cpan.org/~reedfish/Term-Menus-1.19/
Create Powerful Terminal, Console and CMD Enviroment Menus
----
Test-WWW-Mechanize-Object-0.020
http://search.cpan.org/~hdp/Test-WWW-Mechanize-Object-0.020/
run mech tests by making requests on an object
----
Text-Bidi-0.01
http://search.cpan.org/~kamensky/Text-Bidi-0.01/
Unicode bidi algorithm using libfribidi
----
Thread-Apartment-0.51
http://search.cpan.org/~darnold/Thread-Apartment-0.51/
Apartment threading wrapper for Perl objects
----
Win32-PerlExe-Env-0.02
http://search.cpan.org/~thw/Win32-PerlExe-Env-0.02/
Get environment informations of Win32 Perl executables
----
XML-Compile-0.04
http://search.cpan.org/~markov/XML-Compile-0.04/
----
XML-Compile-0.05
http://search.cpan.org/~markov/XML-Compile-0.05/
Compilation based XML processing
----
ack-1.27_01
http://search.cpan.org/~petdance/ack-1.27_01/
grep-like text finder for large trees of text
----
checkservers-0.9
http://search.cpan.org/~dmahoney/checkservers-0.9/


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/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 28 Aug 2006 16:54:04 -0700
From: usenet@DavidFilmer.com
Subject: Re: printing a multidimensional array in table format
Message-Id: <1156809243.953891.112280@m79g2000cwm.googlegroups.com>

joel wrote:
> I have used printf but it would require that I write code to determine the
> maximum widths of each column (the number of columns and size being
> variable). Not big deal but I thought that there may be an even easier way.

There is an easy way to avoid pre-calculating your maximum field
length; let the Text::Table module do it for you:

#!/usr/bin/perl
   use strict;   use warnings;
   use Text::Table;

   my $table = Text::Table->new({align => 'left'}, {align => 'left'});

   $table->load( <DATA> );
   print $table;

__DATA__
4591 05-00371
827 04-00307
31415927 123-456789

-- 
David Filmer (http://DavidFilmer.com)



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

Date: 28 Aug 2006 18:25:45 -0700
From: "joel" <joelingram@gmail.com>
Subject: Re: printing a multidimensional array in table format
Message-Id: <1156814745.751667.311950@m79g2000cwm.googlegroups.com>

Excellent, thanks for the suggestion!

--Joel

usenet@DavidFilmer.com wrote:
> joel wrote:
> > I have used printf but it would require that I write code to determine the
> > maximum widths of each column (the number of columns and size being
> > variable). Not big deal but I thought that there may be an even easier way.
>
> There is an easy way to avoid pre-calculating your maximum field
> length; let the Text::Table module do it for you:
>
> #!/usr/bin/perl
>    use strict;   use warnings;
>    use Text::Table;
>
>    my $table = Text::Table->new({align => 'left'}, {align => 'left'});
>
>    $table->load( <DATA> );
>    print $table;
>
> __DATA__
> 4591 05-00371
> 827 04-00307
> 31415927 123-456789
> 
> -- 
> David Filmer (http://DavidFilmer.com)



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

Date: 28 Aug 2006 23:29:18 -0700
From: "MoshiachNow" <lev.weissman@creo.com>
Subject: Re: Problem handling a Unicode file
Message-Id: <1156832958.148704.266150@h48g2000cwc.googlegroups.com>

Thanks,

I do exactly as advised above,but checking the output in bynary
dipslay,I see that all bytes are interchanged within the words - see
below.
Have tried also "utf16-LE",this did not help.

Good utf16 input file:
FF FE 57 00 69 00 6E 00

Bad output file:
FE FF 00 57 00 69 00 6E

(Indeed,the  print FILE "\x{FEFF}"; statement does not look like is
required,since it's been taken care of internally by Perl.)

So what can be still wrong ?



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

Date: Mon, 28 Aug 2006 22:20:55 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Question about socket and other modules
Message-Id: <b%JIg.17804$365.15206@edtnps89>

SQ wrote:
> Do these modules come standard with Perl 5.8, or do they need to be
> installed 
> separately:
> 
> Use Socket;
> Use Pg;
> Use Net::Ping;

See the "Standard Modules" section of perlmodlib

perldoc perlmodlib


John
-- 
use Perl;
program
fulfillment


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

Date: 28 Aug 2006 23:11:54 -0700
From: "goodarm@gmail.com" <goodarm@gmail.com>
Subject: Stupid Q: How to preserve numeric characters
Message-Id: <1156831914.765151.320550@i3g2000cwc.googlegroups.com>

Gurus,

I am relatively new to Perl so please bear with me. I am trying to
write a simple scrapper for a non-English Web pages. For that purpose I
am using HTML::TokeParser. Now, I am looking to extract some content I
need and generate another HTML page (whch potentially will have notes
in multiple languages). The pages I am scrapping are written using
numeric characters, e.g. &#1086;&#1076;&#1091;, when I am extracting
them, then injecting into my HTML page they get converted into
charaecters. All I want - is to preserve the original numeric
characters, as it seems to be the easiest way to build my result page.
How do I do that?

A sample code:

sub parseResponce($$) {
	my $data = shift;
	my $stream = new HTML::TokeParser($data);

	while (my $tag = $stream->get_tag("p")) {
		if (...) {
			$buff = $stream->get_trimmed_text("/p");
                }
}

Thanks in advance, Victor



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

Date: 28 Aug 2006 23:42:56 -0700
From: himanshu.garg@gmail.com
Subject: Re: Stupid Q: How to preserve numeric characters
Message-Id: <1156833775.664646.25520@74g2000cwt.googlegroups.com>

goodarm@gmail.com wrote:

> Gurus,
>
> I am relatively new to Perl so please bear with me. I am trying to
> write a simple scrapper for a non-English Web pages. For that purpose I
> am using HTML::TokeParser. Now, I am looking to extract some content I
> need and generate another HTML page (whch potentially will have notes
> in multiple languages). The pages I am scrapping are written using
> numeric characters, e.g. &#1086;&#1076;&#1091;, when I am extracting
> them, then injecting into my HTML page they get converted into
> charaecters. All I want - is to preserve the original numeric
> characters, as it seems to be the easiest way to build my result page.
> How do I do that?
>
> A sample code:
>
> sub parseResponce($$) {
> 	my $data = shift;
> 	my $stream = new HTML::TokeParser($data);
>
> 	while (my $tag = $stream->get_tag("p")) {
> 		if (...) {
> 			$buff = $stream->get_trimmed_text("/p");
>                 }
> }

You could try the method from its parent class

     $stream->attr_encoded( 1 );

before calling get_tag.

See Also:-

http://search.cpan.org/~gaas/HTML-Parser-3.55/Parser.pm

> 
> Thanks in advance, Victor

Thank You,
++imanshu



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

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


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