[30361] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1604 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 3 03:09:42 2008

Date: Tue, 3 Jun 2008 00:09:07 -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, 3 Jun 2008     Volume: 11 Number: 1604

Today's topics:
    Re: FAQ 6.18 Why does using $&, $`, or $' slow my progr <ben@morrow.me.uk>
        HTML::Tokerparser / parsing <p>,<br> <mislam@nospam.ciuc.edu>
    Re: HTML::Tokerparser / parsing <p>,<br> <1usa@llenroc.ude.invalid>
    Re: HTML::Tokerparser / parsing <p>,<br> <1usa@llenroc.ude.invalid>
    Re: HTML::Tokerparser / parsing <p>,<br> <noreply@gunnar.cc>
        new CPAN modules on Tue Jun  3 2008 (Randal Schwartz)
    Re: pattern match timed-out question <lovecreatesbeauty@gmail.com>
        Perl grep and Perl 4 fourfour2@gmail.com
    Re: Perl grep and Perl 4 fourfour2@gmail.com
        Perl Modules <fjrusso@yahoo.com>
    Re: Perl Modules <glex_no-spam@qwest-spam-no.invalid>
    Re: Perl Modules <1usa@llenroc.ude.invalid>
    Re: Perl read file eat up my memory... <howachen@gmail.com>
    Re: Perl Special Variable Containing the name of the me <szrRE@szromanMO.comVE>
    Re: Perl Special Variable Containing the name of the me <ben@morrow.me.uk>
        Posting Guidelines for comp.lang.perl.misc ($Revision:  tadmc@seesig.invalid
    Re: Using COM in Perl... Possible? <tlviewer@VISTAyahoo.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 3 Jun 2008 00:21:50 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: FAQ 6.18 Why does using $&, $`, or $' slow my program down?
Message-Id: <etbeh5-hku.ln1@osiris.mauzo.dyndns.org>


