[25628] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7870 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 9 18:06:00 2005

Date: Wed, 9 Mar 2005 15:05:43 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 9 Mar 2005     Volume: 10 Number: 7870

Today's topics:
    Re: [perl-python] a program to delete duplicate files <tzot@sil-tec.gr>
        Checking for safe paths <please_post@nomail.edu>
    Re: Checking for safe paths <please_post@nomail.edu>
        converting a line of ascii to decimal <xtrimnx@yahoo.com>
    Re: converting a line of ascii to decimal <noreply@gunnar.cc>
    Re: converting a line of ascii to decimal <tzz@lifelogs.com>
        DBI and Microsoft Access nathaniel_welch@hotmail.com
        Documentation for shifting elements of @ARGV <neil@utstat.toronto.edu>
        FCNTL in perl (Roach4)
        file name in perl script? (Nico)
    Re: file name in perl script? danfperl@yahoo.com
    Re: file name in perl script? <tadmc@augustmail.com>
    Re: file name in perl script? <tadmc@augustmail.com>
    Re: file name in perl script? <news@chaos-net.de>
    Re: goto& destroying @_ - Problem finally replicated (Anno Siegel)
    Re: goto& destroying @_ - Problem finally replicated <postmaster@castleamber.com>
    Re: HTML::Parser - duplicated text in <h2> .. </h2> ? <glex_nospam@qwest.invalid>
    Re: HTML::Parser - duplicated text in <h2> .. </h2> ? <geoff.cox@notquitecorrectfreeuk.com>
    Re: HTML::Parser - duplicated text in <h2> .. </h2> ? <geoff.cox@notquitecorrectfreeuk.com>
    Re: HTML::Parser - duplicated text in <h2> .. </h2> ? <glex_nospam@qwest.invalid>
    Re: HTML::Parser - duplicated text in <h2> .. </h2> ? <tadmc@augustmail.com>
    Re: HTML::Parser - duplicated text in <h2> .. </h2> ? <geoff.cox@notquitecorrectfreeuk.com>
    Re: Interpolation question worldcyclist@gmail.com
        Is there a perl array for... <buellboy@gmail.com>
    Re: Is there a perl array for... <spamtrap@dot-app.org>
    Re: Is there a perl array for... (Anno Siegel)
    Re: Is there a perl array for... <mikevh2.1@netzero.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 09 Mar 2005 18:15:39 +0200
From: Christos "TZOTZIOY" Georgiou <tzot@sil-tec.gr>
Subject: Re: [perl-python] a program to delete duplicate files
Message-Id: <388u215m7psrlp4urkm5eg4fku1jno59kf@4ax.com>

On 9 Mar 2005 04:56:13 -0800, rumours say that "Xah Lee" <xah@xahlee.org> might
have written:

>Write a Perl or Python version of the program.
>
>a absolute requirement in this problem is to minimize the number of
>comparison made between files. This is a part of the spec.

http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/de90435f3e56ab0c/048e292ec9adb82d

The whole thread is about finding duplicate files.
-- 
TZOTZIOY, I speak England very best.
"Be strict when sending and tolerant when receiving." (from RFC1958)
I really should keep that in mind when talking with people, actually...


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

Date: Wed, 9 Mar 2005 18:59:20 +0000 (UTC)
From: bill <please_post@nomail.edu>
Subject: Checking for safe paths
Message-Id: <d0nh28$ok$1@reader1.panix.com>




Is there a module that one can use to portably check for the security
of a path?  I know how to, e.g. untaint a Unix pathname, but it
would be nice if there were a module that did this portably.  Also,
I imagine that there may be other ways for a pathname to be not
secure other than what can be detected with a general regexp (e.g.
a well-formed path may include a symbolic link inserted there for
nefarious purposes).

TIA for the cluebricks,

bill


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

Date: Wed, 9 Mar 2005 19:06:27 +0000 (UTC)
From: bill <please_post@nomail.edu>
Subject: Re: Checking for safe paths
Message-Id: <d0nhfj$sj7$1@reader1.panix.com>

In <d0nh28$ok$1@reader1.panix.com> bill <please_post@nomail.edu> writes:




>Is there a module that one can use to portably check for the security
>of a path?  I know how to, e.g. untaint a Unix pathname, but it
>would be nice if there were a module that did this portably.  Also,
>I imagine that there may be other ways for a pathname to be not
>secure other than what can be detected with a general regexp (e.g.
>a well-formed path may include a symbolic link inserted there for
>nefarious purposes).

