[10738] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4337 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 1 20:07:28 1998

Date: Tue, 1 Dec 98 17:00:18 -0800
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, 1 Dec 1998     Volume: 8 Number: 4337

Today's topics:
    Re: Active State and Package Manager not working <mike.l.cooper@not.lmco.com>
    Re: Bad free() with perl, DBI, Informix and blobs <tpot@acsys.anu.edu.au>
    Re: browsing or paging <gellyfish@btinternet.com>
    Re: cgi script with path_info problem, some help needed (brian d foy)
        Changing Directory Problems chada@hotbot.com
    Re: Definition of "odd characters" in -T/-B documentati dshahin@hotmail.com
    Re: executing scripts when html page is loaded <gellyfish@btinternet.com>
    Re: localtime () - perl's  bug ? (I R A Aggie)
        Looking for code snippets <bob@b-tech.net>
    Re: Memory in Perl (Erik)
    Re: Memory in Perl (Ilya Zakharevich)
    Re: Memory in Perl <zenin@bawdycaste.org>
    Re: Memory in Perl (Erik)
    Re: NO DOC NOWHERE!! (Was: emulating sed's "/start/,/st (Brand Hilton)
    Re: Perl "Expert" for Global Remove E-mail List (I R A Aggie)
    Re: Perl "Expert" for Global Remove E-mail List (Martien Verbruggen)
    Re: Perl and Y2K <gellyfish@btinternet.com>
    Re: Q: Installed Modules <gellyfish@btinternet.com>
        sub refs not working <bprater@jipes.com>
    Re: Substitute <r28629@email.sps.mot.com>
    Re: Using PERLDOC (Hawkwynd)
    Re: Using PERLDOC dturley@pobox.com
    Re: Why is "... @foo ..." occasionally a syntax error? (Martien Verbruggen)
    Re: Why is "... @foo ..." occasionally a syntax error? (I R A Aggie)
    Re: Why is "... @foo ..." occasionally a syntax error? <r28629@email.sps.mot.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Tue, 01 Dec 1998 15:02:09 -0800
From: Mike Cooper <mike.l.cooper@not.lmco.com>
To: Bill Moseley <moseley@best.com>
Subject: Re: Active State and Package Manager not working
Message-Id: <36647570.AA3BF89E@not.lmco.com>

I had the same problem with Build 502 patched to 507 on NT. I ended
up deleting the patched 502, downloading the full 507 and re-installing. That,
for a reason unknown to me, fixed the problem.

Bill Moseley wrote:

> I'm running Build 506 of Active State Perl on a Win 95 machine.
>
> When I run the Perl Package Manager, ppm, with any command I receive the
> following:
>
> junk after document element at line 2, column 0, byte 27 at
> D:\PERL\site\lib/XML/Parser.pm line 118
>
> I'm a bit lost on what to look at next.  I've looked at Parser.pm, and don't
> see any problem, though I'm not exactly sure that's what the error message is
> saying.
>
> --
> ( Please CC: by email if not too much trouble )
> --------------
> Bill Moseley
> moseley@best.com

--

Mike Cooper
(remove the "not." from address to reply)




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

Date: 02 Dec 1998 10:37:30 +1100
From: Tim Potter <tpot@acsys.anu.edu.au>
To: smith@avl.com
Subject: Re: Bad free() with perl, DBI, Informix and blobs
Message-Id: <6yyaorbfic.fsf@acronym.anu.edu.au>

"Steven Primrose-Smith" <smith@avl.com> writes:

> After much playing about, I finally managed to get blobs
> in and out of an Informix database using DBI. However,
> there is a problem. I have a function that returns the blob
> as a scalar. Whenever I have a script that calls it, I get
> the following error:
> 
> Bad free() ignored at <program name> line <x>
> 
> where program name is the name of the script calling the
> function and x is the line number. This always occurs
> whenever I try to extract a blob from the database.  The
> error occurs (according to the line number) on the line
> *immediately after* the function call even if the scalar is not
> used within that line. The scalar contains the blob as
> required but this error message is littering my web pages.
> I don't know whether this is a perl, DBI or Informix problem -
> can anyone help?

According to Chapter 9 of the (second) camel book, this message means
"An internal routine called free(3) on something that had never been
malloc(3)ed in the first place" and describes it as "a severe warning
(mandatory).  I've encountered this problem on a Solaris 2.6 machine
when I set variables in %ENV before making a call to system() so I
think it's actually a perl problem.

>From the research I did when I found this problem, it seems to be a
bug on some platforms in perl5.004_04 as well as in perl5.005_02.
I've lost the references for this though, but there was some
discussion in the perl-porters mailing list.

If you're feeling game, try using the following code to suppress the
warning:

	local $SIG{__WARN__} = sub {
	    print(STDERR @_) unless $_[0] =~ m/Bad free/;
	};


Tim.

> 
> Best wishes,
> Steven
> smith@avl.com
> 


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

Date: 1 Dec 1998 22:19:59 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: browsing or paging
Message-Id: <741q2f$140$1@gellyfish.btinternet.com>

On Tue, 1 Dec 1998 07:50:58 GMT Eric Bohlman <ebohlman@netcom.com> wrote:
> jbeck@dolsun.dol.state.nj.us wrote:
> : In shell scripting, i'd use more (or less) if i wanted to read a long file
> : one screen at a time i'm finally making the commitment to learn perl and have
<snip> 
> You could, of course, write your own paging code, but it seems to be 
> something that few people want to do.
> 

I posted a very short (albeit pretty crap) program a short while ago that
did paging ;-}

