perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ed Grimm <edgr...@dsblade00.wat.us.ray.com>
Subject RE: Passing A Hash Ref From One .epl To Another
Date Thu, 17 Jul 2003 19:41:46 GMT
There should be no significant difference between an array reference and
a hash reference.  Namespace doesn't apply to references, only
variables, so passing a hash reference inside an array reference should
work just fine.  However, since that appears to not be the case...

I've found that using adding the option 'package => __PACKAGE__' to the
Execute arguments works well in certain circumstances.  Note that this
will duplicate the compiled code for each page that calls the subpage.
However, if that code is relatively small, the hit isn't that bad.  It's
also very livable if the subpage is only used by a couple pages, one of
which is rarely called.

I feel that this is kludgy, but it works.  Note that this effectively
brings the subpage completely into the namespace of the calling page,
and so you do need to make certain you don't step on variables used
outside of the subpage in the subpage code.

Ed Grimm

On Thu, 17 Jul 2003, Cameron B. Prince wrote:

> Hi again,
>
> After further reading of the docs, I see that params can only contain a
> single value, a list, or an array reference.
>
> Can the list or array reference contain my hash ref? I'm thinking not as the
> .epl will be within it's own space... So even if I could, the reference
> would point to a non-existent hash.
>
> Is there another way to do this?
>
> Is there a way to include a file in a page without executing it, so that
> it's parsed as if it's part of the same page?
>
> Thanks,
> Cameron
>
>> -----Original Message-----
>> From: Cameron B. Prince [mailto:cprince@rideware.com]
>> Sent: Thursday, July 17, 2003 11:48 AM
>> To: embperl@perl.apache.org
>> Subject: Passing A Hash Ref From One .epl To Another
>>
>>
>> Hi,
>>
>> In one of my pages I have a block at the top that calls a custom
>> package I've created. This package returns a reference to a hash of
>> hashes. This page has two output blocks. Each loops over one of the
>> embedded hashes. This is working fine.
>>
>> Now, I need to create another page that will only use one of these
>> output blocks. Rather than having the same code in two pages, I would
>> like to break out this block into it's own .epl file and just Execute
>> it from the two pages. The deal is, I don't want to call the package
>> from both the page and the .epl file.
>>
>> Is there anyway to pass a reference to one of the embedded hashes to
>> the .epl file as it's called from one of the two pages?
>>
>> I've been trying some like this from the docs:
>>
>> Execute ({inputfile => $filename, param => $href }) ;
>>
>> But when I do, I get: [Wed May 21 22:51:38 2003] [notice] child pid
>> 2166 exit signal Segmentation fault (11)
>>
>> Is what I'm trying to do possible?
>>
>> Thanks,
>> Cameron
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
>> For additional commands, e-mail: embperl-help@perl.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message