Friday, February 7, 2014

Expanding the Use of Perl Plugins

The <plugin> tag allows you create Perl classes that provide specific functionality for your pages.  But what about using CPAN modules as plugins?  Most CPAN modules that have a new() constructor can be used as plugins.  One of my favorite CPAN modules is Text::CSV_XS so it was disappointing to find I had some issues with this one.


Bedrock has had a limitation on using some CPAN modules because of the way Bedrock coerces lists into Bedrock array objects when invoking method calls on objects...until now.

Wednesday, January 1, 2014

Bedrock, jQuery and HTTP Status Codes

Using Bedrock to create AJAX components is trivial.  Name your Bedrock file with a .jroc extension and return your result.

<var --json $result>

Can it get any easier?  I just created a wiki page that shows how Bedrock handles exceptions for application/json files you serve up using Bedrock.   I also describe how you can customize the HTTP status code that Bedrock returns to the browser.

Monday, December 30, 2013

Chromebook - Acer C720 A Month Later

After a month of using my Acer C720 I can say that I am one darn happy customer. Apparently I'm not alone.

Friday, December 27, 2013

Coffeshop Productivity

Saw this article on FastCompany...could not argree more.  Working at a coffee shop can be a very productive experience.  After you read the article, I have a few tips of my own.

Thursday, December 19, 2013

"Sinking" output

Bedrock is a templating language which means pretty much everything in your page is being output to the browser. Bedrock statements that are parsed and produce output, do so at the point where the tag has been placed. Makes sense...after all that's what a templating engine is supposed to do.

 Hi this is <var $name> from <var $company_name>.

So when you have a page that includes statements like:

<sqlselect "select * from customer where name like ?" --bind=$input.q>
  <li><var $first_name> <var $last_name></li>
</ul> the middle of your page, you might be surprised to see a lot of white space in the output.

That's because, while Bedrock interprets the tags and does not output anything as a result of non-output tags other than <var>, the Bedrock statements are on lines that include a new line and Bedrock dutifully outputs anything in your page that is not a tag.

One way to avoid this, is to avoid placing these tags on their own line.  Another way of eating white space is to use the sink tag.  Take this group of statements:

<null:foo $>
<if $foo --eq "bar">
  <null:baz "buz">

Bedrock will interpret these tags, but your output will contain 4 new lines.  Using the <sink> tag you can eat all of that white space.

<sink><null:foo $>
<if $foo --eq "bar">
  <null:baz "buz">

The <sink> tag can scoop up the contents of the output in a variable as well.

<sink:hello_world>Hello World!</sink>

<sink> has one other magical property. It can also output the contents of the block to a handle.

<sink $fh>Hello World!</sink>

You can even nest <sink> tags.

<sink:foo>bar<sink>this is a comment</sink></sink>

Check out this link for more detail about the sink tag.

Monday, December 16, 2013

Chromebook - Acer C720 Day 20

Still loving my Chromebook!  No change on my VPN woes yet, but I'm fairly confident my network ninja at corporate will figure it out.  In the mean time I continue to read the Google Chromebook forums trying to learn about it and what potential issues people have.  I was able to help someone who thought they had a Chromebook issue, but it was more than likely a problem with their Comcast router.!category-topic/chromebook-central/chromebook/KrJeHbucaMg

Most of the problems I see that people have are because they do not understand what a Chromebook is.  There have been some reported hardware issues, but I suspect that those are few and far between and easy to spot and correct (send it back to Amazon if you we smart enough to order it from there!)

As mentioned in the forum link above my Linksys router DNS caching bug was vanquished by using Google's nameservers which is an option in the Chromebook's network setup.

Monday, December 9, 2013

OpenBedrock Moving to GitHub

Now that I've gotten the OpenBedrock project back in full swing, it's time to leave the stone age of CVS and enter the modern world by migrating to a more appropriate VCS.  I've debated the relative merits for this move, but in the end, in order to create a more community driven project, moving the project to GitHub and using git as my VCS makes a lot of sense.

While the world probably doesn't need another web application framework, and no one but I may ever contribute to it, I've always viewed Bedrock with a bit of fondness.   It was created in 1999 as a collaborative effort between myself and one other developer who initiated the concepts, to fill the gap that existed for a decent templating package.

Jay Sridhar's first effort, a C based package lacked the flexibility to rapidly change with the ideas we were generating, so Perl was adopted early in the project to make development easier and faster.  I think there was some thought of using Perl only as a prototyping platform, but soon production applications were being built in Bedrock.