Almost immediately after sending this in, it occurred to me that
the solution (or at least part of it) would be to translate the
path to a "real path" by first chdir to it and then using getcwd
to determining the real cwd.

bill



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

Date: 9 Mar 2005 11:01:32 -0800
From: "xtrimnx" <xtrimnx@yahoo.com>
Subject: converting a line of ascii to decimal
Message-Id: <1110393299.063139.248120@o13g2000cwo.googlegroups.com>

Okay, so I'm trying to read in the file and take each character one at
at time and convert them to their numeric equivilants. So far this
program just gets me the 1st charachter of each line and changes it.
open OUTPUT,">fileout";
open INPUT, "<filein";
	while(<INPUT>) {
	$val = unpack('c', $_);
	print OUTPUT "$val\n";
	$val2 = pack('U', $val);
	print OUTPUT "$val2\n";
	}
close INPUT;
close OUTPUT;



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

Date: Wed, 09 Mar 2005 20:19:51 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: converting a line of ascii to decimal
Message-Id: <39912rF5saos8U1@individual.net>

xtrimnx wrote:
> Okay, so I'm trying to read in the file and take each character one at
> at time and convert them to their numeric equivilants. So far this
> program just gets me the 1st charachter of each line and changes it.
> open OUTPUT,">fileout";
> open INPUT, "<filein";
> 	while(<INPUT>) {
> 	$val = unpack('c', $_);
> 	print OUTPUT "$val\n";
> 	$val2 = pack('U', $val);
> 	print OUTPUT "$val2\n";
> 	}
> close INPUT;
> close OUTPUT;

     while (<INPUT>) {
         print OUTPUT $_;
         s/(.)/unpack 'c', $1/eg;
         print OUTPUT $_;
     }

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


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

Date: Wed, 09 Mar 2005 14:28:57 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: converting a line of ascii to decimal
Message-Id: <4nr7ioy5xi.fsf@lifelogs.com>

On 9 Mar 2005, xtrimnx@yahoo.com wrote:

> Okay, so I'm trying to read in the file and take each character one at
> at time and convert them to their numeric equivilants. So far this
> program just gets me the 1st charachter of each line and changes it.
> open OUTPUT,">fileout";
> open INPUT, "<filein"; while(<INPUT>) { $val = unpack('c', $_); print OUTPUT
> 	"$val\n"; $val2 = pack('U', $val); print OUTPUT "$val2\n"; }
> close INPUT;
> close OUTPUT;

The reason your way doesn't work is that the pack/unpack logic is
incorrect.  Here's the right solution:

perl -n -e 'chomp; @out = unpack "c*", $_; print "@out\n"'

Basically, you don't need to repack the values (if you do, you'll just
get the original string), and you need an array instead of a scalar.

Here's an alternate solution:

perl -n -e 'chomp; @out = map { ord } split //, $_; print "@out\n"'

Ted


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

Date: 9 Mar 2005 13:45:21 -0800
From: nathaniel_welch@hotmail.com
Subject: DBI and Microsoft Access
Message-Id: <1110404721.224241.72490@z14g2000cwz.googlegroups.com>

I need some help with connecting to a Microsoft Access database using
DBI.  My files are stored on a remote server.  I really don't have any
clue why I can't make this work.  The error I get really has me
confused as well.  I tried the following (where recruit is the DSN
name):

use DBI;
print "Content-type:text/html\n\n";
print "<html><head><title>Test Page</title></head><body>";
print "test1<br><br>";
$dbh = DBI->connect("dbi:ODBC:recruit");
print "test2</body></html>";
exit;

and the error I get is: "CGI Error The specified CGI application
misbehaved by not returning a complete set of HTTP headers.".

I also tried using a DSN less connection, but got the same error.

This exact code works fine in my old environment, but will not work
here.  I checked and the DBI module is installed, so that's not the
problem.

Any help would be GREATLY appreciated!

Thanks,
Nate



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

Date: Wed, 9 Mar 2005 22:27:38 GMT
From: Neil Montgomery <neil@utstat.toronto.edu>
Subject: Documentation for shifting elements of @ARGV
Message-Id: <ID3vpu.GKo@campus-news-reading.utoronto.ca>

I have solved my actual programming problem, but was frustrated in my 
attempt to determine the behaviour of @ARGV in the online docs.

I want to combine data from two files. This combined data will be sorted 
and modified in various ways which aren't of any importance except that 
I need to keep track of which file each datum came from.

I expected the following to do what I needed:

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

