Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Alias (5735)

Alias
  (email not shown publicly)
http://ali.as/

Journal of Alias (5735)

Monday July 25, 2005
07:59 PM

JSAN Accelerating

[ #25884 ]

After one of the many several hour long discussions we've had lately in #jsan, it was sort of decided that we'd ask all modules to be scannable for file-level dependencies.

Which rocks, and I've wanted it since forever. The group dropped back to musings about whether it was needed or not later, but not before rob built a basic. JSAN::Parse::FileDeps .

Seeing this as a go to jump 4 steps ahead, I've taken the basic version and improved it to get the file deps out in detail.

Now, I'd already written a JavaScript library manager earlier this year, JavaScript::Librarian, but never had a way of indexing a library to test it.

But now I have! Because with a way to scan deps, and a framework to drop it into, it was only a hop skip and a jump to create JSAN::Librarian, which will index your JavaScript library for you, parse out the deps, build an index, and then let you present that index as a JavaScript::Librarian::Library object.

And what THAT lets you do is to then to create a Librarian object for your library, tell it what packages you need, and it will hand you back the code to load it, like this!

my $Librarian = JavaScript::Librarian->new(
        base => URI->new('/jsan'),
        library => JSAN::Library->new( '.openjsan.deps' ),
        );
$Librarian->add('Foo/Bar.js');
print $Librarian->html;

# Prints something like this
<script language="JavaScript" src="/jsan/Foo.js"></script>
<script language="JavaScript" src="/jsan/Bar.js"></script>
<script language="JavaScript" src="/jsan/Foo/Bar.js"></script>

Of course, from here it's only a small step to implementing Collections, which would take those three files, and concatonate them together (safely) into a single file to create something like Prototype on-the-fly from the component parts. :)

And one more step beyond that to provide it all in the form of a use server, so you just require the packages you want and it hands them back as a single stripped, compressed file, with super-efficient caching logic I plan to recycle from elsewhere.

And all of this done in only 4 hours! What was that about depth-first programming being slower again? :)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.