Search for 'replicating `more`' on DejaNews.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: Tue, 01 Dec 1998 18:54:36 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: cgi script with path_info problem, some help needed
Message-Id: <comdog-ya02408000R0112981854360001@news.panix.com>

In article <3663c144.7354274@news.siol.net>, vili.ga.ga@altavista.net posted:

> But what I would really like to run is:
> http://server/cgisript/whatever
> I get Error 404 saying: no "/cgisript/whatever" directory.
> 
> It should run http://server/cgisript as a script and return /whatever
> as a path_info...

that is a server configuration issue.  see your server docs.  there's
nothing Perl about this.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Tue, 01 Dec 1998 22:50:34 GMT
From: chada@hotbot.com
Subject: Changing Directory Problems
Message-Id: <741rrq$951$1@nnrp1.dejanews.com>

Hi,

[If this message appears twice, it's because it was posted but never showed up
on the news server, so I sent it again.]

I am having trouble with a perl script I wrote. Its purpose is to add up all
of the file sizes in your home directory, and up to two directories inward
from there. I am able to easily add up all of the file sizes in my home
directory, as well as for all of the first level sub-directories, but going
two directories inward does not work. It manages to make it into the first
directory (i.e. /usr/home/directory1/directory2) but it can't get out of it.
The script follows, any help would be greatly appreciated.

--- Begin Script ---

#!/usr/local/bin/perl

#This is the only thing that needs to be changed.
$home = "/usr/home/"; ## Change this to your userid.


## This is a simple while loop to list all of the files.
## Only in the current directory.

chdir($home);
while($filename = <*>) {
$filesize=(-s "$filename") + $filesize;
        }
print "------------------- Disk Usage -------------------\n";
print "Home Directory: $filesize Bytes.\n";

## This handles all of the first level sub-directories.

while($x = <*>) {
        if (-d "$x")   {
                chdir($x);
        while($filenamex = <*>)
{
$filesize=(-s "$filenamex") + $filesize;
$dirsize=(-s "$filenamex") + $dirsize;
}
chdir($home);
print "$x Directory: $dirsize Bytes.\n";
$dirsize = 0;
}
}
$maindirsize = $filesize;

## This code does not work. ## I am trying to make it go two directories
inward and add all of those files.

while($z = <*>) {
        if (-d "$z")   {
                chdir($z);
        while($filenamez = <*>)
{
		if (-d "$filenamez")
						{
				chdir($filenamez);
			while($yz = <*>) {
$filesize=(-s "$yz") + $filesize;
}
}
chdir($z);
}
chdir($home);
}
}
## The closing statements.

print "Current bytes used: $filesize.\n";
$kilobytes = $filesize / 1024;  ## Quick Conversion of byes to kilo.
$megabytes = $kilobytes / 1024; ## Kilobytes to megabytes.
print "Kilobytes: $kilobytes | Megabytes: $megabytes\n";
print "----------------  End Disk Usage -----------------\n";

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 02 Dec 1998 00:13:29 GMT
From: dshahin@hotmail.com
Subject: Re: Definition of "odd characters" in -T/-B documentation.
Message-Id: <7420n7$dcg$1@nnrp1.dejanews.com>