my @data;
while (<>) {
     chomp;
#   print "$ARGV, $ARGV[0]\n";  # For debugging
     my $file = ($ARGV eq $ARGV[0]) ? "First" : "Second";
     push @data, [ $file , split(/,/) ];
}

foreach (@data) { print "@$_\n" };
__END__

I tested this program using two suitable files of three lines each 
(appended at the end of this message) and was surprised by the following 
  output:

Use of uninitialized value in string eq at try line 8, <> line 4.
Use of uninitialized value in string eq at try line 8, <> line 5.
Use of uninitialized value in string eq at try line 8, <> line 6.
Second a b c
Second 1 2 3
Second 2 3 4
Second d f t r
Second 2 3 4 5
Second 5 6 8 8

I inserted the (commented out) print statement and concluded that the 
elements of @ARGV are being 'shift'ed, but I wasn't able to find this 
behaviour documented the online docs (perlvar, perlop, perlsyn, perldoc 
-q, probably others). I had no success with Google either.

I fixed the program by saving a copy of @ARGV and using that copy 
instead. Nevertheless I would like help in finding the documentation for 
the way @ARGV is handled in this way.

Regards,
Neil

p.s. Here are the contents of the test files I used:

a,b,c
1,2,3
2,3,4

and

d,f,t,r
2,3,4,5
5,6,8,8







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

Date: 9 Mar 2005 11:43:04 -0800
From: dbelleisle@morphidae.com (Roach4)
Subject: FCNTL in perl
Message-Id: <46200f9b.0503091143.4de56d6a@posting.google.com>

Hi,

I'm new to perl and I've to monitor a DIRECTORY for changes in it
using the FCNTL module in perl.

Anyone could give me a hand by posting examples or hints on how I
could be able to do that?


Thank you very much,

David


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

Date: 9 Mar 2005 11:26:34 -0800
From: noordhoeknd@hotmail.com (Nico)
Subject: file name in perl script?
Message-Id: <4664273a.0503091126.6fe82ac3@posting.google.com>

Hi, I'm a bit of newby.
Someone created some pl files for me.
I have them on my pc in de dir: c:/perl
The script must do some editting
When I start a pl file, a black box appaers, (c:\perl\bin\perl.exe)
The pl-file must start some editting in a file called: editme.txt
Here are the first line of the pl-script

#!c:\perl\bin\perl!
#
# EI2.pl - 1st pass to prepare for conversion dbtext 
# indonesica database to MY format
# Piet J, 2/5/2005
#

$onder = 0 ;
$boven = 100000 ;
--
where to give the name "editme.txt" ?
so the script can make the changes in the txt file..?
Please advice
Nico


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

Date: 9 Mar 2005 12:32:33 -0800
From: danfperl@yahoo.com
Subject: Re: file name in perl script?
Message-Id: <1110400353.484506.27330@z14g2000cwz.googlegroups.com>

Try something like this:

$path = 'c:\editme.txt' ;
open ( EDITME, ">>$path" ) or die "no such file" ;
# Write to it.
close EDITME ;



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

Date: Wed, 9 Mar 2005 15:24:31 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: file name in perl script?
Message-Id: <slrnd2uqcf.d1h.tadmc@magna.augustmail.com>

danfperl@yahoo.com <danfperl@yahoo.com> wrote:


> $path = 'c:\editme.txt' ;


Or,

   $path = 'c:/editme.txt';

You are not required to use silly slashes in paths.


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


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

Date: Wed, 9 Mar 2005 15:25:15 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: file name in perl script?
Message-Id: <slrnd2uqdr.d1h.tadmc@magna.augustmail.com>

Nico <noordhoeknd@hotmail.com> wrote:

> Someone created some pl files for me.


> where to give the name "editme.txt" ?


Ask the Someone who wrote the program.


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


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

Date: Wed, 9 Mar 2005 23:22:25 +0100
From: Martin Kissner <news@chaos-net.de>
Subject: Re: file name in perl script?
Message-Id: <slrnd2utp1.8cv.news@maki.homeunix.net>

Nico wrote :
> Here are the first line of the pl-script
>
> #!c:\perl\bin\perl!
> #
> # EI2.pl - 1st pass to prepare for conversion dbtext 
> # indonesica database to MY format
> # Piet J, 2/5/2005
> #
>
> $onder = 0 ;
> $boven = 100000 ;
> 
> where to give the name "editme.txt" ?
> so the script can make the changes in the txt file..?
> Please advice

