Josh Narins | 7 Jun 14:29

Re: repeat through hash

> On Thursday 20 April 2006 17:29, Jonathan Vanasco wrote:
> > On Apr 20, 2006, at 7:24 PM, Corey wrote:
> > > Anyone in favor? Any pitholes or details I'm missing?
> > 
> > Well there's this:
> > 	in Perl, Python and PHP (the TAL implementations I use ),  hashes  
> > ( perl hashes, python dicts , php named arrays ) are unordered.  
> > randomly showing items from a list, IMHO, is worthless and confusing.
> > 
> 
> True.  And I agree that, from a presentation standpoint, randomly displaying
> items from an unordered list is not always useful or sensical - however there
> are certainly plenty of instances/use-cases where an ordered presentation 
> is not in fact necessary, or where there truly is no criteria from which to sort 
> by anyways. ( I'm currently writing an app in which this is the case. )

1.a

I've always wanted petal to be perl'ier, and less TAL'ish.

<select name="perly">
 <option petal:repeat="a [sort [{BLOCK}] keys myHash]"
 petal:attributes="value="a" petal:content="myHash/a" />
</select>

1.b

Of course, to see just how far I'd like it to go, I'd like to see it
more like:

(Continue reading)

Jonathan Vanasco | 7 Jun 17:09

Re: repeat through hash


On Jun 7, 2006, at 8:29 AM, Josh Narins wrote:
> 1.a
>
> I've always wanted petal to be perl'ier, and less TAL'ish.
>
> <select name="perly">
>  <option petal:repeat="a [sort [{BLOCK}] keys myHash]"
>  petal:attributes="value="a" petal:content="myHash/a" />
> </select>

i'd suggest using another rendering engine then.  one of the biggest  
benefits / reasons for using TAL is that its a standard cross  
platform thing.

and you can just use functions to do what you want

tal:
<select name="perly">
  <option petal:repeat="a getHashrefSortedOnKeyValue 'myHash'"
  petal:attributes="value="a" petal:content="myHash/a" />
</select>

i think the code is something like:
	my %Personalized= (
		blah=> $var,
		getFunction=> \&function,
		getHashrefSortedOnKeyValue=> \&Path::To::function,
	);
	print $template->render( \%Personalized );
(Continue reading)

Bruno Postle | 16 Jun 16:31

Petal-2.19 released

http://search.cpan.org/dist/Petal-2.19/

This release collects together some minor bugfixes, options and documentation.

  2.19 Fri Jun 16 15:22:00 2006
      - alias false: modifier as not: to match TALES spec (Jonathan Vanasco)
      - fix repeat/odd documentation bug and add to cookbook (Jonathan Vanasco)
      - pod typos (sarabob)
      - CACHE_ONLY option (Jonathan Vanasco)
      - Add Digest::MD5 dependency (aaron)
      - Allow passing arguments to coderefs
      - Encoding support for gettext mo/po files (Andrew Rodland)

--

-- 
Bruno

Chris Croome | 21 Jun 10:48
Picon
Favicon

Re: Instead of /tmp directory?

Hi

On Wed 17-Aug-2005 at 12:26:10AM +0100, Bruno Postle wrote:
> On Fri 12-Aug-2005 at 09:38 -0400, Josh Narins wrote:
> > 
> > I was hoping you could tell me what option I could change so that
> > the petal_cache and petal_debug files didn't end up in /tmp. I'd
> > like to change them to /tmp/petal, if that helps (doubtful, but one
> > never knows).
> 
> Petal uses File::Spec->tmpdir() for this, so you can change the
> directory for the cached templates by setting $ENV{TMPDIR}.

This *used* to work for me, but it doesn't seem to any more, on Fedora
Core 5 if I add this to the apache conf file:

  # Petal cache files
  PerlSetEnv TMPDIR "/var/tmp/"
  SetEnv TMPDIR "/var/tmp/"

The cache files are still written to /tmp

I can confirm that the TMPDIR env is set by creating a .shtml file with
this in it:

  <pre>
    <!--#printenv -->
  </pre>

And when the .shtml file is accessed it has this value:
(Continue reading)

Corey | 23 Jun 22:21
Favicon

best practices question(s)


Yo!

Say I have a fairly involved cgi app, called "foobar", and
an apache document root such as the following:

/var/www/localhost/:
cgi-bin/  error/  htdocs/  icons/

/var/www/localhost/cgi-bin/foobar/:
FooBar/ FooBar.pm foobar.pl

My questions are:

Where "best" to put the pe(tal) templates -- under the
cgi-bin or under the htdocs? i.e:

* /var/www/localhost/cgi-bin/foobar/
OR
* /var/www/localhost/htdocs/foobar/

I guess because pe(tal) _is_ x/html, it really falls in a
tough spot as to where best to logicaly organize it. Perhaps
this is very much a purely subjective matter; so I'm just then
looking for other peoples' opinions and practices, to help 
sway me one way or the other.

Also, how about images that the templates use? In my
mind images don't belong anywhere under the cgi-bin -
where do you guys put your image files?
(Continue reading)

Bruno Postle | 27 Jun 12:27
X-Face

Re: best practices question(s)

On Fri 23-Jun-2006 at 13:21 -0700, Corey wrote:
>
> Where "best" to put the pe(tal) templates -- under the
> cgi-bin or under the htdocs? i.e:
>
> * /var/www/localhost/cgi-bin/foobar/
> OR
> * /var/www/localhost/htdocs/foobar/

Neither, as there is no need for remote users to access the files 
directly.  Though I can't think of a specific security issue with 
doing this, I wouldn't describe it as good practice.

> where do you guys put your image files?

Static images need to be accessible to remote users, so these go in 
htdocs.

> As a final question - do you put your petal "view"/"controler"/"helper"
> modules ( i.e. my "FooBar.pm" ) in along with the cgi scripts
> themselves under cgi-bin, or do you put those somewhere else 
> on the system?

It depends how you intend to maintain them.  Something we try to do 
is create them as standalone perl modules and install them the same 
as any CPAN module.

--

-- 
Bruno

(Continue reading)

Jonathan Vanasco | 27 Jun 23:49

Re: best practices question(s)


> On Fri 23-Jun-2006 at 13:21 -0700, Corey wrote:
>>
>> Where "best" to put the pe(tal) templates -- under the
>> cgi-bin or under the htdocs? i.e:
>>
>> * /var/www/localhost/cgi-bin/foobar/
>> OR
>> * /var/www/localhost/htdocs/foobar/

i'd stay away from that model completely

i have things as such ( as an svn tree in /usr/local/www/sites/APPNAME )

	/lib/
	/lib-external/
	/www/
		/3ld.2ld.1ld/

lib are perlmodules for my app 'cgi-bin'
lib-external are support modules
www is the root for htdocs

apache2 is configured to server out of www ,  which has domain  
specific files
urls are mapped onto mod-perl for handling specific urls out of the  
lib directory

cgi-bin stuff is so web1999

(Continue reading)

Corey | 30 Jun 20:33
Favicon

petal:define question


I'm totally stumped here, and can use some expert knowledge from
the list.

Simplified explanation/example:

I have a method called echo, looks like this:

sub echo {
   my $self  = shift;
   my $value = shift;

   return $value;
}

I stuff my object into $vcc, which gets passed to my 
template. Template looks like this:

<span petal:define="foobar string:GOOBER" />
<p petal:content="foobar" />
<p petal:content="vcc/echo foobar" />

<p>---</p>

<span petal:define="foobar string:BLAH" />
<p petal:content="foobar" />
<p petal:content="vcc/echo foobar" />

As I hope can be seen, I expect the following:

(Continue reading)

Corey | 30 Jun 20:57
Favicon

Re: petal:define question


Ok, well of course 20 minutes after sending out my question, I found the
answer to my own question. I need to 'fresh' it:

span petal:define="foobar string:GOOBER" />
<p petal:content="foobar" />
<p petal:content="fresh vcc/echo foobar" />

<p>---</p>

<span petal:define="foobar string:BLAH" />
<p petal:content="foobar" />
<p petal:content="fresh vcc/echo foobar" />

...works like charm.

I somehow missed that even after reading the Petal perldoc
many times. ugh.

Sorry for the noise.

Cheers,

Corey

On Friday 30 June 2006 11:33, Corey wrote:
> 
> I'm totally stumped here, and can use some expert knowledge from
> the list.
> 
(Continue reading)

Corey | 30 Jun 21:13
Favicon

test


My posts seem to take a long time to hit the list.

Testing.

sent: friday 30, 12:13


Gmane