>
> So "funny" is described as a control chracter other then carriage
> return, linefeed, backspace, horizontal tab, formfeed, or escape.
>

this may be a trifle off-topic, but what are the escape characters for
linefeed and carriage return?

\n = LF or CR?

thanks,
d$hahin

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 1 Dec 1998 21:08:48 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: executing scripts when html page is loaded
Message-Id: <741lt0$v7$1@gellyfish.btinternet.com>

On Tue, 01 Dec 1998 17:22:56 GMT jlhughes@pobox.com wrote:
> I have a virtual postcard script that uses perl to create a html document. 
> The link to that document is sent to the recipient of the card, who then can
> view the card by clicking on the link. (The original script is from http://
> bignosebird.com)
> 
> I want to add e-mail notification to the sender when the card is read. 
> Creating the cgi script to notify the sender shouldn't be a problem.  But how
> do I execute the script from the html document?
> 
> I could invite the recipient to press a button to notify the sender that the
> card was read. But I would rather "hide" the notification.
> 
> I do not want to use server-side includes.
> 
> Can Javascript's onLoad function be used to execute the cgi script to send
> e-mail to the card sender? Or is there another way to embed a cgi command in
> an html document without using SSI?
> 

yes it would might be possible to use onLoad to do this but I would'nt 
believe me because this is after all a *Perl* newsgroup - I would ask in
some group that has 'javascript' in its name...

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: Tue, 01 Dec 1998 18:21:15 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: localtime () - perl's  bug ?
Message-Id: <fl_aggie-0112981821150001@aggie.coaps.fsu.edu>

In article <slrn768rpg.ugc.dformosa@godzilla.zeta.org.au>,
dformosa@zeta.org.au (David Formosa) wrote:

+ Yes your function works, however I'm attacking your assumptions.  I
+ don't beleave that the unix epoch is in anyway usefull.

What is a date? what is a year? is it not an arbritrary, man-made
_definition_? As long as one may map unix epoch time into most human
readable times, it is a useful system.

James


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

Date: Wed, 2 Dec 1998 11:19:47 +1100
From: "Bob Reynolds" <bob@b-tech.net>
Subject: Looking for code snippets
Message-Id: <74217m$6le$1@news1-alterdial.uu.net>

People,

I looking to write some perl that connects to a secured web site and
downloads pages and process's them.

Ive heard all about the perl modules that add the HTTP functions, but havent
seen anyone using it yet/ docco for it

Has anyone written any perl using the HTTP functions for ActiveWares' Perl
for NT 5.005_02 (Active state bld 507) ?

Got any good examples?




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

Date: 1 Dec 1998 22:58:21 GMT
From: eln@cyberhighway.net (Erik)
Subject: Re: Memory in Perl
Message-Id: <741sad$e2j$3@news.cyberhighway.net>

In article <741rvn$mh7$1@mathserv.mps.ohio-state.edu>,
	ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
>> Perl will reclaim the memory used by a variable when the last reference to
>> it is either deleted, undef'd, or goes out of scope.
> 
> Wrong.
> 
>> my() declares a variable to be local, hence the memory used will be reclaimed
>> by Perl when the subroutine exits. 
> 
> Wrong.
>> local(), on the other hand, just says
>> that a global variable has a local value.  So, although the actual value
>> assigned to the local variable does not exist outside the scope of
>> the subroutine, the variable itself does exist.
> 
> local() - in the current implementation - actually releases the memory
> associated with the substituted value.
> 
>> An important consideration is to realize there is a difference between
>> a variable and the memory space taken by a variable's value.  This is
>> important when you have references to a variable, because undef'ing
>> the variable in that case will not free up the memory used by the variable's
>> value, because the references still exist and are still pointing to it.
> 
> Wrong.

Care to elaborate?  Telling someone that their assertions are "wrong" without
saying how they're wrong is hardly very constructive.

By the way, I read the group constantly, CC's aren't really necessary.

-- 
Erik Nielsen, Cyberhighway Internet Services NOC
Well, enough clowning around.  Perl is, in intent, a cleaned up and
summarized version of that wonderful semi-natural language known as
"Unix".
             -- Larry Wall in <1994Apr6.184419.3687@netlabs.com>


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