This question can not be answerded if only the first few lines of code
are presented.
Best thing would be to ask the author of the script.

It could be, that you are supposed to pass the filename on the command
line like this
	EI2.pl c:/path/editme.txt
But this is only a wild guess and I would not dare to try without a
backup of "editme.txt" if I didn't understand what the script really
does with "editme.txt".

Best regards
Martin

-- 
perl -e '$|=1;&p(7.74.117.115.116.32);&s();&p(97.110.111);&p(116.104.101
 .114);&s;&p(32.112.101.114.108);&s();&p(32.104.97.99.107.101.114.10);sub
 s{sleep 1};sub p(){print "@_"}'


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

Date: 9 Mar 2005 19:22:09 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: goto& destroying @_ - Problem finally replicated
Message-Id: <d0nid1$4gb$1@mamenchi.zrz.TU-Berlin.DE>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote in comp.lang.perl.misc:
> Matthew Braid  <not@invalid.invalid> wrote in comp.lang.perl.misc:
> > Hi all,
> > 
> > I previously posted a problem I was having with using chained goto's 
> > (message ID <d08qqe$172u$1@bunyip2.cc.uq.edu.au>) and getting segfaults. 
> > I'm reposting because I've _finally_ managed to reproduce the segfault.

[...]

> > 	Segmentation fault (core dumped)
> > 
> > Ouch. Oddly enough this is not _quite_ what I was seeing in the full 
> > code (@_ for Ext2 was full of some kind of faulty undef values), but it 
> > has the same effect.
> 
> I can't reproduce this (Perl 5.8.1, Linux 2.0.36).  I get

[never mind what]

I ran your code under Darwin 7.8.0, Perl 5.8.6 with the same result:
it behaves like it should.  Same for Perl 5.8.0.  So it's either a
problem with an ancient Perl (I don't believe this), or something
to do with Perl under FreeBSD, or your individual setup.  You'll
know best how to check the alternatives under your constraints.

On a different note, your "do something, then goto &..." combo is
something that is sometimes done, but more as a last resort, or a
quick fix to something.  I wouldn't make it a design principle, as
you appear to do.

To me it looks like you are approaching a behavior that would be better
realized in an OO environment using a class hierarchy and inheritance.
An extension of method ->action would look like

    sub action {
        my $obj = shift;
        # do something
        $obj->SUPER::action( @_); # instead of goto &...
    }

Your "Core" becomes the ultimate base class, each extension inherits from
the previous one.  The (extended) class you will work with is the last
extension added.  You can set up a class with a fixed name which inherits
from that.  The code that initializes the class chain from @ARGV could
look like this ("Result" being the fixed class name):

    my $prev = 'Core';
    for my $ext ( @ARGV ) {
        no strict 'refs';
        print "Setting '${ext}::ISA' to '$prev'\n";
        @{ "${ext}::ISA"} = ( $prev);
        $prev = $ext;
    }

    package Result;
    print "Setting 'Result::ISA' to '$prev'\n";
    our @ISA = $prev;


You must name all extension you want active on the command line, not
only the highest one (easily fixed).

Anno


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

Date: 9 Mar 2005 22:14:16 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: goto& destroying @_ - Problem finally replicated
Message-Id: <Xns9614A52C822F3castleamber@130.133.1.4>

Anno Siegel wrote:

> On a different note, your "do something, then goto &..." combo is
> something that is sometimes done,

e.g. in AUTOLOAD :-D

[ snip rest of sound advice ]

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: Wed, 09 Mar 2005 10:16:40 -0600
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: HTML::Parser - duplicated text in <h2> .. </h2> ?
Message-Id: <IjFXd.9$3G3.56@news.uswest.net>

Geoff Cox wrote:
> Hello
> 
> I am trying to get back into using HTML::Parser after a year's gap! 
> 
> In one html file I am getting a few instances of 
> 
> <h2>headingheading</h2>
> 
> ie the heading text is repeated.
> 
> Other <h2> headings in this same file are OK.
> 
> Any idea where I should start to look for the solution?!

ahhhh.. Looking at your code would be the place to start??? :-)

Sounds like it might be something to do with the first occurrence of the 
h2 element, but who knows... If using some print's and "perl -d" doesn't 
help you figure it out on your own, post a short sample of your code 
that exhibits the issue.


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

Date: Wed, 09 Mar 2005 19:31:57 GMT
From: Geoff Cox <geoff.cox@notquitecorrectfreeuk.com>
Subject: Re: HTML::Parser - duplicated text in <h2> .. </h2> ?
Message-Id: <miju21hqi500s11j41t4icgtu609vkqcgp@4ax.com>

On Wed, 09 Mar 2005 10:16:40 -0600, "J. Gleixner"
<glex_nospam@qwest.invalid> wrote:

>ahhhh.. Looking at your code would be the place to start??? :-)

!! was hoping not to have to bother you with my wonderful code!

>Sounds like it might be something to do with the first occurrence of the 
>h2 element, but who knows... If using some print's and "perl -d" doesn't 
>help you figure it out on your own, post a short sample of your code 
>that exhibits the issue.

Thanks for the ideas - it just seems odd that 99% of the h2 elements
are handled OK ... so could the problem be in the html file rather
than in the Perl code? ...  but cannot see why ...

Cheers

Geoff



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

Date: Wed, 09 Mar 2005 19:35:44 GMT
From: Geoff Cox <geoff.cox@notquitecorrectfreeuk.com>
Subject: Re: HTML::Parser - duplicated text in <h2> .. </h2> ?
Message-Id: <brju21pt98bskip2hthvbv9b9dhsabv6sb@4ax.com>

On Wed, 09 Mar 2005 10:16:40 -0600, "J. Gleixner"
<glex_nospam@qwest.invalid> wrote:

>ahhhh.. Looking at your code would be the place to start??? :-)

as I say in my other email it seem sodd that 99% of the h2 elements
are handled correctly ..?  The part with the h2 element is as follows
 .. anything wrong there?

Geoff

package MyParser;
use base qw(HTML::Parser);
use strict;
use diagnostics;

my ($in_h2, $in_p, $in_ul, $in_li, $fh);

sub register_fh { $fh = $_[1]; }

sub reset { ($in_h2, $in_p, $in_ul, $in_li )=(0,0)}

sub start {
    my ($p, $t, $a, undef, $txt ) = @_;

    if ($t eq 'p') {
        $in_p = 1;
        print $fh '<p>';
        return;
    }

    if ($t eq 'h2') {
        $in_h2 = 1;
        print $fh '<h2>';
        return;
    }

    if ($t eq 'li') {
        $in_li = 1;
        print $fh '<li>';
        return;
    }

    if ($t eq 'option') {
        main::choice( $a->{ value } );
        return;
    }

}

sub end {
    my ($p, $t, $txt) = @_;

    if ($t eq 'p') {
        $in_p = 0;
        print $fh "</p>\n";
        return;
    }

    if ($t eq 'h2') {
        $in_h2 = 0;
        print $fh "</h2>\n";
        return;
    }

    if ($t eq 'li') {
        $in_li = 0;
        print $fh "</li>\n";
        return;
    }

}

 sub text {
    my ($p, $txt) = @_;
    print $fh $txt if ($in_p);
    print $fh $txt if ($in_h2);
    print $fh $txt if ($in_li);
}

package main;

etc etc





>Sounds like it might be something to do with the first occurrence of the 
>h2 element, but who knows... If using some print's and "perl -d" doesn't 
>help you figure it out on your own, post a short sample of your code 
>that exhibits the issue.



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

Date: Wed, 09 Mar 2005 14:46:43 -0600
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: HTML::Parser - duplicated text in <h2> .. </h2> ?
Message-Id: <UgJXd.48$3G3.402@news.uswest.net>

Geoff Cox wrote:
> On Wed, 09 Mar 2005 10:16:40 -0600, "J. Gleixner"
> <glex_nospam@qwest.invalid> wrote:
> 
> 
>>ahhhh.. Looking at your code would be the place to start??? :-)
> 
> 
> as I say in my other email it seem sodd that 99% of the h2 elements
> are handled correctly ..?  The part with the h2 element is as follows
> .. anything wrong there?

I'm not sure what you're passing to those methods, however simplifying 
those to just "tagname", for &start and &end, and "dtext" for &text it 
shows what you're seeing if an <h2> occurs within a <p> and/or an <li> 
element.

Why?? Because $in_p is 1 and $in_h2 is 1, so $txt is printed twice. The 
text within 'h2', "abcd" will be displayed 3 times if the html contained 
<p><ul><h2>abcd</h2></ul></p>.

This will help you see where/why it's occuring in your code:

sub text {
     my ($txt) = @_;

     print $fh "in_p txt=$txt"  if $in_p;
     print $fh "in_h2 txt=$txt" if $in_h2;
     print $fh "in_li txt=$txt" if $in_li;
}




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