Quoth PerlFAQ Server <brian@stonehenge.com>:
> This is an excerpt from the latest version perlfaq6.pod, which
> comes with the standard Perl distribution. These postings aim to 
> reduce the number of repeated questions as well as allow the community
> to review and update the answers. The latest version of the complete
> perlfaq is at http://faq.perl.org .
> 
> --------------------------------------------------------------------
> 
> 6.18: Why does using $&, $`, or $' slow my program down?

Should this answer mention ${^PREMATCH} &c. from 5.10?

Ben

-- 
  Joy and Woe are woven fine,
  A Clothing for the Soul divine       William Blake
  Under every grief and pine          'Auguries of Innocence'
  Runs a joy with silken twine.                                ben@morrow.me.uk


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

Date: Mon, 02 Jun 2008 15:53:27 -0500
From: Sharif <mislam@nospam.ciuc.edu>
Subject: HTML::Tokerparser / parsing <p>,<br>
Message-Id: <g21mk6$9k7$1@news.acm.uiuc.edu>

Hi,

I am using the Tokeparser module for a html file that contains movie 
title, description, library call number, year, duration etc. But the 
html files are marked so I have to rely on the the paragraph and line 
break. Here's what I have so far. This is a sample html chunk, after the 
<p></p> the next record starts. I am trying to covert this into a SQL 
database.
___HTML__
<p>124- Chocolat<br>
               Santa Monica, CA, 106 minutes<br>
               MGM Home Entertainment, 2001<br>
               DVD 791.43653 C451</p>

             <p>A young woman returns to Cameroon to trace her past. 
Soon the sights,  sounds, and smells sweep her back to her childhood and 
memories of the people who populated her youth. (French with English and 
              Spanish subtitles.)</p>            <p></p>
__HTML___

This is what I have so far:


use strict ;
use  HTML::TokeParser;

  $p = HTML::TokeParser->new("movie.html") || die "Can't open: $!";

   while (my $token = $p->get_token) {
    if ($p->get_tag("p")) {
       my $title = $p->get_trimmed_text;
       print "$title\n";
   }

    elsif ($p->get_tag("br")){
       my $desc = $p->get_trimmed_text ;
       print "$desc \n";  }

    }

I was able to extract the title and description, how do I get the rest 
of the information?

# perl toke.pl
124- Chocolat
A young woman returns to Cameroon to trace her past. Soon the sights, 
sounds, and smells sweep her back to her childhood and memories of the 
people who populated her youth. (French with English and Spanish subtitles.)

--s


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

Date: Mon, 02 Jun 2008 21:55:04 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: HTML::Tokerparser / parsing <p>,<br>
Message-Id: <Xns9AB1B6438AF82asu1cornelledu@127.0.0.1>

Sharif <mislam@nospam.ciuc.edu> wrote in
news:g21mk6$9k7$1@news.acm.uiuc.edu: 

> I am using the Tokeparser module for a html file that contains movie 
> title, description, library call number, year, duration etc. But the 
> html files are marked so I have to rely on the the paragraph and line 
> break. Here's what I have so far. This is a sample html chunk, after
> the <p></p> the next record starts. I am trying to covert this into a
> SQL database.
> ___HTML__
> <p>124- Chocolat<br>
>                Santa Monica, CA, 106 minutes<br>
>                MGM Home Entertainment, 2001<br>
>                DVD 791.43653 C451</p>
> 
>              <p>A young woman returns to Cameroon to trace her past. 
> Soon the sights,  sounds, and smells sweep her back to her childhood
> and memories of the people who populated her youth. (French with
> English and 
>               Spanish subtitles.)</p>            <p></p>
> __HTML___

Don't do this. Either do an assignment to a scalar or use __DATA__ so 
the script you post is ready to run.

> This is what I have so far:
> 
> 
> use strict ;
> use  HTML::TokeParser;
> 
>   $p = HTML::TokeParser->new("movie.html") || die "Can't open: $!";

Ahem ... You have use strict above yet $p is not declared using my. 

In deference to Ted, I will limit myself to pointing out that you should 
not type "use strict;" for cosmetic purposes. Doing so misleads the 
reader to think that the code you posted actually compiles under use 
strict.

Please read the posting guidelines for this group and follow them.

Here is a script that gets the meta information and the description. You 
can go ahead and parse the elements of the @meta array to get the 
individual fields with whatever specificity you desire.

(The first version of this script parsed the meta information using a 
regex but I have decided not to include that in light of the misleading 
inclusion of the 

use strict;

lines above).

#!/usr/bin/perl

use strict;
use warnings;

use Data::Dumper;
use HTML::TokeParser;

my $html = <<EO_HTML;
<p>124- Chocolat<br>
               Santa Monica, CA, 106 minutes<br>
               MGM Home Entertainment, 2001<br>
               DVD 791.43653 C451</p>

             <p>A young woman returns to Cameroon to trace her past. 
Soon the sights,  sounds, and smells sweep her back to her childhood and 
memories of the people who populated her youth. (French with English and 
              Spanish subtitles.)</p>            <p></p>
EO_HTML

my $p = HTML::TokeParser->new( \$html );

my @meta;

if ( my $token = $p->get_tag('p') ) {
    my $text = $p->get_text( 'p' );
    @meta = split /\n\s+/, $text;
    @meta = grep { length } @meta;
}

my $desc;

if ( my $token = $p->get_tag('p') ) {
    $desc = $p->get_trimmed_text( 'p' );
}

print Dumper( \@meta, $desc );

__END__

C:\Temp> hh
$VAR1 = [
          '124- Chocolat ',
          'Santa Monica, CA, 106 minutes ',
          'MGM Home Entertainment, 2001 ',
          'DVD 791.43653 C451 '
        ];
$VAR2 = 'A young woman returns to Cameroon to trace her past. Soon the 
sights, sounds, and smells sweep her back to her childhood and memories 
of the people who populated her youth. (French with English and Spanish 
subtitles.)';

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/


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

Date: Mon, 02 Jun 2008 22:18:36 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: HTML::Tokerparser / parsing <p>,<br>
Message-Id: <Xns9AB1BA40D16D9asu1cornelledu@127.0.0.1>

Sharif <mislam@nospam.ciuc.edu> wrote in
news:g21mk6$9k7$1@news.acm.uiuc.edu: 

> I was able to extract the title and description, how do I get the rest
> of the information?
> 
> # perl toke.pl
> 124- Chocolat
> A young woman returns to Cameroon to trace her past. Soon the sights, 
> sounds, and smells sweep her back to her childhood and memories of the
> people who populated her youth. (French with English and Spanish
> subtitles.) 

Wait a second.

So I created a movie.html file and used your program to parse it:

C:\Temp> cat movie.html
<p>124- Chocolat<br>
               Santa Monica, CA, 106 minutes<br>
               MGM Home Entertainment, 2001<br>
               DVD 791.43653 C451</p>

             <p>A young woman returns to Cameroon to trace her past.
Soon the sights,  sounds, and smells sweep her back to her childhood and
memories of the people who populated her youth. (French with English and
              Spanish subtitles.)</p>            <p></p>


C:\Temp> cat tt.pl
#!/usr/bin/perl

use strict ;
use warnings;

use  HTML::TokeParser;

my $p = HTML::TokeParser->new("movie.html") || die "Can't open: $!";

while (my $token = $p->get_token) {
    if ( $p->get_tag("p") ) {
        my $title = $p->get_trimmed_text;
        print "$title\n";
    }
    elsif ( $p->get_tag("br") ) {
        my $desc = $p->get_trimmed_text;
        print "$desc \n";
    }
}

__END__

C:\Temp> tt
A young woman returns to Cameroon to trace her past. Soon the sights, 
sounds, and smells sweep her back to her childhood and memories of the 
people who populated her youth. (French with English and Spanish 
subtitles.)

Notice how the output I got is different than the output you posted?

Why is that?

Sinan


-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/


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

Date: Tue, 03 Jun 2008 01:03:23 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: HTML::Tokerparser / parsing <p>,<br>
Message-Id: <6ajcl6F38cfubU1@mid.individual.net>

Sharif wrote:
> I am using the Tokeparser module for a html file that contains movie 
> title, description, library call number, year, duration etc. But the 
> html files are marked so I have to rely on the the paragraph and line 
> break.

There needs to be something else that identifies the start of a movie, I 
think, or else I doubt that HTML::TokeParser is a suitable tool for the 
task.

Do you have a URL?

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Tue, 3 Jun 2008 04:42:22 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Tue Jun  3 2008
Message-Id: <K1vEEM.1L2F@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-Kensiro-0.05
http://search.cpan.org/~tokuhirom/Acme-Kensiro-0.05/
kensiro-sinsu 
----
Acme-SelfBenchmark-0.01
http://search.cpan.org/~tokuhirom/Acme-SelfBenchmark-0.01/
which is self fastest? 
----
Audio-M4P-0.46
http://search.cpan.org/~billh/Audio-M4P-0.46/
Perl QuickTime / MP4 / iTunes Music Store audio / video file tools 
----
Bitmask-Data-1.01
http://search.cpan.org/~maros/Bitmask-Data-1.01/
Handle bitmasks in an easy and flexible way 
----
Calendar-List-0.21
http://search.cpan.org/~barbie/Calendar-List-0.21/
A module for creating date lists 
----
DBIx-Class-PopulateMore-0.03
http://search.cpan.org/~jjnapiork/DBIx-Class-PopulateMore-0.03/
An enhanced populate method 
----
File-BLOB-1.06
http://search.cpan.org/~adamk/File-BLOB-1.06/
A file (with name, and other metadata) you can BLOBify 
----
File-SortedSeek-0.015
http://search.cpan.org/~jfreeman/File-SortedSeek-0.015/
A Perl module providing fast access to large files 
----
Games-Bowling-Scorecard-0.103
http://search.cpan.org/~rjbs/Games-Bowling-Scorecard-0.103/
score your bowling game easily 
----
Games-Trackword-1.06
http://search.cpan.org/~barbie/Games-Trackword-1.06/
Find words on a Trackword grid. 
----
Glib-1.183
http://search.cpan.org/~tsch/Glib-1.183/
Perl wrappers for the GLib utility and Object libraries 
----
Gtk2-1.183
http://search.cpan.org/~tsch/Gtk2-1.183/
Perl interface to the 2.x series of the Gimp Toolkit library 
----
HTML-Lint-2.04
http://search.cpan.org/~petdance/HTML-Lint-2.04/
check for HTML errors in a string or file 
----
HTML-TurboForm-0.10
http://search.cpan.org/~camelcase/HTML-TurboForm-0.10/
----
HTML-TurboForm-0.11
http://search.cpan.org/~camelcase/HTML-TurboForm-0.11/
----
Lingua-RU-Detect-1.0
http://search.cpan.org/~andy/Lingua-RU-Detect-1.0/
Heuristics for guessing encoding sequence 
----
MRO-Compat-0.08_01
http://search.cpan.org/~blblack/MRO-Compat-0.08_01/
mro::* interface compatibility for Perls < 5.9.5 
----
Mail-Builder-1.11
http://search.cpan.org/~maros/Mail-Builder-1.11/
Easily create plaintext/html e-mail messages with attachments and inline images 
----
MasonX-Component-0.01_01
http://search.cpan.org/~flora/MasonX-Component-0.01_01/
manage mason components 
----
MasonX-Component-0.01_02
http://search.cpan.org/~flora/MasonX-Component-0.01_02/
manage mason components 
----
Methods-CheckNames-0.01
http://search.cpan.org/~nuffin/Methods-CheckNames-0.01/
Statically check for named methods 
----
Module-Install-0.75
http://search.cpan.org/~adamk/Module-Install-0.75/
Standalone, extensible Perl module installer 
----
MooseX-Traits-0.02
http://search.cpan.org/~jrockway/MooseX-Traits-0.02/
automatically apply roles at object creation time 
----
Net-Async-HTTP-0.01
http://search.cpan.org/~pevans/Net-Async-HTTP-0.01/
Asynchronous HTTP user agent 
----
Net-OAuth-0.08
http://search.cpan.org/~kgrennan/Net-OAuth-0.08/
OAuth protocol support 
----
PLP-3.22
http://search.cpan.org/~shiar/PLP-3.22/
Perl in HTML pages 
----
POSIX-Regex-0.90.11
http://search.cpan.org/~jettero/POSIX-Regex-0.90.11/
OO interface for the gnu regex engine 
----
Parse-BBCode-0.05
http://search.cpan.org/~tinita/Parse-BBCode-0.05/
Module to turn BBCode into HTML or plain text 
----
Perl-Compare-0.11
http://search.cpan.org/~adamk/Perl-Compare-0.11/
Normalized Comparison for Perl Source Trees 
----
Perl-Metrics-Plugin-MinimumVersion-0.02
http://search.cpan.org/~adamk/Perl-Metrics-Plugin-MinimumVersion-0.02/
Perl::Metrics plugin for Perl::MinimumVersion 
----
PerlIO-Util-0.31
http://search.cpan.org/~gfuji/PerlIO-Util-0.31/
A selection of general PerlIO utilities 
----
SMS-Send-US-Ipipi-0.02
http://search.cpan.org/~amoore/SMS-Send-US-Ipipi-0.02/
An SMS::Send driver for the ipipi.com website 
----
SMS-Send-US-Ipipi-0.03
http://search.cpan.org/~amoore/SMS-Send-US-Ipipi-0.03/
An SMS::Send driver for the ipipi.com website 
----
Scalar-Vec-Util-0.04
http://search.cpan.org/~vpit/Scalar-Vec-Util-0.04/
Utility routines for vec strings. 
----
Sman-1.03_001
http://search.cpan.org/~joshr/Sman-1.03_001/
Tool for searching and indexing man pages 
----
Squatting-0.30
http://search.cpan.org/~beppu/Squatting-0.30/
A Camping-inspired Web Microframework for Perl 
----
TaskForest-1.13
http://search.cpan.org/~enoor/TaskForest-1.13/
Simple, powerful task scheduler 
----
Template-Parser-LocalizeNewlines-1.04
http://search.cpan.org/~adamk/Template-Parser-LocalizeNewlines-1.04/
Drop-in replacement Template::Parser that fixes bad newlines 
----
Test-CPAN-Meta-0.11
http://search.cpan.org/~barbie/Test-CPAN-Meta-0.11/
Validation of the META.yml file in a CPAN distribution. 
----
Test-YAML-Meta-0.10
http://search.cpan.org/~barbie/Test-YAML-Meta-0.10/
Validation of the META.yml file in a distribution. 
----
Vroom-0.13
http://search.cpan.org/~ingy/Vroom-0.13/
See Vroom::Vroom. 
----
XXX-0.11
http://search.cpan.org/~ingy/XXX-0.11/
See Your Data in the Nude 
----
lib-0.56_01
http://search.cpan.org/~smueller/lib-0.56_01/
manipulate @INC at compile time 
----
podlators-2.1.0
http://search.cpan.org/~rra/podlators-2.1.0/
----
the-0.14
http://search.cpan.org/~ingy/the-0.14/
This is teh, best module evar! 
----
the-0.15
http://search.cpan.org/~ingy/the-0.15/
This is teh, best module evar! 


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: Mon, 2 Jun 2008 19:02:24 -0700 (PDT)
From: "lovecreatesbea...@gmail.com" <lovecreatesbeauty@gmail.com>
Subject: Re: pattern match timed-out question
Message-Id: <91302878-8658-42f1-9d3c-dcacdbb32c6a@u6g2000prc.googlegroups.com>

On Jun 2, 11:04=A0pm, smallpond <smallp...@juno.com> wrote:
> lovecreatesbea...@gmail.com wrote:
> > Hi,
>
> > Where am I wrong?
>
> use warnings;
> use strict;
>
> Also check the return from things like open for errors.
> How else are you going to find your problem?

I increase the timeout value and it works now

    $cnn->waitfor(Match =3D> $lg_prom, Timeout =3D> $cnn->timeout * 10);


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

Date: Mon, 2 Jun 2008 23:59:29 -0700 (PDT)
From: fourfour2@gmail.com
Subject: Perl grep and Perl 4
Message-Id: <2e87cb31-98bc-4b90-8d25-96e862df3d04@x1g2000prh.googlegroups.com>

Greetings,

I'm using Perl 4 and have problems getting syntax error when using a
grep BLOCK LIST.

What I am trying to do is see if a string is in a list of strings, but
using grep BLOCK LIST.
Note, I have parenthesis in the string.

This works in Perl 5 but not Perl 4:

 ...
$string1="thisisstring(one)";
@stringlist=("thisisstring(one)", "thisisafunnystring");


if (( !grep { $potatoe eq $_ ) @listofpotatoes {
   print "Not found in list....\n"
}


>syntax error,next 2 tokens :grep {"

Is grep BLOCK LIST not supported in Perl 4 ?

In Perl 4 how can I use perl grep to grep for strings like the above.
Is it possible, supported?
I want to use perl grep, nothing else.

Thanks!


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

Date: Tue, 3 Jun 2008 00:02:46 -0700 (PDT)
From: fourfour2@gmail.com
Subject: Re: Perl grep and Perl 4
Message-Id: <5b6dc862-64da-4822-84cf-c49efcd39b93@u12g2000prd.googlegroups.com>

On Jun 2, 11:59=A0pm, fourfo...@gmail.com wrote:
> Greetings,
>
> I'm using Perl 4 and have problems getting syntax error when using a
> grep BLOCK LIST.
>
> What I am trying to do is see if a string is in a list of strings, but
> using grep BLOCK LIST.
> Note, I have parenthesis in the string.
>
> This works in Perl 5 but not Perl 4:
>
> ...
> $string1=3D"thisisstring(one)";
> @stringlist=3D("thisisstring(one)", "thisisafunnystring");

I mean
$potatoe=3D"thisisstring(one)";
@listofpotatoes=3D("thisisstring(one)", "thisisafunnystring");

if (( !grep { $potatoe eq $_ ) @listofpotatoes {
=A0 =A0print "Not found in list....\n"

}
>syntax error,next 2 tokens :grep {"

Is grep BLOCK LIST not supported in Perl 4 ?

In Perl 4 how can I use perl grep to grep for strings like the above.
Is it possible, supported?
I want to use perl grep, nothing else.

 Thanks!



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

Date: Mon, 2 Jun 2008 14:20:07 -0700 (PDT)
From: Frank <fjrusso@yahoo.com>
Subject: Perl Modules
Message-Id: <83076d1c-fcd8-4e54-a872-e77c1d2b4144@m3g2000hsc.googlegroups.com>

Where do I find a listing of available modules or the modules
themselves?  Documentation available? Where is a good place to search?

Frank


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

Date: Mon, 02 Jun 2008 16:28:53 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Perl Modules
Message-Id: <48446615$0$33229$815e3792@news.qwest.net>

Frank wrote:
> Where do I find a listing of available modules or the modules
> themselves?  Documentation available? Where is a good place to search?

A good place to start is with the documentation that came with your 
installation, using "perldoc".  e.g.

perldoc -q "What modules and extensions are available for Perl"

Using your favorite Internet search engine, searching for
"perl modules", would probably have returned many helpful sites too.


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

Date: Mon, 02 Jun 2008 21:57:52 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Perl Modules
Message-Id: <Xns9AB1B6BC7A8C7asu1cornelledu@127.0.0.1>

Frank <fjrusso@yahoo.com> wrote in news:83076d1c-fcd8-4e54-a872-
e77c1d2b4144@m3g2000hsc.googlegroups.com:

> Where do I find a listing of available modules or the modules
> themselves? 

perldoc perltoc

for the table of contents of the POD documentation on your system.

> Documentation available?

perldoc -q module

to search the FAQ list. The search above yields:

What modules and extensions are available for Perl?  What is CPAN?  What 
does CPAN/src/... mean?

> Where is a good place to search?

There is always Google. On the other hand, you can always go to 
<URL:http://search.cpan.org/>.

Please read the posting guidelines for this group and follow them.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/


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

Date: Mon, 2 Jun 2008 19:27:15 -0700 (PDT)
From: howa <howachen@gmail.com>
Subject: Re: Perl read file eat up my memory...
Message-Id: <bdf78b4e-583c-4138-baa1-3f46ab72ef60@a32g2000prf.googlegroups.com>

Hi,

On 6$B7n(B3$BF|(B, $B>e8a(B3$B;~(B08$BJ,(B, Jim Gibson <jimsgib...@gmail.com> wrote:
> Others told you about using while instead of foreach. In addition, if
> you don't get output you expect, you should 1) Add a newline character
> to your output, and 2) set standard output for no buffering (some call
> it auto-flushing) (see 'perldoc -q flush").
>
> --
> Jim Gibson

Yes, it work now.


Thanks.



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

Date: Mon, 2 Jun 2008 13:20:32 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: Perl Special Variable Containing the name of the method currently in?
Message-Id: <g21kmh01i8g@news4.newsguy.com>

Uri Guttman wrote:
>>>>>> "s" == szr  <szrRE@szromanMO.comVE> writes:
>
>  s> Frank Seitz wrote:
>  >>>
>  >> It should be mentioned that there are cases where
>  >> the code does not work as expected:
>  >>
>  >> *f = \&iknowmyname;
>  >>
>  >> iknowmyname();
>  >> f();
>  >>
>  >> __END__
>  >> My name is 'main::iknowmyname'
>  >> My name is 'main::iknowmyname'
>
>  s> This would be exactly what I would expect. 'main::iknowmyname' is
>  the s> conical name of the function, where as 'f' is basically just
> a pointer
>
> canonical

Yes, thank you.

>  s> (ok, alias) and not the true name of the function, where as
>  s> 'main::iknowmyname' is the true name :-)
>
> actually that isn't true. once you store a code ref into a type glob
> perl can't tell which name came first. the symbol table is just a
> special hash and has the same behavior. i bet if you chose multiple
> names or selected them in the right way, you could make any of them
> show up as the caller name. perl will likely just report the first
> name that has the given address it is looking for.

I have never seen such behavior. Could you please provide an example or 
two that illustrates that?

-- 
szr 




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

Date: Tue, 3 Jun 2008 00:28:44 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Perl Special Variable Containing the name of the method currently in?
Message-Id: <caceh5-hku.ln1@osiris.mauzo.dyndns.org>


Quoth Uri Guttman <uri@stemsystems.com>:
> 
> actually that isn't true. once you store a code ref into a type glob
> perl can't tell which name came first. the symbol table is just a
> special hash and has the same behavior. i bet if you chose multiple
> names or selected them in the right way, you could make any of them show
> up as the caller name. perl will likely just report the first name that
> has the given address it is looking for.

Nope. When a sub is compiled it has the (fully-qualified) name it was
compiled under stored in the CV structure, and no amount of aliasing
will change that. If you play silly tricks like

    sub foo { print +(caller 0)[3] }
    *bar = \&foo;
    *foo = sub { 1; }

then calling bar() will still print 'main::foo'. You can rename a sub
with Sub::Name (which can be useful for getting sensible stack traces
from anonymous subs).

Ben

-- 
                Outside of a dog, a book is a man's best friend.
                Inside of a dog, it's too dark to read.
ben@morrow.me.uk                                                  Groucho Marx


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

Date: Tue, 03 Jun 2008 06:12:03 GMT
From: tadmc@seesig.invalid
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.8 $)
Message-Id: <Tg51k.3301$N87.2858@nlpi068.nbdc.sbc.com>

Outline
   Before posting to comp.lang.perl.misc
      Must
       - Check the Perl Frequently Asked Questions (FAQ)
       - Check the other standard Perl docs (*.pod)
      Really Really Should
       - Lurk for a while before posting
       - Search a Usenet archive
      If You Like
       - Check Other Resources
   Posting to comp.lang.perl.misc
      Is there a better place to ask your question?
       - Question should be about Perl, not about the application area
      How to participate (post) in the clpmisc community
       - Carefully choose the contents of your Subject header
       - Use an effective followup style
       - Speak Perl rather than English, when possible
       - Ask perl to help you
       - Do not re-type Perl code
       - Provide enough information
       - Do not provide too much information
       - Do not post binaries, HTML, or MIME
      Social faux pas to avoid
       - Asking a Frequently Asked Question
       - Asking a question easily answered by a cursory doc search
       - Asking for emailed answers
       - Beware of saying "doesn't work"
       - Sending a "stealth" Cc copy
      Be extra cautious when you get upset
       - Count to ten before composing a followup when you are upset
       - Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------

Posting Guidelines for comp.lang.perl.misc ($Revision: 1.8 $)
    This newsgroup, commonly called clpmisc, is a technical newsgroup
    intended to be used for discussion of Perl related issues (except job
    postings), whether it be comments or questions.

    As you would expect, clpmisc discussions are usually very technical in
    nature and there are conventions for conduct in technical newsgroups
    going somewhat beyond those in non-technical newsgroups.

    The article at:

        http://www.catb.org/~esr/faqs/smart-questions.html

    describes how to get answers from technical people in general.

    This article describes things that you should, and should not, do to
    increase your chances of getting an answer to your Perl question. It is
    available in POD, HTML and plain text formats at:

     http://www.rehabitation.com/clpmisc.shtml

    For more information about netiquette in general, see the "Netiquette
    Guidelines" at:

     http://andrew2.andrew.cmu.edu/rfc/rfc1855.html

    A note to newsgroup "regulars":

       Do not use these guidelines as a "license to flame" or other
       meanness. It is possible that a poster is unaware of things
       discussed here.  Give them the benefit of the doubt, and just
       help them learn how to post, rather than assume that they do 
       know and are being the "bad kind" of Lazy.

    A note about technical terms used here:

       In this document, we use words like "must" and "should" as
       they're used in technical conversation (such as you will
       encounter in this newsgroup). When we say that you *must* do
       something, we mean that if you don't do that something, then
       it's unlikely that you will benefit much from this group.
       We're not bossing you around; we're making the point without
       lots of words.

    Do *NOT* send email to the maintainer of these guidelines. It will be
    discarded unread. The guidelines belong to the newsgroup so all
    discussion should appear in the newsgroup. I am just the secretary that
    writes down the consensus of the group.

Before posting to comp.lang.perl.misc
  Must
    This section describes things that you *must* do before posting to
    clpmisc, in order to maximize your chances of getting meaningful replies
    to your inquiry and to avoid getting flamed for being lazy and trying to
    have others do your work.

    The perl distribution includes documentation that is copied to your hard
    drive when you install perl. Also installed is a program for looking
    things up in that (and other) documentation named 'perldoc'.

    You should either find out where the docs got installed on your system,
    or use perldoc to find them for you. Type "perldoc perldoc" to learn how
    to use perldoc itself. Type "perldoc perl" to start reading Perl's
    standard documentation.

    Check the Perl Frequently Asked Questions (FAQ)
        Checking the FAQ before posting is required in Big 8 newsgroups in
        general, there is nothing clpmisc-specific about this requirement.
        You are expected to do this in nearly all newsgroups.

        You can use the "-q" switch with perldoc to do a word search of the
        questions in the Perl FAQs.

    Check the other standard Perl docs (*.pod)
        The perl distribution comes with much more documentation than is
        available for most other newsgroups, so in clpmisc you should also
        see if you can find an answer in the other (non-FAQ) standard docs
        before posting.

    It is *not* required, or even expected, that you actually *read* all of
    Perl's standard docs, only that you spend a few minutes searching them
    before posting.

    Try doing a word-search in the standard docs for some words/phrases
    taken from your problem statement or from your very carefully worded
    "Subject:" header.

  Really Really Should
    This section describes things that you *really should* do before posting
    to clpmisc.

    Lurk for a while before posting
        This is very important and expected in all newsgroups. Lurking means
        to monitor a newsgroup for a period to become familiar with local
        customs. Each newsgroup has specific customs and rituals. Knowing
        these before you participate will help avoid embarrassing social
        situations. Consider yourself to be a foreigner at first!

    Search a Usenet archive
        There are tens of thousands of Perl programmers. It is very likely
        that your question has already been asked (and answered). See if you
        can find where it has already been answered.

        One such searchable archive is:

         http://groups.google.com/advanced_group_search

  If You Like
    This section describes things that you *can* do before posting to
    clpmisc.

    Check Other Resources
        You may want to check in books or on web sites to see if you can
        find the answer to your question.

        But you need to consider the source of such information: there are a
        lot of very poor Perl books and web sites, and several good ones
        too, of course.

Posting to comp.lang.perl.misc
    There can be 200 messages in clpmisc in a single day. Nobody is going to
    read every article. They must decide somehow which articles they are
    going to read, and which they will skip.

    Your post is in competition with 199 other posts. You need to "win"
    before a person who can help you will even read your question.

    These sections describe how you can help keep your article from being
    one of the "skipped" ones.

  Is there a better place to ask your question?
    Question should be about Perl, not about the application area
        It can be difficult to separate out where your problem really is,
        but you should make a conscious effort to post to the most
        applicable newsgroup. That is, after all, where you are the most
        likely to find the people who know how to answer your question.

        Being able to "partition" a problem is an essential skill for
        effectively troubleshooting programming problems. If you don't get
        that right, you end up looking for answers in the wrong places.

        It should be understood that you may not know that the root of your
        problem is not Perl-related (the two most frequent ones are CGI and
        Operating System related), so off-topic postings will happen from
        time to time. Be gracious when someone helps you find a better place
        to ask your question by pointing you to a more applicable newsgroup.

  How to participate (post) in the clpmisc community
    Carefully choose the contents of your Subject header
        You have 40 precious characters of Subject to win out and be one of
        the posts that gets read. Don't waste them. Take care while
        composing them, they are the key that opens the door to getting an
        answer.

        Spend them indicating what aspect of Perl others will find if they
        should decide to read your article.

        Do not spend them indicating "experience level" (guru, newbie...).

        Do not spend them pleading (please read, urgent, help!...).

        Do not spend them on non-Subjects (Perl question, one-word
        Subject...)

        For more information on choosing a Subject see "Choosing Good
        Subject Lines":

         http://www.cpan.org/authors/id/D/DM/DMR/subjects.post

        Part of the beauty of newsgroup dynamics, is that you can contribute
        to the community with your very first post! If your choice of
        Subject leads a fellow Perler to find the thread you are starting,
        then even asking a question helps us all.

    Use an effective followup style
        When composing a followup, quote only enough text to establish the
        context for the comments that you will add. Always indicate who
        wrote the quoted material. Never quote an entire article. Never
        quote a .signature (unless that is what you are commenting on).

        Intersperse your comments *following* each section of quoted text to
        which they relate. Unappreciated followup styles are referred to as
        "top-posting", "Jeopardy" (because the answer comes before the
        question), or "TOFU" (Text Over, Fullquote Under).

        Reversing the chronology of the dialog makes it much harder to
        understand (some folks won't even read it if written in that style).
        For more information on quoting style, see:

         http://web.presby.edu/~nnqadmin/nnq/nquote.html

    Speak Perl rather than English, when possible
        Perl is much more precise than natural language. Saying it in Perl
        instead will avoid misunderstanding your question or problem.

        Do not say: I have variable with "foo\tbar" in it.

        Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
        or I have $var = <DATA> (and show the data line).

    Ask perl to help you
        You can ask perl itself to help you find common programming mistakes
        by doing two things: enable warnings (perldoc warnings) and enable
        "strict"ures (perldoc strict).

        You should not bother the hundreds/thousands of readers of the
        newsgroup without first seeing if a machine can help you find your
        problem. It is demeaning to be asked to do the work of a machine. It
        will annoy the readers of your article.

        You can look up any of the messages that perl might issue to find
        out what the message means and how to resolve the potential mistake
        (perldoc perldiag). If you would like perl to look them up for you,
        you can put "use diagnostics;" near the top of your program.

    Do not re-type Perl code
        Use copy/paste or your editor's "import" function rather than
        attempting to type in your code. If you make a typo you will get
        followups about your typos instead of about the question you are
        trying to get answered.

    Provide enough information
        If you do the things in this item, you will have an Extremely Good
        chance of getting people to try and help you with your problem!
        These features are a really big bonus toward your question winning
        out over all of the other posts that you are competing with.

        First make a short (less than 20-30 lines) and *complete* program
        that illustrates the problem you are having. People should be able
        to run your program by copy/pasting the code from your article. (You
        will find that doing this step very often reveals your problem
        directly. Leading to an answer much more quickly and reliably than
        posting to Usenet.)

        Describe *precisely* the input to your program. Also provide example
        input data for your program. If you need to show file input, use the
        __DATA__ token (perldata.pod) to provide the file contents inside of
        your Perl program.

        Show the output (including the verbatim text of any messages) of
        your program.

        Describe how you want the output to be different from what you are
        getting.

        If you have no idea at all of how to code up your situation, be sure
        to at least describe the 2 things that you *do* know: input and
        desired output.

    Do not provide too much information
        Do not just post your entire program for debugging. Most especially
        do not post someone *else's* entire program.

    Do not post binaries, HTML, or MIME
        clpmisc is a text only newsgroup. If you have images or binaries
        that explain your question, put them in a publically accessible
        place (like a Web server) and provide a pointer to that location. If
        you include code, cut and paste it directly in the message body.
        Don't attach anything to the message. Don't post vcards or HTML.
        Many people (and even some Usenet servers) will automatically filter
        out such messages. Many people will not be able to easily read your
        post. Plain text is something everyone can read.

  Social faux pas to avoid
    The first two below are symptoms of lots of FAQ asking here in clpmisc.
    It happens so often that folks will assume that it is happening yet
    again. If you have looked but not found, or found but didn't understand
    the docs, say so in your article.

    Asking a Frequently Asked Question
        It should be understood that you may have missed the applicable FAQ
        when you checked, which is not a big deal. But if the Frequently
        Asked Question is worded similar to your question, folks will assume
        that you did not look at all. Don't become indignant at pointers to
        the FAQ, particularly if it solves your problem.

    Asking a question easily answered by a cursory doc search
        If folks think you have not even tried the obvious step of reading
        the docs applicable to your problem, they are likely to become
        annoyed.

        If you are flamed for not checking when you *did* check, then just
        shrug it off (and take the answer that you got).

    Asking for emailed answers
        Emailed answers benefit one person. Posted answers benefit the
        entire community. If folks can take the time to answer your
        question, then you can take the time to go get the answer in the
        same place where you asked the question.

        It is OK to ask for a *copy* of the answer to be emailed, but many
        will ignore such requests anyway. If you munge your address, you
        should never expect (or ask) to get email in response to a Usenet
        post.

        Ask the question here, get the answer here (maybe).

    Beware of saying "doesn't work"
        This is a "red flag" phrase. If you find yourself writing that,
        pause and see if you can't describe what is not working without
        saying "doesn't work". That is, describe how it is not what you
        want.

    Sending a "stealth" Cc copy
        A "stealth Cc" is when you both email and post a reply without
        indicating *in the body* that you are doing so.

  Be extra cautious when you get upset
    Count to ten before composing a followup when you are upset
        This is recommended in all Usenet newsgroups. Here in clpmisc, most
        flaming sub-threads are not about any feature of Perl at all! They
        are most often for what was seen as a breach of netiquette. If you
        have lurked for a bit, then you will know what is expected and won't
        make such posts in the first place.

        But if you get upset, wait a while before writing your followup. I
        recommend waiting at least 30 minutes.

    Count to ten after composing and before posting when you are upset
        After you have written your followup, wait *another* 30 minutes
        before committing yourself by posting it. You cannot take it back
        once it has been said.

AUTHOR
    Tad McClellan and many others on the comp.lang.perl.misc newsgroup.

-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: 02 Jun 2008 20:48:03 GMT
From: Mark Pryor <tlviewer@VISTAyahoo.com>
Subject: Re: Using COM in Perl... Possible?
Message-Id: <48445c83$0$12914$4c368faf@roadrunner.com>

On Wed, 28 May 2008 13:09:35 -0700, rgamble wrote:

> Greetings all,
> 
> I've been tasked where I work to create an HTML interface that
> combines a data export step with a send to an Oracle database step.
> Our non-HTML code is all written in Perl, and the various data export
> functions use a COM model.
> 
> My basic question is, can Perl call COM objects?
> 

Yes it can since about 1997. You will find tons of archive posts about it
here and especially in the www.activestate.com Perl forums.

Another approach to the Oracle layer is to use DBI methods, like from the
driver DBD::Oracle. See
http://www.orafaq.com/faqperl.htm

Using the DBI methods will be portable if the day comes that you stop
using Windows servers and move to *Nix.

-- 
Mark


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

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


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