Date: 1 Dec 1998 23:51:54 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Memory in Perl
Message-Id: <741veq$p5g$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Erik
<eln@cyberhighway.net>],
who wrote in article <741sad$e2j$3@news.cyberhighway.net>:
> > Wrong.
> 
> Care to elaborate?  Telling someone that their assertions are "wrong" without
> saying how they're wrong is hardly very constructive.

Look on DejaNews.  This topic comes again and again.

> By the way, I read the group constantly, CC's aren't really necessary.

My config grants

  Mail-copies-to: never 

header.

Ilya


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

Date: 01 Dec 1998 23:56:30 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Memory in Perl
Message-Id: <912556665.988364@thrush.omix.com>

Erik <eln@cyberhighway.net> wrote:
	>sniped and moved around<
: Care to elaborate?

	Sure.

: Telling someone that their assertions are "wrong" without
: saying how they're wrong is hardly very constructive.

	Agreed.

: In article <741rvn$mh7$1@mathserv.mps.ohio-state.edu>,
: 	ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
: >> Perl will reclaim the memory used by a variable when the last reference to
: >> it is either deleted, undef'd, or goes out of scope.
: > 
: > Wrong.

	Example:

	sub foo {
	    my $foo = "stuff";
	    my @bar = qw(foo bar baz);
	}

	Here the memory for $foo and @bar is never reclaimed.  Perl expects
	you're likely to call foo() again and so need that memory again.
	For efficiency it just reuses the memory it used the first time.

: >> my() declares a variable to be local, hence the memory used will be reclaimed
: >> by Perl when the subroutine exits. 
: > 
: > Wrong.

	my() declares a variable *lexical*.  There is a difference.  See
	above about subroutine var GC.  When you start passing references
	around however, is when things get a little funky and GC starts
	doing more work.

	>snip<
: >> An important consideration is to realize there is a difference between
: >> a variable and the memory space taken by a variable's value.  This is
: >> important when you have references to a variable, because undef'ing
: >> the variable in that case will not free up the memory used by the variable's
: >> value, because the references still exist and are still pointing to it.
: > 
: > Wrong.

	You can't have (hard) references to an identifier (variable), only
	its thingy.  You're two layers away, not one.
	Identifier->thingy->ref->thingy.

	You're also thinking too hard, as none of this is really needed to
	program in Perl.  Part of Perl's main job is to mask such petty
	memory semantics.

	Of course, I'm likely wrong on parts of this post as well.  See p5p
	and the perl source if you really want to know the black magic Perl
	is doing on your behalf. :-)

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: 2 Dec 1998 00:54:01 GMT
From: eln@cyberhighway.net (Erik)
Subject: Re: Memory in Perl
Message-Id: <742339$j61$1@news.cyberhighway.net>

In article <912556665.988364@thrush.omix.com>,
	Zenin <zenin@bawdycaste.org> writes:
> 	Example:
[subroutine]
> 	Here the memory for $foo and @bar is never reclaimed.  Perl expects
> 	you're likely to call foo() again and so need that memory again.
> 	For efficiency it just reuses the memory it used the first time.

You're right, I was dead wrong on this one, which sort of propagated out
to the others.

> 	my() declares a variable *lexical*.  There is a difference.  See
> 	above about subroutine var GC.  When you start passing references
> 	around however, is when things get a little funky and GC starts
> 	doing more work.

Right...my terminology tends to get a little screwed up when dealing with
things like that...that's what I meant, not what I said (yes, I know it's
what I should have said).

> 	You can't have (hard) references to an identifier (variable), only
> 	its thingy.  You're two layers away, not one.
> 	Identifier->thingy->ref->thingy.

This is really semantics.  I was trying to avoid using "thingy", and I sort
of stumbled over myself trying to figure out a way to describe a thingy
without actually calling it a thingy.  But you're right, I failed in my
efforts.

> 	You're also thinking too hard, as none of this is really needed to
> 	program in Perl.  Part of Perl's main job is to mask such petty
> 	memory semantics.

I agree, but he asked.  Generally, unless you're doing some really funky
black magic on your own, just trusting that perl's GC will do its job
is plenty.  I seem to have described what it does in some cases, but by no
means all, nor most.  The fact that I fumbled my semantics doesn't
help either.  Oops.  At least I knew what I was trying to say ;)

-- 
Erik Nielsen, Cyberhighway Internet Services NOC
Personally, I like to defiantly split my infinitives.  :-)
             -- Larry Wall in <199708271551.IAA10211@wall.org>


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

