Jeff Bisbee > JavaScript-XRay > JavaScript::XRay

Download:
JavaScript-XRay-1.22.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.22   Source  

NAME ^

JavaScript::XRay - See What JavaScript is Doing

VERSION ^

Version 1.22

SYNOPSIS ^

 #!/usr/bin/perl
 use strict;
 use warnings;
 use JavaScript::XRay;

 # HTML page with a <head> and <body> tag and some javascript functions
 my $html_page = do { local $/; <> };

 # create a new instance
 my $jsxray = JavaScript::XRay->new();

 # to inline/filter external javascript files you'll need 'abs_uri'
 # my $jsxray = JavaScript::XRay->new( 
 #     abs_uri => $abs_url_or_local_file_path
 # );

 # use switches to change filtering behavior
 # $jsxray->switches( only => 'onData' );

 # use inlining to inline/filter external javascript files
 # $jsxray->inline_methods( 'dir1', 'dir2', \&callback, 'HTTP_GET' );

 # filter page
 print $js_xray->filter($html_page);

DESCRIPTION ^

JavaScript::XRay is an HTML source filter. It was developed as a tool to help figure out and debug large JavaScript frameworks.

The main idea is that you hook it into your application framework and give you the ability to 'flip a switch' an inject a JavaScript function tracing console into your outgoing page.

Some of the things it does...

CONSTRUCTOR ^

JavaScript::XRay->new( %hash );

Create a new instance with the following arguments

METHODS ^

$jsxray->switches( %switches )

Switches control the behavior of which is going to be filtered and provide the ability to uncomment debugging code on the fly.

$jsxray->inline_methods( @methods );

WARNING THIS FUNCTIONALITY IS EXPERIMENTAL AND THE INTERFACE MAY CHANGE

Take external javascript blocks (use src attribute) and get the javascript, filter it, and inline the code. There are currently three supported methods to do this.

$jsxray->filter( $html );

Pass HTML in, get modified HTML out.

AUTHOR ^

Jeff Bisbee, <jbisbee at cpan.org>

TODO ^

Some of the things that are still in the conceptional phase

BUGS ^

Please report any bugs or feature requests to bug-JavaScript-xray at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=JavaScript-XRay. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc JavaScript::XRay

You can also look for information at:

ACKNOWLEDGEMENTS ^

COPYRIGHT & LICENSE ^

Copyright 2006 Jeff Bisbee, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: