<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Phillip Smith</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/phillip_smith/" />
    <link rel="self" type="application/atom+xml" href="http://blogs.perl.org/users/phillip_smith/atom.xml" />
    <id>tag:blogs.perl.org,2009-11-03:/users/phillip_smith//70</id>
    <updated>2012-03-08T17:34:19Z</updated>
    <subtitle>A blog about the Perl programming language</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Pro 4.38</generator>

<entry>
    <title>Installing DBD::mysql on Mac OS X 10.7 &quot;Lion&quot;</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/phillip_smith/2012/03/installing-dbdmysql-on-mac-os-x-107-lion.html" />
    <id>tag:blogs.perl.org,2012:/users/phillip_smith//70.2916</id>

    <published>2012-03-08T17:30:42Z</published>
    <updated>2012-03-08T17:34:19Z</updated>

    <summary>I&#8217;ve run into this problem every time I&#8217;ve set-up a new computer recently, so &#8212; in the interest of remembering where to look for the solution next time &#8212; here&#8217;s a quick &#8220;note to future self&#8221; post on installing MySQL...</summary>
    <author>
        <name>Phillip Smith</name>
        <uri>http://phillipadsmith.com</uri>
    </author>
    
    <category term="dbdmysql" label="dbd-mysql" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="mysql" label="mysql" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/phillip_smith/">
        <![CDATA[<p>I&#8217;ve run into this problem every time I&#8217;ve set-up a new computer recently, so &#8212; in the interest of remembering where to look for the solution next time &#8212; here&#8217;s a quick &#8220;note to future self&#8221; post on installing <a href="http://www.mysql.com/">MySQL</a> and <a href="https://metacpan.org/module/DBD::mysql">DBD::mysql</a> on Mac OS X 10.7 &#8220;Lion.&#8221;</p>

<p>First, the binary installers for MySQL and PostgreSQL for OS X have gotten so good that I don&#8217;t bother compiling either from source anymore. In fact, the new PostgreSQL installer comes with a nifty &#8220;Application Stack Builder&#8221; tool that does 1-click post-installation installation of helpful PostgreSQL add-ons like <a href="http://www.postgis.org/">PostGIS</a> (previously, one of my least favourite things to install). The same goes for the MySQL binary installer: installing MySQL, a preference pane for starting/stopping the server, and a startup item to ensure that it&#8217;s always running after a reboot is all included.</p>

<p>Okay, so that&#8217;s great, but what about when I actually want to connect to MySQL from something like Perl? Well, to get started, I need to install the MySQL driver, <a href="https://metacpan.org/module/DBD::mysql">DBD::mysql</a>. Unfortunately, <a href="http://search.cpan.org/~miyagawa/App-cpanminus-1.5007/bin/cpanm">cpanm</a> bails with this log message:</p>

<script src="https://gist.github.com/2002033.js?file=gistfile1.txt"></script>

<p>There are a few helpful posts out there on the Internets, but none of the suggestions resolved the issue for me.</p>

<p>In there end, there were two steps that were necessary to get things working:</p>

<ul>
<li><p>Symlinking &#8216;libmysqlclient.XX.dylib&#8217; from &#8216;/usr/local/mysql/lib&#8217; to &#8216;/usr/lib/&#8217; (where XX is the version of the library that is available to link to).</p></li>
<li><p>Passing arguments to the Makefile to ensure that the tests run using a proper MySQL user (the Makefile defaults to the system user running the tests, if no other user is provided, which fails for me as that user doesn&#8217;t exist).</p></li>
</ul>

<p>There you go. That worked for me. Maybe it&#8217;ll work for you too. Enjoy.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>#Catalyst on @dot_cloud: Adding a #PostgreSQL data service. (#Perl in the cloud, Part IIII)</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/phillip_smith/2011/08/catalyst-on-dotcloud-adding-a-postgresql-data-service-perl-in-the-cloud-part-iiii.html" />
    <id>tag:blogs.perl.org,2011:/users/phillip_smith//70.2097</id>

    <published>2011-08-16T04:15:56Z</published>
    <updated>2011-08-16T20:06:31Z</updated>

    <summary> code { background: #fcf9ce; padding 2em; } Following up on my previous post that demonstrated how to get a basic Catalyst application up-and-running on dotCloud in under ten minutes, let&#8217;s explore how to take things a step further by...</summary>
    <author>
        <name>Phillip Smith</name>
        <uri>http://phillipadsmith.com</uri>
    </author>
    
    <category term="catalyst" label="catalyst" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="cloud" label="cloud" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="dotcloud" label="dotcloud" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="postgresql" label="postgresql" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/phillip_smith/">
        <![CDATA[<p><style>
code { background: #fcf9ce; padding 2em; }
</style></p>

<p>Following up on <a href="http://blogs.perl.org/users/phillip_smith/2011/08/dotcloud-loves-catalyst-apps-up-and-running-in-10-minutes-perl-in-the-cloud-part-iii.html">my previous post</a> that demonstrated how to get a basic <a href="http://www.catalystframework.org/">Catalyst</a> application up-and-running on <a href="https://www.dotcloud.com/">dotCloud</a> in under ten minutes, let&#8217;s explore how to take things a step further by adding a database service.</p>

<p>For convenience sake, I&#8217;m just going to walk you through the <a href="http://search.cpan.org/~bobtfish/Catalyst-Manual-5.8008/lib/Catalyst/Manual/Tutorial.pod">Catalyst::Manual::Tutorial</a>.</p>

<p>However, unlike the tutorial (or most Catalyst tutorials for that matter), we&#8217;re going to use PostgreSQL instead of SQLite &#8212; and we&#8217;re going to deploy the app into the cloud vs. just developing locally (thanks to the magic of dotCloud, which makes it so easy).</p>

<p>Luckily, it looks like the <a href="http://search.cpan.org/~bobtfish/Catalyst-Manual-5.8008/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod">Catalyst::Manual::Tutorial Chapter 3</a> has been updated with a <a href="http://search.cpan.org/~hkclark/Catalyst-Manual-5.8004/lib/Catalyst/Manual/Tutorial/10_Appendices.pod#PostgreSQL">PostgreSQL-specific appendix</a>, which makes things a lot easier (and means that I can spare you from my terrible SQLite-to-PosgreSQL conversion skills).</p>

<p>Here we go:</p>

<ul>
<li><p>Following along with the tutorial, we go ahead and add <a href="http://search.cpan.org/dist/Catalyst-Plugin-StackTrace/">Catalyst::Plugin::StackTrace</a> to the base application module and the Makefile.PL, which ensures it will get auto-installed and built by dotCloud when we push our app. Here&#8217;s the <a href="https://github.com/phillipadsmith/Catalyst-Default/commit/5477539014741388d630202c887df2c132ec06bd">commit</a> on Github.</p></li>
<li><p>Next, we use the <a href="http://search.cpan.org/~flora/Catalyst-Devel-1.33/lib/Catalyst/Helper.pm">Catalyst::Helper</a> script to create a controller for &#8216;books&#8217; (and a simple test), and update the controller per the tutorial. <a href="https://github.com/phillipadsmith/Catalyst-Default/commit/7528af68e7711aa54247c6838d51acecc71482fc">Commit</a></p></li>
<li><p>Then, using the Catalyst::Helper script again, we create a simple view called HTML that will use Template Toolkit as its rendering engine. Finally, we set the component path to let the application know where to find the templates. <a href="https://github.com/phillipadsmith/Catalyst-Default/commit/33a252704b965c93847905ba4922ea1f5e91cf6a">Commit</a></p></li>
<li><p>Last but not least, we create the TT2 template to accompany the /books/list action. <a href="https://github.com/phillipadsmith/Catalyst-Default/commit/268cac856cdaa1995a15f4f83da3abe2f91d40ab">Commit</a></p></li>
</ul>

<p>Now we diverge a little bit and head over to the <a href="(http://search.cpan.org/~hkclark/Catalyst-Manual-5.8004/lib/Catalyst/Manual/Tutorial/10_Appendices.pod#PostgreSQL">PostgreSQL appendix</a> and create our application&#8217;s database for managing books. This assumes that you&#8217;re familiar with <a href="http://www.postgresql.org/">PostgreSQL</a>, have installed the PostgreSQL server and client and the Perl <a href="http://search.cpan.org/~turnstep/DBD-Pg-2.18.1/Pg.pm">DBD::Pg</a> module.</p>

<ul>
<li><p>So, working locally for now, let&#8217;s create a user for this application and then a database <a href="http://search.cpan.org/~hkclark/Catalyst-Manual-5.8004/lib/Catalyst/Manual/Tutorial/10_Appendices.pod#PostgreSQL">per the instructions</a>.</p></li>
<li><p>The data file provided by the appendix had a couple of typos, so I fixed this up <a href="https://github.com/phillipadsmith/Catalyst-Default/commit/1ae6c212aa98f61652e4e862c37a8e336e56c885">here</a>. Use that data file and load up your PostgreSQL database and check that everything loaded properly.</p></li>
<li><p>Next create the some <a href="http://search.cpan.org/~rkitover/Catalyst-Model-DBIC-Schema-0.54/lib/Catalyst/Model/DBIC/Schema.pm#DESCRIPTION">DBIC schema models</a> with the assistance of <a href="http://search.cpan.org/~rkitover/Catalyst-Model-DBIC-Schema-0.54/lib/Catalyst/Helper/Model/DBIC/Schema.pm">Catalyst::Helper::Model::DBIC::Schema</a></p></li>
</ul>

<script src="https://gist.github.com/1147843.js?file=gistfile1.txt"></script>

<p>This creates the application&#8217;s database model files automatically from the database tables and relationships; see this <a href="https://github.com/phillipadsmith/Catalyst-Default/commit/b782e1e886de198568d8363d2f3ada5af23be148">commit</a>.</p>

<ul>
<li>Now, with the models auto-generated and some data in the database, we need to enable our model in our &#8216;books&#8217; controller. <a href="https://github.com/phillipadsmith/Catalyst-Default/commit/f4c74e153e218a93138a033a541da98ecff6c3dc">Commit</a></li>
</ul>

<p>At this point, you can check out your application locally to ensure that everything is running. In fact, this is a good point to mention a Catalyst development trick: If you run the development server with <code>script/appname_server.pl -r</code> option, the server reloads when you update an application file. Thus, if there&#8217;s an error, you can see it right away. I usually leave this window with the server output visible next to my editing window. Good for caching typos right away.</p>

<ul>
<li><p>Okay, so finishing up, we configure the HTML view to use a &#8216;wrapper&#8217; (think header, footer, etc.) for our action-specific views, and we add a CSS file, etc. <a href="https://github.com/phillipadsmith/Catalyst-Default/commit/5e316ee3c0487d563a90f4d20c266052d65c3774">Commit</a></p></li>
<li><p>Even though we&#8217;re not going to use them yet, to stay consistent with the tutorial, we update generated DBIx::Class result class files for many-to-many relationships. <a href="https://github.com/phillipadsmith/Catalyst-Default/commit/f811188dcae9dbed6e294f6a3ef2ecc742092512">Commit</a></p></li>
<li><p>Update the books/list view template to include authors. <a href="https://github.com/phillipadsmith/Catalyst-Default/commit/d74ee12db26123c2834f7563f13271dc192ef914">Commit</a></p></li>
</ul>

<p>Great. That was all pretty straightforward, so let&#8217;s deploy this on dotCloud:</p>

<ul>
<li>Add the additional requirement DBIx::Class to the make file. (In fact, I forgot a few requirements along the way &#8212; typical! &#8212; so let&#8217;s also add: Catalyst::Model::DBIC::Schema, DBD::Pg, Catalyst::View::TT, and MooseX::NonMoose. Curiously, I thought that MooseX::NonMoose should have been built as a dependency of Catalyst::Model::DBIC::Schema, but wasn&#8217;t &#8230; so I had to add it manually to the Makefile.)</li>
</ul>

<p>Okay, now for the fun part, let&#8217;s add a PostgreSQL data service to our dotCloud instance by adding a couple lines to the dotcloud.yml file (<a href="https://github.com/phillipadsmith/Catalyst-Default/commit/1259dd84bd0784b9ca1fa623a6695add7eeba615">Commit</a>) as described in their <a href="http://docs.dotcloud.com/services/postgresql/">documentation on PostgreSQL</a>. Pretty simple, eh?</p>

<p>Now, let&#8217;s deploy these new files to dotCloud (<em>note that our Catalyst application and the new data service are not connected yet</em>) with <code>dotcloud push catalyst .</code> and watch dotCloud do it&#8217;s incredible magic of installing all of the CPAN modules that your Catalyst app needs. It <em>really</em> is magic.</p>

<p>If all goes well, you should see:</p>

<blockquote>
  <p>Deployment finished. Your application is available at the following URLs
www: http://9f385357.dotcloud.com/</p>
</blockquote>

<p>Run <code>dotcloud info catalyst.data</code> and you should see something like:</p>

<script src="https://gist.github.com/1147948.js?file=gistfile1.txt"></script>

<p>Now, you just need to connect up your new data service with your app (well, almost, we&#8217;ll still need to create the remote database and load it with data). To do that, you can either put the database connection info directly into your lib/MyApp/Name/Model/DB.pm file, or read it from the dotCloud environment.json file.</p>

<p>However, at this point, if you put your dotCloud database connection info into your app your local development version is going to complain loudly and will stop being useful as a way to see what you&#8217;re doing before you push the app to the cloud. So, this becomes a good opportunity to get our local environment set-up to be as similar as possible as our cloud environment.</p>

<p>On dotCloud, the database connection information is automatically put into a handy <code>environment.json</code> file at the root of our dotCloud environment (/home/dotcloud/). So, to make things easy, let&#8217;s also create a <code>environment.json</code> file at the root of our application directory. So, my application root now looks like this:</p>

<script src="https://gist.github.com/1148393.js?file=gistfile1.txt"></script>

<p>And I set my local version of <code>environment.json</code> to match the variable names that dotCloud provides, but with my local connection information, like so:</p>

<script src="https://gist.github.com/1148397.js?file=gistfile1.json"></script>

<p>Okay, we&#8217;re in the home stretch now! So, to finish things off:</p>

<ul>
<li><p>To read these environment.json files, we can just add the handy <a href="http://search.cpan.org/dist/JSON/">JSON</a> and <a href="http://search.cpan.org/dist/IO-All/">IO:All</a> modules to the Makefile. <a href="https://github.com/phillipadsmith/Catalyst-Default/commit/102dd7874102eec6c26327686b5b7390c62deebf">Commit</a></p></li>
<li><p>Now we can update our <a href="https://github.com/phillipadsmith/Catalyst-Default/blob/master/lib/Catalyst/Default/Model/DB.pm">Model::DB file</a> to read the environment.json on dotCloud if it exists, or to fall back to our local version if not.</p></li>
<li><p>We&#8217;re all set now to actually create the <em>database</em> (earlier, we simply created the data <em>service</em>). We&#8217;ll do that by running <code>dotcloud run catalyst.data -- createdb default-catalyst</code>. <strong>Note that this is using version 0.4 of the dotCloud command-line client &#8212; future versions might change this format.</strong> The <code>.data</code> targets the command to run for the data <em>service</em> that we set-up (vs. the www service running the app). If that all worked, you should see: <code># createdb default-catalyst</code></p></li>
<li><p>Last but not least, we load the data from our local development environment to the cloud database. There are probably other (possibly better!) ways to do this, but I found this approach straightforward: <code>su - postgres</code> and then <code>./bin/pg_dump default-catalyst | ./bin/psql -h XXXXXX.dotcloud.com -p XXXXX -U root default-catalyst</code>. Obviously, replace the Xs with the sub-domain and port of your data service.</p></li>
</ul>

<p>With all of that done &#8212; phew! &#8212; we can run one last <code>dotcloud push catalyst .</code> to push the latest changes to into the cloud, install any remaining dependencies, and restart nginx. If all went well, you should see:</p>

<ul>
<li><p>The Catalyst welcome screen here: <a href="http://9f385357.dotcloud.com">http://9f385357.dotcloud.com</a></p></li>
<li><p>The database-connected book list here: <a href="http://9f385357.dotcloud.com/books/list">http://9f385357.dotcloud.com/books/list</a></p></li>
</ul>

<p>Hopefully your PostgreSQL-backed app is now running in the cloud. Hurray!</p>

<p>If you find an error in this post, or have improvement suggestions, please let me know in the comments.</p>

<p><em>P.S. If your app is not running, the one thing to check that tripped me us is how dotCloud integrates with <a href="http://git-scm.com/">git</a>. They key take-away is: be sure to commit your changes to git, or dotCloud won&#8217;t pick them up! Personally, I found this a bit confusing, and &#8212; in the future &#8212; I&#8217;ll probably use the <code>dotcloud ssh catalyst.www</code> command to do my dotCloud-specific debugging <strong>on</strong> dotCloud and then manually bring those changes back into the local version and <strong>then</strong> commit the changes. Without doing that, I ended up with a lot of unecessary commits in the repository as I futzed about with a connection issue.</em></p>
]]>
        

    </content>
</entry>

<entry>
    <title>@dotCloud loves Catalyst apps: Up-and-running in 10-minutes (#Perl in the cloud, Part III)</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/phillip_smith/2011/08/dotcloud-loves-catalyst-apps-up-and-running-in-10-minutes-perl-in-the-cloud-part-iii.html" />
    <id>tag:blogs.perl.org,2011:/users/phillip_smith//70.2067</id>

    <published>2011-08-08T19:45:09Z</published>
    <updated>2011-08-08T20:16:34Z</updated>

    <summary> code { background: #fcf9ce; padding 2em; } Lots is happening in the Perl Web framework world these days. The three main frameworks are getting better at a faster-and-faster rate, great screencasts are starting to appear, and &#8212; finally &#8212;...</summary>
    <author>
        <name>Phillip Smith</name>
        <uri>http://phillipadsmith.com</uri>
    </author>
    
    <category term="catalyst" label="catalyst" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="dotcloud" label="dotcloud" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/phillip_smith/">
        <![CDATA[<p><style>
code { background: #fcf9ce; padding 2em; }
</style></p>

<p>Lots is happening in the Perl Web framework world these days. The <a href="http://mojolicio.us/">three</a> <a href="http://www.catalystframework.org/">main</a> <a href="http://perldancer.org/">frameworks</a> are getting better at a faster-and-faster rate, <a href="http://mojocasts.com/">great screencasts are starting to appear</a>, and &#8212; finally &#8212; Perl is moving into the cloud, thanks to support from new Platform-as-a-Service vendors like <a href="http://dotcloud.com">dotCloud</a>.</p>

<p>Now, I&#8217;ve been known to kvetch a bit about &#8220;Perl in the cloud&#8221; <a href="http://www.phillipadsmith.com/2011/03/ten-million-dollars-to-dotcloud-but-still-no-perl-support.html">once</a> or <a href="http://www.phillipadsmith.com/2011/05/from-perl-slacker-to-perl-hacker-perl-in-the-cloud-part-ii.html">twice</a> before. But this is not a kvetch. No, no, my friend: this is a &#8220;Forget the ode, show me the code&#8221; post.</p>

<p>I cracked open an old project this weekend with the intention of getting back to work on it. I thought I&#8217;d give dotCloud another try, as I wanted a quick way to have this application interact with OAuth providers (hard to do on my local machine). But I quickly noticed that many of the existing Perl Web framework on dotCloud posts &#8212; of which <a href="http://blog.kraih.com/mojolicious-in-the-cloud-hello-dotcloud">there</a> <a href="http://blogs.perl.org/users/marco_fontani/2011/04/dancing-on-a-cloud-made-of-pearls.html">are</a> <a href="http://onionstand.blogspot.com/2011/04/catalyst-in-cloud.html">several</a> &#8212; were a bit out of date, and didn&#8217;t reference dotCloud&#8217;s new command-line tool or way of deploying services. (Though, I should note, that they&#8217;re excellent posts and I steal from them liberally here.)</p>

<p>Anyway, after a bit of poking around, I had my app deployed on dotCloud and wanted to share the newer process for getting a bare-bones <a href="http://www.catalystframework.org/">Catalyst application</a> up-and-running in the cloud in 10-minutes:</p>

<ul>
<li><p>I&#8217;m going to start by assuming that you have Catalyst running properly on your local development computer. If you&#8217;re not at that stage yet, you should probably read the <a href="http://search.cpan.org/perldoc?Catalyst::Manual">Catalyst::Manual</a> or grab a copy of the rather excellent <a href="http://www.amazon.co.uk/Definitive-Guide-Catalyst-Maintainable-Applications/dp/1430223650?&amp;camp=2486&amp;linkCode=wey&amp;tag=enligperlorga-21&amp;creative=8882">The Definitive Guide to Catalyst</a>.</p></li>
<li><p>Once you&#8217;ve got that sorted, run <code>catalyst.pl App::Name</code> to create the scaffolding for your application. I used <code>Catalyst::Default</code> for this example application, and I&#8217;ll use that app name throughout. Catalyst will create the scaffolding in a directory called <code>App-Name</code> &#8212; so, in my case, that&#8217;s <code>Catalyst-Default</code>.</p></li>
<li><p>Change your working directory to the app that you&#8217;ve just created, in my case that&#8217;s <code>cd Catalyst-Defualt</code>. Let&#8217;s call this your app&#8217;s root directory for convenience to this walk through.</p></li>
<li><p>Next, you&#8217;ll want to link your <code>root/static</code> directory from the app&#8217;s root directory, because that&#8217;s where dotCloud will look for static files. You can do this with a simple <code>ln -s root/static static</code>.</p></li>
<li><p>Then you&#8217;ll want to set-up support for <a href="http://plackperl.org/">PSGI</a>. To do that, you can simply:</p></li>
</ul>

<script src="https://gist.github.com/1132562.js?file=gistfile1.pl"></script>

<ul>
<li>Now edit the &#8216;app.psgi&#8217; file and add the line <code>use lib 'lib'</code> after the <code>use warnings</code> line. Here&#8217;s mine:</li>
</ul>

<script src="https://gist.github.com/1132491.js?file=app.psgi"></script>

<ul>
<li><p>At this point, if you&#8217;re aiming to deploy a real application, you should update your Makefile.PL with the modules, plugins, and so on that are required by the application. By doing this, dotCloud is able to install all the required Perl modules from CPAN automatically. This is the most impressive part of dotCloud to me &#8212;  it&#8217;s simply amazing to watch how it handles complex dependency chains without breaking a sweat.</p></li>
<li><p>If you&#8217;re just going to deploy the default Catalyst application that is built by the scaffolding to follow along, you&#8217;ll want to add <code>requires 'Catalyst::Engine::PSGI';</code> to your Makefile.PL. Add that after the other lines that start with <code>requires</code>.</p></li>
<li><p>Now you&#8217;re ready to run your Makefile.PL (<code>perl Makefile.PL</code>). Without this step, dotCloud won&#8217;t be able to parse your Makefile.PL and you&#8217;ll be stuck updating the dotcloud.yml with your dependencies. Not the end of the world, but create unnecessary redundancy.</p></li>
<li><p>Now we&#8217;re ready to let dotCloud know about our application. First, you&#8217;ll need to <a href="http://docs.dotcloud.com/firststeps/install/">download and install the dotCloud command-line client</a>.</p></li>
<li><p>Use the <code>dotcloud create appname</code>  command to create your app. In my case, I just used <code>dotcloud create catalyst</code>. (dotCloud doens&#8217;t seem to like names with any special characters, so you&#8217;ll need to choose something like &#8216;catalystdefault&#8217; or &#8216;catalystappname&#8217;.)</p></li>
<li><p>You&#8217;ll need a dotcloud.yml file to tell dotCloud about the service your app requires &#8212; e.g., Perl, Python, Ruby, etc. &#8212; so fire up your favourite editor and open up dotcloud.yml and add these lines:</p></li>
</ul>

<script src="https://gist.github.com/1132566.js?file=dotcloud.yml"></script>

<ul>
<li>Save that file in the root directory of your app. At this point, your app&#8217;s root directory should look like so:</li>
</ul>

<script src="https://gist.github.com/1132569.js?file=gistfile1.txt"></script>

<ul>
<li>Now you&#8217;re ready to deploy your application into the dotCloud cloud. Drum roll please&#8230;. So, to do that, simply run <code>dotcloud push appname .</code>.</li>
</ul>

<p>At this point, you&#8217;ll want to go grab a coffee or beer or something because, if you&#8217;ve done everything right, the dotCloud build system will review your Mekefile.PL for dependencies and start installing Catalyst in your cloud instance so that your app can run properly. If that&#8217;s happening, you should see something like:</p>

<script src="https://gist.github.com/1132570.js?file=gistfile1.txt"></script>

<p>At the end of the process, you should see this line:</p>

<script src="https://gist.github.com/1132572.js?file=gistfile1.txt"></script>

<p>Visit the URL that dotCloud provided in your browser and, if you&#8217;re lucky, you should <a href="http://9f385357.dotcloud.com/">see this</a>.</p>

<p>If you get a 404 or some other page, there was a problem along the way. To troubleshoot, just run <code> dotcloud logs catalyst.www</code> (replacing &#8216;catalyst&#8217; with the name you gave your app on dotCloud) &#8212; the &#8216;www&#8217; indicates the name of the service you created in your dotcloud.yml. (We&#8217;ll dig a bit more into the different services in the next post.)</p>

<p>Let me know in the comments if you have any questions, if anything above is unclear (or could be clearer), or if you run into any problems. I&#8217;m not a dotCloud expert by any means, but I am starting to get my head around it.</p>

<p>Next up: Setting up a PostgreSQL data service.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>From Perl slacker, to Perl hacker: Perl in the cloud, Part II</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/phillip_smith/2011/05/from-perl-slacker-to-perl-hacker-perl-in-the-cloud-part-ii.html" />
    <id>tag:blogs.perl.org,2011:/users/phillip_smith//70.1736</id>

    <published>2011-05-06T13:28:58Z</published>
    <updated>2011-05-06T13:40:12Z</updated>

    <summary> Perl hacker Phillip Smith taunted us about the lack of Perl support; but more than our investor&#8217;s money, the real keys to the Perl stack have been the very insightful feedback and ideas of another major contributor to the...</summary>
    <author>
        <name>Phillip Smith</name>
        <uri>http://phillipadsmith.com</uri>
    </author>
    
    <category term="activestate" label="activestate" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="cloud" label="cloud" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="dotcloud" label="dotcloud" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/phillip_smith/">
        <![CDATA[<blockquote>
  <p><em>Perl hacker Phillip Smith taunted us about the lack of Perl support; but more than our investor&#8217;s money, the real keys to the Perl stack have been the very insightful feedback and ideas of another major contributor to the Perl community: Tatsuhiko Miyagawa.</em></p>
</blockquote>

<p>Sometime last week, while I was basking in the glory of my thirty-eight birthday, I got the best birthday present ever. &#8220;A beta account on dotCloud to try out their new Perl support,&#8221; you ask? <em>Nope</em>. The real gift was getting called a &#8216;Perl hacker&#8217; in the same sentence as Tatsuhiko Miyagawa.</p>

<p>Seriously, though, a lot happened in the last week, and I was too busy slacking off to catch it until now.</p>

<p>For starters, dotCloud <a href="http://blog.dotcloud.com/dotcloud-introduces-camel-as-a-service-with-i">announced support for Perl</a> (also on <a href="http://news.ycombinator.com/item?id=2491725">HackerNews</a>) on their <a href="http://en.wikipedia.org/wiki/Platform_as_a_service">PaaS</a> platform (thanks, Miyagawa! And, <a href="http://bulknews.typepad.com/blog/2011/04/joining-dotcloud.html">congrats</a> on the new gig!). This is great news, and the Perl community has been quick to kick the tires; real Perl hackers have already tested several Web application frameworks on dotCloud:</p>

<ul>
<li><a href="http://blog.kraih.com/mojolicious-in-the-cloud-hello-dotcloud">Mojolicious in the cloud: Hello DotCloud!</a></li>
<li><a href="http://onionstand.blogspot.com/2011/04/catalyst-in-cloud.html">Catalyst in the Cloud</a></li>
<li><a href="http://blogs.perl.org/users/marco_fontani/2011/04/dancing-on-a-cloud-made-of-pearls.html">Dancing on a cloud made of pearls</a></li>
</ul>

<p><a href="https://twitter.com/#!/solomonstre">Solomon Hykes</a>, a dotCloud developer, noticed the same thing and <a href="http://news.ycombinator.com/item?id=2518526">mentioned it on HackerNews</a>.</p>

<p>It gets better, however.</p>

<p>Yesterday, Active State <a href="http://www.theregister.co.uk/2011/05/06/activestate_cloud_foundry/">announced their own foray into the clould</a>, with the <a href="http://www.activestate.com/cloud">developer preview of Stackato</a> for Perl and Python. The Active State cloud is reportely built on top of <a href="http://www.cloudfoundry.com/">Cloud Foundry</a>, a VMware initiative that calls itself &#8220;world&#8217;s first <em>open</em> Platform as a Service (PaaS) offering.&#8221; (Emphasis mine.)</p>

<p>Meanwhile, the mystery Perl PaaS provider <a href="http://www.phenona.com/">Phenona</a> continues to push forward and <a href="https://twitter.com/#!/phenona/status/64554955796774912">tweets</a> that they are starting to pick up the pace on getting beta invites out.</p>

<p>So, from zero-to-hero, Perl now has at least three PaaS providers to choose from. It&#8217;s a great day, and it is really quite amazing <a href="http://blogs.perl.org/users/phillip_smith/2011/03/ten-million-dollars-to-dotcloud-but-still-no-perl-support.html">how much can happen in a few, short, weeks</a>.</p>

<p>I guess I should get on with writing my next cranky post: this time about <a href="http://codemirror.net/">Perl support in CodeMirror</a>.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Writing Perl Modules for CPAN </title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/phillip_smith/2011/03/writing-perl-modules-for-cpan.html" />
    <id>tag:blogs.perl.org,2011:/users/phillip_smith//70.1598</id>

    <published>2011-03-29T12:10:00Z</published>
    <updated>2011-03-29T19:57:52Z</updated>

    <summary> This past weekend I dusted off my copy of Sam Tregar&apos;s Writing Perl Modules for CPAN. The book was published in 2002 and that gave me some trepidation about re-reading it almost nine years later. However, I not yet...</summary>
    <author>
        <name>Phillip Smith</name>
        <uri>http://phillipadsmith.com</uri>
    </author>
    
    <category term="apress" label="apress" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="cpan" label="cpan" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="modules" label="modules" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/phillip_smith/">
        <![CDATA[<img alt="9781590590188.gif" src="http://blogs.perl.org/users/phillip_smith/9781590590188.gif" width="125" height="155" class="mt-image-right" style="float: right; margin: 0 0 20px 20px;" />
<p>This past weekend I dusted off my copy of Sam Tregar's <em><a href="http://www.apress.com/book/view/9781590590188">Writing Perl Modules for CPAN</a></em>. The book was published in 2002 and that gave me some trepidation about re-reading it almost nine years later. However, I not yet written a CPAN module and I wanted to give it a shot -- so this seemed like a logical place to start. Thankfully, any reservations were misplaced: this book should be on the shelf of any person wanting to expand their Perl repertoire. </p>

<p>Here's a quick summary of what really stood out for me this time:</p>

<ul>
<li><p>Chapter 2, incorrectly titled "Perl Module Basics," should be a must-read for anyone new to Perl. It answers all the burning questions about Perl modules. Specifically, why modules are an improvement over one-off scripts almost 99% of the time, the difference between compile-time and runtime in the life of a Perl program, the concept of Packages, Symbols, Encapsulation, Object-Oriented vs. Functional style modules, Classes, Accessors and Mutators, Inheritance, Overloading, and much more. I've rarely read a programming book chapter so full of valuable information and so clearly written.</p></li>
<li><p>Chapter 3 covers "Module Design and Implementation" and does it quickly and thoroughly. It starts with an explanation of Plain Old Documentation in the context of a documentation-first approach to module design, and then quickly jumps into design decisions like functions vs. objects, naming, and parameters and return values. With that information delivered to the reader, it jumps another level deep and provides a thorough exploration of inheritance vs. composition and the challenges of dealing with multiple-inheritance, and then wraps up with a quick overview of how to visually map out a module's design with UML.</p></li>
<li><p>Chapter 5 delves into "Submitting Your Module to CPAN," and is a good read for the process-related concerns of getting a module submitted. It touches on how to get feedback from the Perl community and the nitty-gritty details of the PAUSE upload process. Of course, being from 2002, it could use a quick refresh and a section on newer tools like <a href="http://dzil.org/">Dist::Zilla</a>.</p></li>
<li><p>Last but not least, Chapter 7 -- "Great CPAN Modules" -- is a worthy read. Sections on <a href="search.cpan.org/perldoc?DBI">DBI</a>, <a href="search.cpan.org/perldoc?Storable">Storable</a>, and <a href="http://search.cpan.org/perldoc?LWP">LWP</a> are particularly noteworthy, while others like CGI.pm could be updated with newer examples, and -- generally -- there are a number of great CPAN modules that could be unpacked here for the reader's benefit, e.g.: modules that take advantage of <a href="http://search.cpan.org/perldoc?Moose">Moose</a>, and perhaps one of the event-loop modules. </p></li>
</ul>

<p>Obviously, that's just four chapters out of eleven that hit the mark. But, nonetheless, I would still recommend the book as a great resource just for those chapters alone. However, the rest of the book is not without value -- just a bit outdated for the era of "<a href="http://www.onyxneon.com/books/modern_perl/index.html">Modern</a>" and "<a href="http://www.effectiveperlprogramming.com/">Effective</a>" Perl. Specifically: </p>

<ul>
<li>I'm guessing that most folks would agree that h2xs is a bit outdated, and that people should probably just jump right into reading about <a href="http://search.cpan.org/perldoc?Module::Starter">module-starter</a> or Dist::Zilla instead. </li>
<li>The chapter on module maintenance and  community could be updated to include mention of blogging, Twitter, and, most importantly, Github, as ways to build community, find contributors, and manage patches.</li>
<li>The last three chapters are all devoted to various ways to write CPAN modules in C, either using XS or Inline::C, which didn't feel as contemporary or timeless as other chapters. (That said, I've never wanted to write a Perl module in C, so maybe it's just a topic that doesn't interest me.)</li>
<li>Writing Web applications in Perl is relegated to the last chapter, but seems to be a pressing concern "with the kids" these days. It could easily be presented earlier and be updated to include sections on <a href="http://search.cpan.org/perldoc?Catalyst">Catalyst</a>, <a href="http://perldancer.org">Dancer</a>, <a href="http://mojolicio.us/">Mojolicious</a>, and <a href="http://plackperl.org/">Plack</a>. </li>
</ul>

<p>In summary, my sense is that Apress could fairly easily update this book for 2011, and that doing so would make a great resource for years to come. I must admit, I enjoyed Sam Tregar's clear, simple writing enough to almost forgive him for leaving the <a href="http://bricolagecms.org">Bricolage</a> project to work on <a href="http://krangcms.com">Krang</a> (inside joke). </p>

<p>So, what's on your Perl back catalog reading list these days? </p>]]>
        
    </content>
</entry>

<entry>
    <title>Ten million dollars to DotCloud, but still no Perl support </title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/phillip_smith/2011/03/ten-million-dollars-to-dotcloud-but-still-no-perl-support.html" />
    <id>tag:blogs.perl.org,2011:/users/phillip_smith//70.1582</id>

    <published>2011-03-23T10:00:00Z</published>
    <updated>2011-03-24T16:40:02Z</updated>

    <summary>Let&apos;s face it: The promise of &quot;PaaS&quot; (Platform as a Service) -- easily deploying your application to a whole stack living up there in the cloud -- is pretty cool shit. Back in January (ages ago in Internet time), I...</summary>
    <author>
        <name>Phillip Smith</name>
        <uri>http://phillipadsmith.com</uri>
    </author>
    
    <category term="cloud" label="cloud" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="dotcloud" label="dotcloud" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="paas" label="paas" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="saas" label="saas" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/phillip_smith/">
        <![CDATA[<p>Let's face it: The promise of "PaaS" (<a href="http://en.wikipedia.org/wiki/Platform_as_a_service">Platform as a Service</a>) -- easily deploying your application to a whole stack living up there in the cloud -- is pretty cool shit. Back in January (ages ago in Internet time), I kicked the tires of <a href="http://www.dotcloud.com/">DotCloud</a> and, after a whole three minutes, announced to the world "<a href="https://twitter.com/#!/phillipadsmith/status/32577897180954625">this is just too easy</a>." No wonder they <a href="http://gigaom.com/cloud/dotcloud-gets-10m-to-redefine-cloud-openness/">just raised a cool ten million</a>.</p>

<p>Yet, still, there is <em>not one</em> PaaS solution for Perl today. </p>

<p></p><ul><li><a href="http://aws.amazon.com/elasticbeanstalk/">Amazon Elastic Beanstock</a>? Nope. Just Java.&nbsp;</li><li><a href="">Google App Engine</a>? Nope. Just Java or Python.&nbsp;</li><li>Red Hat's <a href="http://www.makara.com/tour/">Makara</a>? Nope, no Perl.&nbsp;</li><li><a href="http://www.dotcloud.com/">DotCloud</a>? Everything&nbsp;but Perl.</li></ul><p></p>

<p>So, what gives? </p>

<p>Well, when I asked the DotCloud folks back in January, they indicated that Perl support <em>is</em> on their road map, but that they didn't have a sense of what the most common use cases for deployment are in the Perl community, for example CGI, FastCGI, etc. </p>

<p>When I pointed the helpful gent who responded to my inquiry toward <a href="http://plackperl.org/">Plack</a> (Perl's answer to Ruby's Rack, or Python's WSGI), he seemed to think that it could facilitate "a swift integration into our web stacks." Phew! One issue down. </p>

<p>The next question was about "worker scripts." Specifically, how the DotCloud system could take a "dependency file" (like a Gemfile for Ruby, or pip-style requirements.txt for Python) and "some code" (an installation script) that could be run to automatically install module dependencies and start-up a daemon or service. I must admit some confusion about this question -- I kept asking myself, is this not what a Makefile and things like <a href="search.cpan.org/perldoc?Module::ScanDeps">Module::ScanDeps</a> are for? Isn't this exactly what projects like <a href="http://search.cpan.org/perldoc?cpanm">cpanm</a> are meant to do, i.e., ease the installation of Perl modules? This must be a solvable (if not solved) problem.</p>

<p>My guess is that I'm not not understanding the requirement clearly, and I'm hoping that the wisdom of the Perl community can weigh in with some suggestions and recommendations for me, our friends at dotCloud, and, well, anyone else that might be thinking about Perl in the cloud.</p>

<p>Needless to say, as PaaS start-ups get bought up faster than umbrellas on a rainy day in downtown Manhattan, my attention keeps turning back toward projects like <a href="http://www.slideshare.net/osfameron/oyster">Oyster</a>, the North West England Perl Mongers initiative to create a Heroku specifically for Perl Web apps. Not only is a project like Oyster attractive for the practical benefits to (the rather large number of) Perl developers, but also as something that has&nbsp;potentially to not get&nbsp;instantly bought-up by <a href="http://www.zdnet.com/blog/btl/salesforce-buy-heroku-for-212-million-eyes-ruby-developers/42495">Salesforce</a>, <a href="http://www.serverwatch.com/news/article.php/3915006/Red-Hat-Acquires-Makara-in-Cloud-Dev-Tools-Play.htm">Redhat</a>, or <a href="https://www.cloudkick.com/blog/2010/dec/16/acquisition/">Rackspace</a>.</p>

<p>In fact, given how hot PaaS is, I can't help but wonder why some enterprising Perler hasn't gotten an offering off the ground yet? Or, perhaps more in the Perl spirit, why some group or individual hasn't offered to run it pseudo-voluntarily for the Perl community, like <a href="http://www.cpan.org/">CPAN</a>, <a href="http://pause.perl.org/pause/query?ACTION=pause_04about">PAUSE</a>, or the <a href="http://use.perl.org/~Ranguard/journal/">Perl.org</a> site itself. (<i>Better idea: run it as a paid service and contribute the surplus to the The Perl Foundation, or <a href="http://www.enlightenedperl.org/">Enlightened Perl Organizatio</a></i><a href="http://www.enlightenedperl.org/">n.</a>)</p>

<p>Here's to hoping that $10,000,000.00 can push Perl into DotCloud's PaaS cloud offering, or that some whip-smart folks here in the Perl community can finally 'git push' Perl into the clouds. (And, while we're pushing, let's push for a Perl port of the excellent, open-source, <a href="http://incubator.apache.org/libcloud/index.html">libcloud</a> project.)</p>

<p>UPDATE: A <a href="http://blogs.perl.org/users/phillip_smith/2011/03/ten-million-dollars-to-dotcloud-but-still-no-perl-support.html#comment-20444">comment</a> points out that <a href="http://www.phenona.com/">Phenona</a> might be attacking this challenge. Will look forward to hearing from folks who've tried it.</p><p>UPDATE 2:&nbsp;Jérôme from DotCloud says "<a href="http://blogs.perl.org/users/phillip_smith/2011/03/ten-million-dollars-to-dotcloud-but-still-no-perl-support.html#comment-20459">It's still pretty hard to give out a straight ETA, but Perl will be soon on DotCloud, you can rely on it.</a>"</p>]]>
        
    </content>
</entry>

<entry>
    <title>Git-backed wikis, Gollum, and simple installation experiences</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/phillip_smith/2010/08/git-backed-wikis-gollum-and-simple-installation-experiences.html" />
    <id>tag:blogs.perl.org,2010:/users/phillip_smith//70.905</id>

    <published>2010-08-16T12:47:31Z</published>
    <updated>2010-08-16T12:55:47Z</updated>

    <summary> Last night I upgraded the Bricolage wiki on Github to the new git-backed wiki that Github rolled out last week. May sound like a trivial thing and not worth a blog post, but it&#8217;s quite the opposite, actually &#8212;...</summary>
    <author>
        <name>Phillip Smith</name>
        <uri>http://phillipadsmith.com</uri>
    </author>
    
    <category term="bricolage" label="bricolage" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="bricolagecms" label="bricolagecms" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="github" label="github" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="gollum" label="gollum" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/phillip_smith/">
        <![CDATA[<p><img alt="bric-wiki-in-gollum.png" src="http://blogs.perl.org/users/phillip_smith/bric-wiki-in-gollum.png" width="638" height="409" class="mt-image-center" style="text-align: center; display: block; margin: 0 auto 20px;border:1px solid black" /></p>

<p>Last night I upgraded the <a href="http://github.com/bricoleurs/bricolage/wiki">Bricolage wiki on Github</a> to the new git-backed wiki that <a href="http://github.com/blog/699-making-github-more-open-git-backed-wikis">Github rolled out last week</a>. May sound like a trivial thing and not worth a blog post, but it&#8217;s quite the opposite, actually &#8212; the changes are (almost) revolutionary. </p>

<p>The first really interesting thing about the upgrade is that all of a project&#8217;s wiki pages are now simple text files in their own git repository. Now I can update these pages anyway I like, in any one of several markup languages, including <a href="http://en.wikipedia.org/wiki/Plain_Old_Documentation">POD</a>. On it&#8217;s own, that&#8217;s pretty useful &#8212; now I can clone a project&#8217;s wiki along with the project itself and submit changes back as I would any other changes via Git.</p>

<p>The second interesting thing about the upgrade is the <a href="http://github.com/github/gollum">offline viewing and editing tool that Github released called Gollum</a>. This is a small Ruby on Sinatra application that &#8212; when run in the git-backed wiki repository &#8212; runs a local copy of the Github wiki that can be used to view and edit those wiki pages offline (see screenshot above).</p>

<p>On a final note: I remarked to <a href="http://twitter.com/theory">Theory</a> last night that I hadn&#8217;t played with <a href="http://rubygems.org/">RubyGems</a> for a while and I was impressed at how painless and easy the Gollum installation was. He pointed out that &#8216;gem install&#8217; almost always runs without any tests (unlike the cpan client). I did make me wonder about the best way to distribute a &#8220;mini app&#8221; like Gollum within the current Perl ecosystem of mini tools and micro frameworks&#8230; perhaps <a href="http://search.cpan.org/perldoc?App%3A%3Acpanminus">cpanm</a> plus <a href="http://search.cpan.org/dist/Mojolicious/lib/Mojolicious/Lite.pm">Mojolicious::Lite</a> could create a similar &#8220;no brain required&#8221; installation?</p>

<p>Food for thought. </p>
]]>
        

    </content>
</entry>

<entry>
    <title>Aggregating mailing lists: To Plagger or not to Plagger?  </title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/phillip_smith/2010/08/aggregating-mailing-lists-to-plagger-or-not-to-plagger.html" />
    <id>tag:blogs.perl.org,2010:/users/phillip_smith//70.882</id>

    <published>2010-08-11T15:18:16Z</published>
    <updated>2010-08-11T15:26:15Z</updated>

    <summary> Over the last few years, I&apos;ve come to rely on tools that summarize information for me: Being on a mailing list in digest mode and receiving a summary of activity once or twice a day is a great example...</summary>
    <author>
        <name>Phillip Smith</name>
        <uri>http://phillipadsmith.com</uri>
    </author>
    
    <category term="aggregation" label="aggregation" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="plagger" label="plagger" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/phillip_smith/">
        <![CDATA[<p><img alt="plagger_header.png" src="http://blogs.perl.org/users/phillip_smith/plagger_header.png" width="236" height="73" class="mt-image-right" style="float: right; margin: 0 0 20px 20px;" /></p>

<p>Over the last few years, I've come to rely on tools that summarize information for me: Being on a mailing list in digest mode and receiving a summary of activity once or twice a day is a great example -- and it's also the specific challenge that I'm struggling with.</p>

<p>As my information consumption habits change, I find that I also want to customize how that information is delivered, and when, more than simply changing to digest mode allows. And, frankly, even in digest mode, I receive too many individual e-mails. </p>

<p>To resolve this, I end up setting my list subscriptions to "no mail" and fooling myself into thinking I'll peruse them on the Web from time-to-time. However, for those mailing lists, I'd actually <strong>would</strong> like to see what's happening regularly. So, last week I started brainstorming a tool that would send me a daily summary of all activity across a variety of different lists -- combining, say, all lists about security into one daily e-mail summary with links to the individual posts. </p>

<p>So, here's the challenge: half the lists are <a href="http://www.list.org">Mailman</a> lists, the other half are <a href="http://www.groups.google.com">Google Groups</a>; half of them are public, the other half private.</p>

<p>After I'd sketched out the initial requirements, I thought to myself "I probably don't need to start from scratch, I'm pretty sure that my old friend <a href="http://plagger.org">Plagger</a> -- the Perl-based "UNIX pipe programming for Web 2.0" -- can do most of this." Thus, I updated my Plagger source from Github and started digging...</p>

<p>Turns out that Plagger can handle two requirements already: consuming a Mailman archive and outputting it in a variety of ways, and -- obviously -- consuming the XML feed that's provided for a public Google Group. In the Plagger world, that would be as simple as this: </p>

<script src="http://gist.github.com/519063.js?file=gistfile1.txt"></script>

<p>So, that part is surprisingly simple. The bigger challenge is dealing with private mailing lists, where:</p>

<ul>
<li>If it's a Google Group, I need to authenticate to Google first (though, I only need to authenticate once for all lists, thankfully);</li>
<li>If it's Mailmain, I need to authenticate to each list with a different password.</li>
</ul>

<p>So -- drumroll please -- here's the actual question: <strong>Should I simple develop a couple of new plugins for Plagger to handle Google Groups and private Mailman lists? Or should I develop something smaller that is focused on my specific set of requirements?</strong> </p>

<p>I think the question is really about the status of the Plagger project and community. I've developed a couple of plugins for Plagger already -- one that integrates <a href="http://bit.ly">bit.ly</a> and another that fixes problem in the existing Publish::MT plugin -- but there are a couple things that bother me about going down this road again. Specifically:</p>

<ul>
<li>It's difficult to get help for Plagger: the IRC channel is not really active, and the Plagger Google Group is full of spam. </li>
<li>The Plagger documentation is woefully incomplete and -- in some cases -- just plain wrong.</li>
<li>The existing Plagger Web site is terribly unhelpful, and more-often-than-not, contradictory (where do I get the latest Plagger source? From Subversion, or from Github?)</li>
</ul>

<p>Lately, some folks have told me they looked at Plagger and then decided to develop their own aggregation tool instead of using it. So, What am I missing? Should I be heading down the "roll my own" path also?</p>

<p>There seems to be some recent activity on <a href="http://github.com/miyagawa/plagger">Plagger's github page</a> -- a few forks anyway -- so the project is not entirely abandoned, it appears. However, it would be really comforting to see some efforts at making it easy for those of us who are working with Plagger to share configuration files, new plugins, and so on. Or maybe none of this should be a concern at all?</p>

<p>What do you think? What would you do? </p>
]]>
        

    </content>
</entry>

<entry>
    <title>Bricolage CMS hacking made easy! </title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/phillip_smith/2010/07/bricolage-cms-hacking-made-easy.html" />
    <id>tag:blogs.perl.org,2010:/users/phillip_smith//70.715</id>

    <published>2010-07-05T20:13:50Z</published>
    <updated>2010-07-05T20:29:06Z</updated>

    <summary>After my last post about Installing Bricolage 2 on Mac OS X 10.6 &quot;Snow Leopard,&quot; I realized that there are a few more important steps that should be documented for those that was to hack on Bricolage CMS vs. just...</summary>
    <author>
        <name>Phillip Smith</name>
        <uri>http://phillipadsmith.com</uri>
    </author>
    
    <category term="bricolage" label="bricolage" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="development" label="development" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="git" label="git" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/phillip_smith/">
        <![CDATA[<p>After my last post about <a href="http://blogs.perl.org/users/phillip_smith/2010/07/not-for-the-faint-of-heart-installing-bricolage-2-on-os-x-106-snow-leopard.html">Installing Bricolage 2 on Mac OS X 10.6 "Snow Leopard,"</a> I realized that there are a few more important steps that should be documented for those that was to hack on <a href="http://www.bricolagecms.org">Bricolage CMS</a> vs. just running it. The following instructions link up your git clone with the application itself, making it easy to apply changes, test them, and push them upstream.</p>]]>
        <![CDATA[
<strong>Preparations</strong>
<p>
Assuming you made it to the "<a href="http://blogs.perl.org/users/phillip_smith/2010/07/not-for-the-faint-of-heart-installing-bricolage-2-on-os-x-106-snow-leopard.html">Installing Bricolage</a>" section of the previous post -- and maybe even got Bricolage running! -- you're now all set to tear down that installation and set-up your development environment. Thankfully, Bricolage provides a handy 'make dev' to do all of the hard work for you. </p>

<p>Now I'm going to assume that you went the 'git clone' route if you had the intent of doing some hacking. If not, now's the time to do so! <a href="http://wiki.github.com/bricoleurs/bricolage/">Head over to the Bricolage wiki</a> and <a href="http://wiki.github.com/bricoleurs/bricolage/working-with-git">follow the instructions for Contributing to Bricolage</a>. </p>

<p>Now, instead of making using 'make dist' to create a distribution that can be installed with 'make install', we're going to use 'make dev' instead. However, before we do that, we're going to do two things:</p>

<ol>
<li><p>Shut down Bricolage if it's already running with 'sudo /usr/local/bricolage/bin/bric_apachectl stop' (And check your process table to ensure it's stopped.)</p></li>
<li><p>Remove the existing Bricolage installation to ensure that we're starting with a fresh development installation. You can do that with 'sudo rm -r -f /usr/local/bricolage'. If you did any fancy configuration settings to get your Bricolage installation working the first time, you may want to back-up /usr/local/bricolage/conf/* first. Also, 'make dev' drops the Bricolage database and loads a fresh copy, so if did any work on your existing installation, you'll want to dump the database first. </p></li>
</ol>

<p>The other thing to quickly think about is the location of the git clone you just created. The directories /Users/ and $HOME already have the appropriate permissions, but anything below those may not. Mine was initially in '/Users/username/Documents/Foldername' and that caused a number of problems for Apache relating to permissions on symlinks and so on. Thus, I created a '/Users/username/Development' directory and gave it the necessary 'drwxr-xr-x' permissions so that Apache would be happy. So now my git clone was in '/Users/username/Development/bricolage' and that's where I headed next. </p>

<strong>Make Dev</strong>
<p>Because I'm not using the OS X system-installed Perl, I wanted to ensure that I was building Bricolage from '/usr/local/bin/perl' and, thus, I ran '/usr/local/bin/perl Makefile.PL' to get things started.</p>

<p>Next, I ran 'make dev' and passed in a number of environmental variables for the installation that I wanted. Mine looks like 'sudo make dev BRICOLAGE_HTTPD_VERSION=apache2 BRICOLAGE_SSL=0' and tells 'make dev' to build for Apache2 without SSL. These are the same as the questions you are asked during a normal installation. </p>

<p>Once that's done, you should be able to run 'sudo /usr/local/bin/perl /usr/local/bricolage/bin/bric_apachectl start' and see Apache start-up successfully, at which point you can log-in to Bricolage as you did the first time. </p>

<p>The only difference is that your 'bin', 'comp', and 'lib' directories in /usr/local/bricolage/ are linked to '/Users/username/Development/bricolage/*' (or wherever you choose to create your git clone). Thus, you can make changes the files in your git clone directory and have those change reflected in the live Bricolage application that's running from '/usr/local/bricolage'.</p>

<p>Try it out. Make an improvement. Send us a pull request!  :-)</p>

<strong>Build Aliases</strong>
<p>David Wheeler has -- in his own slightly-perfection-obsessed fashion -- taken this idea to new levels. As he explained on the <a href="http://bricolagecms.org/support/">Bricolage mailing list</a>, using the approach outlined above -- passing environmental variables to 'make dev' -- and the Unix '<a href="http://en.wikipedia.org/wiki/Alias_(command)">alias</a>' command, he's able to quickly tear down and build new development versions of Bricolage to test different configurations. David calls these 'build aliases' and you can read more about it <a href="http://wiki.github.com/bricoleurs/bricolage/build-aliases">here</a>. </p>

<p>That's it for today. Happy Bricolage hacking. </p>]]>
    </content>
</entry>

<entry>
    <title>Not for the faint of heart: Installing Bricolage 2 on Mac OS X 10.6 &quot;Snow Leopard&quot;</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/phillip_smith/2010/07/not-for-the-faint-of-heart-installing-bricolage-2-on-os-x-106-snow-leopard.html" />
    <id>tag:blogs.perl.org,2010:/users/phillip_smith//70.703</id>

    <published>2010-07-02T17:37:30Z</published>
    <updated>2010-07-05T20:46:46Z</updated>

    <summary>Okay, I admit it: Bricolage CMS -- the open-source enterprise-class content management system -- takes a few hours to install. The upside? A well-deserved sense of accomplishment. Seriously, as someone who works with Bricolage regularly and likes to contribute to...</summary>
    <author>
        <name>Phillip Smith</name>
        <uri>http://phillipadsmith.com</uri>
    </author>
    
    <category term="apache" label="apache" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="bricolage" label="bricolage" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="cpan" label="cpan" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="mod_perl" label="mod_perl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/phillip_smith/">
        <![CDATA[<p>Okay, I admit it: <a href="http://bricolagecms.org/">Bricolage CMS</a> -- the open-source enterprise-class content management system -- takes a few hours to install. The upside? A well-deserved sense of accomplishment.</p>

<p>Seriously, as someone who works with Bricolage regularly and likes to contribute to the project (when time permits), it's incredibly helpful to be able to have it running locally on my laptop from the latest <a href="http://github.com/bricoleurs/bricolage">Github source</a>. </p>

<p>Unfortunately, the Bricolage installation documentation for OS X needs some serious love. There are at least three contradictory resources at the moment: David Wheeler's post "<a href="http://www.justatheory.com/computers/os/macosx/my_adventures.html">My Adventures with Mac OS X</a>" from 2002 (OS X 10.1), the <a href="http://github.com/bricoleurs/bricolage/blob/master/README.MacOSX">README.MacOSX</a> that Bricolage comes with, and the "<a href="http://wiki.github.com/bricoleurs/bricolage/installing-bricolage-on-mac-os-x">Installing Bricolage on Mac OS X wiki page on Github</a>, which only covers OS X 10.3. Thankfully, <a href="http://twitter.com/theory">Theory</a> (David Wheeler) is easy to find in the #bricolage channel on irc.perl.org and can be cajoled into providing helpful install hints. </p>

<p>All that said, installing Bricolage 2.0 on the current version of OS X -- 10.6.4 "Snow Leopard" -- was actually quite straightforward. So, before diving into updating all of the install documentation, I wanted to capture the basic process here and get some feedback on next steps. If you want to help with feedback, just jump to the <strong>Questions</strong> section at the end of this post.</p>]]>
        <![CDATA[<p class="c1"><strong>Before you begin</strong>
  <p class="c1">Quoting from a Bricolage wiki page:
  <p class="c1"><strong>Xcode Tools (formerly Developer Tools)</strong>: As of OS X 10.3, all of the development libraries, compilers, etc. are included in Xcode Tools. In 10.2 and prior, they were included in the Developer Tools. In order to compile anything on OS X, you need to install Xcode Tools. These are available for free from the <a href="http://connect.apple.com/" class="c2">Apple Developer Connection</a> website. It is currently a 600+ MB download, so go make yourself something to eat while you wait.
  <p class="c1">So you'll need to download Xcode, or install it from your Snow Leopard DVD.
  <p class="c1"><strong>Installing the pre-requisites</strong>
  <p class="c1">Bricolage is a big application and it requires a non-trivial list of prerequisites to be installed. Notably a bunch of Perl modules, <a href="http://expat.sourceforge.net/" class="c2">Expat</a>, and <a href="http://httpd.apache.org/apreq/" class="c2">libapreq</a>. And, given that Bricolage is a mod<em>perl application, you'll also require Apache, mod</em>perl, and also a database like Postgres or MySQL.
  <p class="c1">Personally, I like to just run the latest version of just about everything, and my sense is that what many other folks will want to do also, so I elected to skip anything relating to Apache 1.3 or mod_perl 1.
  <p class="c1">So, referring to the three documents mentioned above, I got underway with the prerequisites as follows:
  <p class="c1"><strong>gdbm</strong>: I skipped installing gdbm on Theory's recommendation.
  <p class="c1"><strong>Expat</strong>: Pretty straightforward. Download the latest source (expat-2.0.1 in my case), untar it and enter directory, run './configure' and then 'make', 'make test', and 'sudo make install'.
  <p class="c1"><strong>Perl</strong>: This is a topic for a longer post, but quickly: OS X comes with Perl v5.10.0 these days, however many recommend installing a newer version in /usr/local/ for any serious Perl fun. Compiling your own Perl also helps to ensure that you don't mess up the system's Perl installation, and that future upgrades to the OS won't mess up your Perl.
  <p class="c1">I already had Perl v5.12.1 built on my laptop, but -- if you need to do that -- the basic steps to build and install Perl with all of the defaults are: download the latest source, untar the source, enter the source directory and type 'sh Configure -de', then 'make', 'make test', and 'sudo make install'. It's very straightforward. After it's installed, be sure to add something like 'export PATH=/usr/local/bin:$PATH' to your .profile or similar to use the new Perl by default.
  <p class="c1"><strong>Apache 2</strong>: I took the lazy route here and just <a href="https://svn.kineticode.com/cap/bin/apache2.sh" class="c2">used Theory's Apache 2 installation script</a>. He's got some fancy <a href="http://www.capify.org/index.php/Capistrano" class="c2">Capistrano</a> set-up that uses the above linked script to download, unpack, and compile Apache 2 in one step. If you want to do it manually, just follow the steps in that script.
  <p class="c1">Remember that you'll now have two versions of Apache 2 installed on your system -- the one installed by OS X, and the one you've just installed -- thus you'll want to update your .profile or similar to use it be default with something like 'export PATH=/usr/local/apache2/bin:${PATH}'.
  <p class="c1">A nice side-effect of using Apache 2 is that it there's no need to separately download and install mod_ssl, as it's already included. Same goes for OpenSSL, as it ships with OS X these days. So a few steps are saved there.
  <p class="c1"><strong>libapreq</strong>: You'll also need this library installed and loaded in Apache 2. However, to build libapreq you'll need to first install <a href="http://kobesearch.cpan.org/htdocs/ExtUtils-XSBuilder/ExtUtils/XSBuilder.html" class="c2">ExtUtils::XSBuilder</a>. I did that quickly via CPAN. Similar to Apache 2 above, I took the easy route and used <a href="https://svn.kineticode.com/cap/bin/apreq2.sh" class="c2">Theory's fancy little install script to install libapreq for Apache 2</a>.
  <p class="c1"><strong>mod_perl2</strong>: This was a bit tricky, as there were various sources of conflicting advise on the best way to configure mod_perl2 on OS X. In the end, I went with the following: download the latest source, untar and enter source directory, and 'perl Makefile.PL', 'make -j8', make test (some tests fail), sudo make install.
  <p class="c1">After the successful install, make sure to follow the instructions presented and add the 'LoadModule perl_module modules/mod_perl.so' line to your Apache 2 httpd.conf file.
  <p class="c1"><strong>Testing everything so far</strong>
  <p class="c1">At this point, I wanted to ensure that everything was working smoothly before I proceeded. To do that, I started up Apache 2 with 'apachectl start' and confirmed that Apache 2 was running, and then ran 'apachectl -M' to list all of the loaded modules and looked to confirm that 'perl_module' was there.
  <p class="c1">If you want to do one step further, you can also <a href="http://perl.apache.org/docs/2.0/user/intro/start_fast.html#Registry_Scripts" class="c2">follow the mod_perl documentation</a> to test that you can successfully serve a .pl file.
  <p class="c1"><strong>Postgres or MySQL</strong>
  <p class="c1">Installing PostgreSQL was dead simple. I just followed <a href="http://zanshin.net/2009/09/07/installing-postgresql-on-mac-10-6-snow-leopard/" class="c2">Mark H. Nichols' write up</a>, which included the manual steps to create a new user and group for Postgres now that Apple no longer ships the Netinfo Manager application.
  <p class="c1">For MySQL, there are <a href="http://hivelogic.com/articles/compiling-mysql-on-snow-leopard" class="c2">lots of articles</a> on installing it from source, or you can use the handy <a href="http://dev.mysql.com/downloads/mysql/" class="c2">one-click binary installer</a>.
  <p class="c1"><strong>Perl modules</strong>
  <p class="c1">If you're using Perl regularly, you'll probably have a bunch of the Perl modules installed already. If not, I would recommend something like <a href="http://search.cpan.org/perldoc?Task::Kensho" class="c2">Task::Kensho</a> as a great way to install a set of "Enlightened Perl" modules that ease day-to-day development with Perl. Either way, here's a list of the modules that you'll want to install first:
  <p class="c1">
  <ul>
    <li>XML::Parser 
    <li>DBD::Pg 
    <li>Test::File 
    <li>Imager
  </ul>
  <p class="c1">And, also, most of the modules listed in <a href="http://search.cpan.org/dist/Bundle-Bricolage/lib/Bundle/Bricolage.pm" class="c2">Bundle::Bricolage</a>. I used the bundle, even though it's a bit outdated and I didn't need mod_perl1 obviously, as I was already using mod_perl2. I had also installed libprereq in the steps above, so didn't need to install Apache::Request. You can decide which way you want to go.
  <p class="c1">In any case, using CPAN or the new <a href="http://search.cpan.org/perldoc?App::cpanminus" class="c2">cpanm</a> to install the required modules, or the bundle, should get you 90% of the way to having Bricolage installed and running on your Mac or <a href="http://www.hackintosh.com/" class="c2">Hackintosh</a>.
  <p class="c1"><strong>Installing Bricolage</strong>
  <p class="c1">Now you have two ways to go here. You can either <a href="http://bricolagecms.org/downloads/" class="c2">download a distribution</a> or get the <a href="http://github.com/bricoleurs/bricolage" class="c2">latest source via Github</a>. If you're going to do any development on Bricolage itself (patches greatly welcome!), you'll want to go the Github route. If you just want to get it running and/or don't have Git installed, you can skip some of these steps by downloading a distribution. Here's how I did it:
  <p class="c1">Cloned the public git repository with 'git clone git://github.com/bricoleurs/bricolage.git' and entered the 'bricolage' directory and ran 'perl Makefile.PL'.
  <p class="c1">If you're using the git source, you'll need to run 'make dist' to create a distribution from the source and enter the distribution directory that was created. From there, things are the same regardless of how you got the source.
  <p class="c1">Run 'make', 'sudo make test &amp; make install' and answer the questions that the installer asks. If you followed the steps above, most of the questions should have sensible / usable defaults suggested and you can just accept them. I answered 'no' for SSL, as I wasn't planning to use it.
  <p class="c1">If successful, you should see the following:
  <blockquote class="c3">
    <p class="c1">Bricolage Installation Complete
    <p class="c1">You may now start your Bricolage server with the command (as root):
    <p class="c1">/usr/local/bricolage/bin/bric_apachectl start
    <p class="c1">If this command fails, look in your error log for more information:
    <p class="c1">/usr/local/bricolage/log/error_log
    <p class="c1">Once your server is started, open a web browser and enter the URL for your server:
    <p class="c1">http://your-local-host-name:8080
    <p class="c1">Login in as "admin" with the default password "change me now!". Your first action should be changing this password. Click "Logged in as Bricolage Administrator" in the top right corner of the browser window and change the password.
    <p class="c1">Pointers for documentation and lots of getting started advice are in the main README file in the unpacked distribution directory.
  </blockquote>
  <p class="c1">Open a browser, navigate to the URL provided and you should see the Bricolage log-in screen.
  <p class="c1"><s>If you want to do some Bricolage hacking, you'll also want to run 'make dev' with the proper options from your source directory to link up the /usr/local/bricolage files to your git-managed files. (More on that shortly.)</s> Ignore this for now. I'll do a separate post about it. <strong>Update</strong>: <a href="http://blogs.perl.org/users/phillip_smith/2010/07/bricolage-cms-hacking-made-easy.html">Here's the post</a>.
  <p class="c1"><strong>Questions</strong>
  <p class="c1">So, after all that, I must task myself with cleaning up the installation documentation. However, before I do, my questions are:
  <ol class="c5">
    <li class="c4">
      <p class="c1">I think most of this should simply be in <a href="http://github.com/bricoleurs/bricolage/blob/master/README.MacOSX" class="c2">README.MacOSX</a> file and not in a separate Wiki page, or elsewhere. Sensible?
    <li class="c4">
      <p class="c1">Should information still be provided on how to install Bricolage using the OS X-supplied version of Apache 2? Given the curious way that OS X lays out the various configuration files and how easy it is to install a /usr/local/ version, I don't see many advantages of supporting this approach -- do you?
    <li class="c4">
      <p class="c1">Now that Bricolage supports Apache2 and mod<em>perl2, should the instructions still provide information on installing Apache 1.3 and mod</em>perl1? In the past, the Bricolage team has made a Herculean effort at providing information on almost any supported configuration, but I wonder if it would make sense to provide more detailed and regularly updated information on a "recommended configuration" vs. every possible configuration. Thoughts? My own thinking is -- given how painless it was to install with the more recent releases of Apache and mod_perl -- that the README.MacOSX should present the path of least resistance, and we can have supplemental pages in the wiki for other configurations.
    </ol>
  <p class="c1">Pending answers to the above, the next steps are to:
  <ul class="c6">
    <li class="c4">Update the <a href="http://github.com/bricoleurs/bricolage/blob/master/README.MacOS" class="c2">README.MacOSX</a> to provide the most pain-free path possible
    <li class="c4">Replace the "<a href="http://wiki.github.com/bricoleurs/bricolage/installing-bricolage-on-mac-os-x" class="c2">Installing Bricolage on Mac OS X</a>" wiki page with a pointer to the above README
    <li class="c4">Move alternate installation methods to a separate wiki page that can be appended as folks work through those configurations
  </ul>
  <p class="c1">If you've read this far, you must have something to say! So drop a note in the comments below or <a href="http://twitter.com/phillipadsmith" class="c2">follow me on Twitter here</a>.]]>
    </content>
</entry>

</feed>