Date: 1 Dec 1998 17:16:14 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: NO DOC NOWHERE!! (Was: emulating sed's "/start/,/stop/<do something>"?)
Message-Id: <74188u$je24@mercury.adc.com>

In article <dkcombsF3Ap0H.Mxn@netcom.com>,
David Combs <dkcombs@netcom.com> wrote:
>
>In article <73vnl0$7ca$1@monet.op.net>, Mark-Jason Dominus <mjd@op.net> wrote:
>>In article <5iiv37.432.ln@flash.net>, Tad McClellan <tadmc@flash.net> wrote:
>>>   s/foo/bar/ if /startHere/i .. /stopdoingitHere/i;
>>
>>To emulate sed, you need to use the little-known  `...' operator
>>instead of the more common `..' operator.
>>
>
>
>Nice, but there is NO DOC on this feature!

man perlop

-- 
 _____ 
|///  |   Brand Hilton  bhilton@adc.com
|  ADC|   ADC Telecommunications, ATM Transport Division
|_____|   Richardson, Texas


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

Date: Tue, 01 Dec 1998 18:09:34 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl "Expert" for Global Remove E-mail List
Message-Id: <fl_aggie-0112981809340001@aggie.coaps.fsu.edu>

In article <21t147.vi7.ln@flash.net>, tadmc@flash.net (Tad McClellan) wrote:

+    Be *very* suspicious of those claiming to be "expert" at that rate.

Be *very* suspicious of those claiming to create a "Global Remove List".

James


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

Date: Tue, 01 Dec 1998 23:15:40 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl "Expert" for Global Remove E-mail List
Message-Id: <wM_82.42$Fn3.104@nsw.nnrp.telstra.net>

In article <36646772.27208881@connectnet.com>,
	Jeffery DeMarco <pplnet1@connectnet.com> writes:

> Looking to contract someone at $25.00 per hour

At that rate, an expert will probably need weeks to complete this
incredibly complex project. Besides.. I doubt a little bit that you'll
find an expert here that will help you perfect your spam software.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | 75% of the people make up 3/4 of the
Commercial Dynamics Pty. Ltd.       | population.
NSW, Australia                      | 


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

Date: 1 Dec 1998 21:04:22 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Perl and Y2K
Message-Id: <741lkn$v3$1@gellyfish.btinternet.com>

On Tue, 01 Dec 1998 13:18:02 -0500 John W. Edl Jr. <edl@lucent.com> wrote:
> I was asked if this version of perl is Y2K compliant.  Anyone know for sure?
> ==> perl -v
> 
> This is perl, version 5.003 with EMBED
>         built under solaris at Feb  7 1997 14:23:04
>         + suidperl security patch
> 
> Copyright 1987-1996, Larry Wall
> 
> Perl may be copied only under the terms of either the Artistic License or the
> GNU General Public License, which may be found in the Perl 5.0 source kit.
> 

Please at least *try* to find the answer first before posting - there is
at least one current thread here on this and it must get asked at least once
a week.  A search of DejaNews in this group for 'Y2K' will probably throw up
more than you need and even a cursory glimpse at http://www.perl.com will
give at least one reference.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: 1 Dec 1998 22:00:11 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Q: Installed Modules
Message-Id: <741otb$13o$1@gellyfish.btinternet.com>

On 1 Dec 1998 17:07:40 GMT Roland Holzapfel <holzapfe@igd.fhg.de> wrote:
> Hello,
> 
> How do I find out which Modules (and their versions) are installed
> with my perl executable ?
> 

There has been a very similar post recently - if you search DejaNews on
this group for the subject "How can I find out..." you will find solutions
posted by myself and Dave Cross  - however getting the version is another
matter - I tried require'ing each module in turn and importing $VERSION but
all this results in me running out of memory licketysplit and you cant rely
on $VERSION in all cases unfortunately.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: Tue, 1 Dec 1998 17:37:46 -0600
From: "BenJamin Prater" <bprater@jipes.com>
Subject: sub refs not working
Message-Id: <36647d42.0@news.mediacity.com>

I've been banging my head for the last few hours with a very stubborn
problem.

I'm creating a parser module that takes a text template and parses it by
calling the correct subs. Part of the main program appears like this:

my %handler = (
    'main' => {
        'date' => sub { date_decode(time, $_[1]->{id}) },
        'loop' => \&loop1
    },
    'loop1' => {
        'heading' => sub { $_[3] },
        'loop2' => \&loop2
    },
    'loop2' => {
        'url'    => sub { $data_ref->{ $_[3]->[0] }[ $_[3]->[1] ]{url} },
        'atitle' => sub { $data_ref->{ $_[3]->[0] }[ $_[3]->[1] ]{atitle} },
    }
);

(Info: sub loop1 {} will tell the parser to switch to using 'loop1' tags
from the 'handler' hash, in case you wonder what's going on.)

Once a new object is created with this hash, the module spins through the
buffer and replaces appropriate tags with whatever contents are in the
respective subs:

sub parse {

    my ($self, $in_data, $extra_data) = @_;

    for my $current_tag (keys %{ $self->{TAGS} })

        $in_data =~
s/<($current_tag)\s*([^>]+)?>(?:(.*?)<\/\1>)?/$self->{TAGS}{$1}->($1,
_pairs($self, $2), $3, $extra_data)/isex;
    }

 return $in_data;

}

(Info: $self->{TAGS} will contain the anon. hash that includes the tags it
should parse, for instance on the main loop it will be $self->{TAGS}{main},
and so on.)

If the current "tagset" were in main and it encountered a <date> it will
(and does) replace it will the current target date using another module.

However, and this is the problem, if it encounters the tag <loop1> it should
call the sub 'loop1' as specified in the original hash. It doesn't. And I'm
not sure why. I've ran a dozen tests against this model and can't get it to
budge.

I imagined that => sub { } and => \&sub were the same things when called,
but perhaps I'm mistaken.

Thanks,
Ben




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

Date: Tue, 01 Dec 1998 18:18:37 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: Erik de Castro Lopo <erikd@zip.com.au>
Subject: Re: Substitute
Message-Id: <3664875D.DED235C0@email.sps.mot.com>

[posted to c.l.p.m and copy emailed]

Erik de Castro Lopo wrote:
> 
> Todd R Koning wrote:
> >
> > Can anybody tell me why this script does not work?  I have checked that
> > "tourndata.txt" does exist, and is in the same directory as the script.
> > What am I missing?
> >
> > #!/usr/bin/perl -w
> >
> > open(DATA, ">>tourndata.txt") || die "cannot open tourndata.txt: $!";
> >
> > while (<DATA>) {
> 
> You are trying to read from a file you have open
> for append/write.

DATA is a special filehandler that refers to anything after __END__ or
__DATA__ tokens. You should try to stay away from it.

-TK


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

Date: Tue, 01 Dec 1998 23:15:35 GMT
From: hawkwynd@adelphia.net (Hawkwynd)
Subject: Re: Using PERLDOC
Message-Id: <36647846.72062620@news.fwi.com>

On Tue, 1 Dec 1998 07:37:21 -0500 of the dragon, in
comp.lang.perl.misc, it was read from the pen of "Allan M. Due"
<Allan@due.net> :

>It is my understanding that ActiveState decided not to include the pod files
>with their distribution.  There is a pod subdirectory, but it only includes
>HTML files.  I solved this problem by obtaining a copy of the missing pod
>files and placing them in the pod directory.  It seems really odd to me that
>ActiveState includes perldoc.bat but not the pod files themseleves.

And you got the pod files from.... And the missing pos files are...
And I can find them where....?

Sigh...

-------------------------------------------------
Talk about it at Hawkwynd's keep Discussion Forum
http://hawkwynd.tzo.com/discus/index.html


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

Date: Wed, 02 Dec 1998 00:06:19 GMT
From: dturley@pobox.com
Subject: Re: Using PERLDOC
Message-Id: <74209p$cvm$1@nnrp1.dejanews.com>

In article <3663d826.30963067@nntp.buf.adelphia.net>,
  hawkwynd@adelphia.net (Hawkwynd) wrote:
> At the command line in Windows 98, when I run 	c:\>perldoc -f print
> I get the following error message, or report:
>
> No documentation found for "perlfunc".

I have found that if a module is installed using PPM, the pod gets turned into
HTML in the html directory.

If you install the module using dmake, then perldoc modulename works as
expected. Maybe now that Sarathy works for ActiveState, they'll stick closer
to core perl with things like this.

--
David Turley
dturley@pobox.com
http://www.binary.net/dturley/

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 01 Dec 1998 23:13:13 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Why is "... @foo ..." occasionally a syntax error?
Message-Id: <dK_82.41$Fn3.104@nsw.nnrp.telstra.net>

In article <3664717F.636DB91@eddie.mit.edu>,
	John Chambers <jc@eddie.mit.edu> writes:

> Hmmm ... I wonder how one goes about declaring an array in perl.

Since perl is a freeform language, the inital use of a variable is
also its declaration. Of course, there are things like my() and
local() to more formally declare a variable.

The following fails:

> perl
"@resource"
In string, @resource now must be written as \@resource at - line 1, 
	near "@resource"

All the following succeed without any other code:

@resource = ();
"@resource";

$resource[0] = '';
"@resource";

my @resource;
"@resource";

local @resource;
"@resource";

push @resource, 'a';
"@resource";

And even:

pop @resource;
"@resource\n";

@a = @resource;
"@resource";

@resource;
"@resource";

(These last three just to illustrate that you don't actually have to
manipulate the variable, you just need to use it, outside of a string
interpolation)

Of course, you will have to make sure the variable is declared within
the scope of the block you are actually in (or in an enclosing block)

There is a section about declaration in the perlsyn documentation,
which also talks about scope a lot.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Inside every anarchy lurks an old boy
Commercial Dynamics Pty. Ltd.       | network - Mitchell Kapor
NSW, Australia                      | 


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

Date: Tue, 01 Dec 1998 18:15:42 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Why is "... @foo ..." occasionally a syntax error?
Message-Id: <fl_aggie-0112981815420001@aggie.coaps.fsu.edu>

In article <36645C96.430B1AA3@eddie.mit.edu>, jc@eddie.mit.edu wrote:

+ This was a fatal syntax error.  Here's the offending line:
 
+         $extra = "@resource" if ($typ eq 'lab');

Why is @resource double quoted? That is the root of your problem,
perl does not know if $extra should be the literal string @resource,
or the actual value of assigning a list to a scalar.

Either of these elminates the syntax error. Maybe one of them does what
you want...

$extra = @resource if ($typ eq 'lab');
$extra = scalar @resource if ($typ eq 'lab');

James


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

Date: Tue, 01 Dec 1998 18:09:52 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: John Chambers <jc@eddie.mit.edu>
Subject: Re: Why is "... @foo ..." occasionally a syntax error?
Message-Id: <36648550.C7586854@email.sps.mot.com>

[posted to c.l.p.m and copy emailed]

John Chambers wrote:
> 
> Martien Verbruggen wrote:
> >
> > In article <36645C96.430B1AA3@eddie.mit.edu>,
> >         John Chambers <jc@eddie.mit.edu> writes:

[...]

> 
> Hmmm ... I wonder how one goes about declaring an array in perl.
> I don't seem to recall every running across the syntax of an array
> declaration.  I've always created them at run-time by statements:
>    @foo = ();
> or whatever.  This is certainly not a declaration; it's an executable
> assignment statement.  Digging around in TFM, I do find a few uses
> of the term "declaration", but I don't seem to find a definition of
> it.  Where is it hidden?  Is it some sort of metaphor for something
> that isn't really a declaration?
> 
> Note that I get the error while perl is reading in the code (via
> a require command); it is a fatal *syntax* error, and the process
> evaporates without returning from the require.  So the program hasn't
> assigned anything to @resource yet, because it hasn't gotten past
> the initial requires.  Does this mean that there has to be some
> sort of use of @resource before the require?  I've never done that
> with any arrays before, in quite a lot of years of programming in
> perl.  I've almost always put the requires (or uses) at the very
> beginning, and it seems to (usually) work.  If some sort of declaration
> is needed for @foo to work inside "", then the zillions of uses of
> this construct in my code should all bomb, and most of them work just
> fine.  I do this inside verbose messages all over the place.
> 
> Just what is the rule here?  (And what's a "declaration"? I thought
> that one of the great things about perl is that it didn't have or
> need them. ;-)


Perl is trying to be nice to tell you that your code 'may' break if
he/she/it(?) allows you to proceed, hence the syntax error. 

It seems to me that the solution to you problem is quite simple - just
'declare' @resource like you always do. You may want to look at 'use
strict' and my(), though it isn't always necessary, I believe you will,
some days, appreciate their helpfulness.

Why not just try to see if it helps. And if it doesn't, you are welcome
to discuss on the topic of "declaration" later.

HTH.

-TK


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 4337
**************************************

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