Date: Wed, 9 Mar 2005 15:13:37 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: HTML::Parser - duplicated text in <h2> .. </h2> ?
Message-Id: <slrnd2upo1.d1h.tadmc@magna.augustmail.com>

Geoff Cox <geoff.cox@notquitecorrectfreeuk.com> wrote:


> sub register_fh { $fh = $_[1]; }


Why call it with 2 arguments if it is only going to make use
of the 2nd argument?


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


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

Date: Wed, 09 Mar 2005 22:29:26 GMT
From: Geoff Cox <geoff.cox@notquitecorrectfreeuk.com>
Subject: Re: HTML::Parser - duplicated text in <h2> .. </h2> ?
Message-Id: <rutu21hvs8b7cq1vv27nqqrnio0i87jtt2@4ax.com>

On Wed, 09 Mar 2005 14:46:43 -0600, "J. Gleixner"
<glex_nospam@qwest.invalid> wrote:

>I'm not sure what you're passing to those methods, however simplifying 
>those to just "tagname", for &start and &end, and "dtext" for &text it 
>shows what you're seeing if an <h2> occurs within a <p> and/or an <li> 
>element.
>
>Why?? Because $in_p is 1 and $in_h2 is 1, so $txt is printed twice. The 
>text within 'h2', "abcd" will be displayed 3 times if the html contained 
><p><ul><h2>abcd</h2></ul></p>.

Thanks! 

I checked the HTML and found a <p> associated error which when
corrected allowed the h2 elements to work correctly. 

I had

<p align="center"><img src="assets/image.jpg"</p>

which should have had the ">" in front of the </p>

ie <p align="center"><img src="assets/image.jpg"></p>

Cheers

Geoff









>
>This will help you see where/why it's occuring in your code:
>
>sub text {
>     my ($txt) = @_;
>
>     print $fh "in_p txt=$txt"  if $in_p;
>     print $fh "in_h2 txt=$txt" if $in_h2;
>     print $fh "in_li txt=$txt" if $in_li;
>}
>



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

Date: 9 Mar 2005 12:51:07 -0800
From: worldcyclist@gmail.com
Subject: Re: Interpolation question
Message-Id: <1110401467.769647.130540@o13g2000cwo.googlegroups.com>

This entire thread and the helpfulness therein have proven to me for
the 86,138th consecutive time why the Perl community is the best there
is when you have a problem.

Julian



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

Date: 9 Mar 2005 11:35:11 -0800
From: "advice please wireless 802.11 on RH8" <buellboy@gmail.com>
Subject: Is there a perl array for...
Message-Id: <1110396911.813941.272510@z14g2000cwz.googlegroups.com>

Is there some perl system array @? that has the values for ( $1 $2 $3
 ... ) ? I don't see any in Camel.

BB



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

Date: Wed, 09 Mar 2005 14:41:51 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Is there a perl array for...
Message-Id: <a8idnc71DrsdzLLfRVn-hg@adelphia.com>

advice please wireless 802.11 on RH8 wrote:

> Is there some perl system array @? that has the values for ( $1 $2 $3
> ... ) ? I don't see any in Camel.

None that I know of, but you can easily assign the result of a match to an
array of your own:

    my $string = 'foo:bar';
    my @values = ($string =~ /(\w+):(\w+)/);

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: 9 Mar 2005 20:36:40 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Is there a perl array for...
Message-Id: <d0nmoo$6c1$2@mamenchi.zrz.TU-Berlin.DE>

Sherm Pendley  <spamtrap@dot-app.org> wrote in comp.lang.perl.misc:
> advice please wireless 802.11 on RH8 wrote:
> 
> > Is there some perl system array @? that has the values for ( $1 $2 $3
> > ... ) ? I don't see any in Camel.
> 
> None that I know of, but you can easily assign the result of a match to an
> array of your own:
> 
>     my $string = 'foo:bar';
>     my @values = ($string =~ /(\w+):(\w+)/);

Also, the OP must have overlooked @- and @+.  They don't store the
captures, but their positions.  perldoc perlvar.

Anno


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

Date: 9 Mar 2005 12:58:44 -0800
From: "mike" <mikevh2.1@netzero.com>
Subject: Re: Is there a perl array for...
Message-Id: <1110401924.385786.128480@l41g2000cwc.googlegroups.com>

I think the OP may mean $1 $2 $3 as in command line arguments, rather
than captured matches.  (He refers to a "system array.")  If so, @ARGV
is what you're looking for.  @ARGV has any arguments as entered on the
command line.



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

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


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