--- /dev/null
+This file documents the revision history for Perl extension Class::MOP::Browser.
+
+0.01 2006-09-11 13:36:09
+ - initial revision, generated by Catalyst
--- /dev/null
+use inc::Module::Install;
+
+name 'Class-MOP-Browser';
+all_from 'lib/Class/MOP/Browser.pm';
+
+requires 'Catalyst' => '5.7001';
+requires 'Catalyst::Plugin::ConfigLoader';
+requires 'Catalyst::Plugin::Static::Simple';
+requires 'Catalyst::Action::RenderView';
+requires 'YAML'; # This should reflect the config file format you've chosen
+ # See Catalyst::Plugin::ConfigLoader for supported formats
+catalyst;
+
+install_script glob('script/*.pl');
+auto_install;
+WriteAll;
--- /dev/null
+Run script/class_mop_browser_server.pl to test the application.
--- /dev/null
+---
+name: Class::MOP::Browser
--- /dev/null
+
+use lib '/Users/stevan/Projects/Moose/Moose/Class-MOP/trunk/lib';
+
+package Class::MOP::Browser;
+
+use strict;
+use warnings;
+
+use Class::MOP;
+use B::Deparse;
+use Data::Dumper;
+
+use Catalyst::Runtime '5.70';
+use Catalyst qw/
+ -Debug
+ ConfigLoader
+ Static::Simple
+/;
+
+our $VERSION = '0.01';
+
+__PACKAGE__->config(name => 'Class::MOP::Browser');
+
+__PACKAGE__->config(
+ 'View::TT' => {
+ INCLUDE_PATH => [
+ __PACKAGE__->path_to(qw/root/),
+ __PACKAGE__->path_to(qw/root templates/),
+ ],
+ TEMPLATE_EXTENSION => ".tmpl",
+ WRAPPER => [
+ 'wrappers/root.tmpl',
+ ],
+ },
+);
+
+
+__PACKAGE__->setup;
+
+sub get_all_metaclasses { sort { $a->name cmp $b->name } Class::MOP::get_all_metaclass_instances }
+sub get_metaclass_by_name {
+ shift;
+ Class::MOP::get_metaclass_by_name(@_);
+}
+
+sub deparse_method {
+ my (undef, $method) = @_;
+
+ my $deparse = B::Deparse->new("-d");
+ my $body = $deparse->coderef2text($method->body());
+
+ my @body = split /\n/ => $body;
+ my @cleaned;
+
+ foreach (@body) {
+ next if /^\s+use/;
+ next if /^\s+BEGIN/;
+ next if /^\s+package/;
+ push @cleaned => $_;
+ }
+
+ return "sub " . $method->name . ' ' . (join "\n" => @cleaned);
+}
+
+sub deparse_item {
+ my (undef, $item) = @_;
+ return $item unless ref $item;
+ local $Data::Dumper::Deparse = 1;
+ local $Data::Dumper::Indent = 1;
+ my $dumped = Dumper $item;
+ $dumped =~ s/^\$VAR1\s=\s//;
+ $dumped =~ s/\;$//;
+
+ my @body = split /\n/ => $dumped;
+ my @cleaned;
+
+ foreach (@body) {
+ next if /^\s+use/;
+ next if /^\s+BEGIN/;
+ next if /^\s+package/;
+ push @cleaned => $_;
+ }
+
+ return (join "\n" => @cleaned);
+}
+
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Class::MOP::Browser - Catalyst based application
+
+=head1 SYNOPSIS
+
+ script/class_mop_browser_server.pl
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 SEE ALSO
+
+L<Class::MOP::Browser::Controller::Root>, L<Catalyst>
+
+=head1 AUTHOR
+
+Stevan Little
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
--- /dev/null
+
+package Class::MOP::Browser::Controller::Root;
+
+use strict;
+use warnings;
+
+use base 'Catalyst::Controller';
+
+our $VERSION = '0.01';
+
+__PACKAGE__->config->{namespace} = '';
+
+sub default : Private {
+ my ($self, $c) = @_;
+ $c->response->body("Helloooooo World");
+}
+
+sub index : Public {
+ my ( $self, $c ) = @_;
+}
+
+sub end : ActionClass('RenderView') {}
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Class::MOP::Browser::Controller::Root - Root Controller for Class::MOP::Browser
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 METHODS
+
+=head2 default
+
+=cut
+
+=head2 end
+
+Attempt to render a view, if needed.
+
+=head1 AUTHOR
+
+Stevan Little
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
--- /dev/null
+
+package Class::MOP::Browser::View::TT;
+
+use strict;
+use warnings;
+
+our $VERSION = '0.01';
+
+use base 'Catalyst::View::TT';
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Class::MOP::Browser::View::TT - Catalyst TT View
+
+=head1 SYNOPSIS
+
+See L<Class::MOP::Browser>
+
+=head1 DESCRIPTION
+
+Catalyst TT View.
+
+=head1 AUTHOR
+
+Stevan Little
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
--- /dev/null
+
+<table widht='100%' height='100%' border='1'>
+<tr valign='top'>
+
+<td rowspan='2'><table cellspacing='3' cellpadding='5' border='0'>
+ [% FOREACH metaclass IN c.get_all_metaclasses %]
+ <tr>
+ [% IF c.request.param('class') == metaclass.name %]
+ <td bgcolor='#99BBFF'>[% metaclass.name %]</td>
+ [% ELSE %]
+ <td bgcolor='#CCCCCC'><a href='?class=[% metaclass.name %]'>[% metaclass.name %]</a></td>
+ [% END %]
+ </tr>
+ [% END %]
+ </table></td>
+
+[% IF c.request.param('class') %]
+<td height='30' width='300'><table cellspacing='3' cellpadding='5' border='0' width='100%'>
+ <tr>
+ [% FOREACH area IN [ 'attributes', 'methods', 'superclasses' ] %]
+ [% IF c.request.param('area') == area %]
+ <td bgcolor='#FFDD99'>[% area %]</td>
+ [% ELSE %]
+ <td bgcolor='#99BBFF'><a href='?class=[% c.request.param('class') %]&area=[% area %]'>[% area %]</a></td>
+ [% END %]
+ [% END %]
+ </tr>
+ </table></td>
+[% END %]
+
+[% IF c.request.param('class') && c.request.param('area') == 'attributes' && c.request.param('attr') %]
+
+[%
+ meta = c.get_metaclass_by_name(c.request.param('class'))
+ attr = meta.get_attribute(c.request.param('attr'))
+%]
+
+<td rowspan='2'><table cellspacing='3' cellpadding='5' border='0' width='300'>
+ [% FOREACH aspect IN [ 'name', 'init_arg', 'reader', 'writer', 'accessor', 'predicate', 'default' ]%]
+ [% item = attr.$aspect() %]
+ <tr>
+ <td bgcolor='#33FF33' align='right' valign='top'>[% aspect %]</td>
+ <td bgcolor='#AAFFAA'>[% IF item == undef %]—[% ELSE %]<pre>[% c.deparse_item(item) %]</pre>[% END %]</td>
+ </tr>
+ [% END %]
+ </table></td>
+
+[% END %]
+
+[% IF c.request.param('class') && c.request.param('area') == 'methods' && c.request.param('method') %]
+
+[%
+ meta = c.get_metaclass_by_name(c.request.param('class'))
+ method = meta.get_method(c.request.param('method'))
+%]
+
+<td rowspan='2'><table cellspacing='3' cellpadding='5' border='0'>
+ [% FOREACH aspect IN [ 'name', 'package_name', 'fully_qualified_name' ]%]
+ <tr>
+ <td bgcolor='#33FF33' align='right' valign='top'>[% aspect %]</td>
+ <td bgcolor='#AAFFAA'>[% method.$aspect() %]</td>
+ </tr>
+ [% END %]
+ <tr>
+ <td bgcolor='#33FF33' align='right' valign='top'>body</td>
+ <td bgcolor='#AAFFAA'><pre>[% c.deparse_method(method) %]</pre></td>
+ </tr>
+ </table></td>
+
+[% END %]
+
+</tr>
+<tr>
+
+[% IF c.request.param('class') && c.request.param('area') %]
+
+[% meta = c.get_metaclass_by_name(c.request.param('class')) %]
+
+<td><div style='width: 300px; height: 100%; overflow: auto;'><table cellspacing='3' cellpadding='5' border='0' width='100%'>
+ [% IF c.request.param('area') == 'methods' %]
+ [% FOREACH method IN meta.get_method_list.sort %]
+ <tr>
+ [% IF c.request.param('method') == method %]
+ <td bgcolor='#AAFFAA'>[% method %]</td>
+ [% ELSE %]
+ <td bgcolor='#FFDD99'><a href='?class=[% c.request.param('class') %]&area=[% c.request.param('area') %]&method=[% method %]'>[% method %]</a></td>
+ [% END %]
+ </tr>
+ [% END %]
+ [% END %]
+ [% IF c.request.param('area') == 'attributes' %]
+ [% FOREACH attr IN meta.get_attribute_list.sort %]
+ <tr>
+ [% IF c.request.param('attr') == attr %]
+ <td bgcolor='#AAFFAA'>[% attr %]</td>
+ [% ELSE %]
+ <td bgcolor='#FFDD99'><a href='?class=[% c.request.param('class') %]&area=[% c.request.param('area') %]&attr=[% attr %]'>[% attr %]</a></td>
+ [% END %]
+ </tr>
+ [% END %]
+ [% END %]
+ [% IF c.request.param('area') == 'superclasses' %]
+ [% FOREACH super IN meta.superclasses.sort %]
+ <tr>
+ <td bgcolor='#FFDD99'><a href='?class=[% super %]'>[% super %]</a></td>
+ </tr>
+ [% END %]
+ [% END %]
+ </table></div></td>
+[% END %]
+
+</tr>
+</table>
\ No newline at end of file
--- /dev/null
+<html>
+<head>
+<title>Class::MOP Browser</title>
+<style type='text/css'>
+
+A {
+ font-family: sans-serif;
+ color: black;
+ text-decoration: none;
+}
+
+A:hover {
+ text-decoration: underline;
+}
+
+</style>
+</head>
+<body>
+[% content %]
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+#!/usr/bin/perl -w
+
+BEGIN { $ENV{CATALYST_ENGINE} ||= 'CGI' }
+
+use strict;
+use warnings;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+use Class::MOP::Browser;
+
+Class::MOP::Browser->run;
+
+1;
+
+=head1 NAME
+
+class_mop_browser_cgi.pl - Catalyst CGI
+
+=head1 SYNOPSIS
+
+See L<Catalyst::Manual>
+
+=head1 DESCRIPTION
+
+Run a Catalyst application as a cgi script.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri@oook.de>
+
+=head1 COPYRIGHT
+
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
--- /dev/null
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use Catalyst::Helper;
+
+my $force = 0;
+my $mech = 0;
+my $help = 0;
+
+GetOptions(
+ 'nonew|force' => \$force,
+ 'mech|mechanize' => \$mech,
+ 'help|?' => \$help
+ );
+
+pod2usage(1) if ( $help || !$ARGV[0] );
+
+my $helper = Catalyst::Helper->new( { '.newfiles' => !$force, mech => $mech } );
+
+pod2usage(1) unless $helper->mk_component( 'Class::MOP::Browser', @ARGV );
+
+1;
+
+=head1 NAME
+
+class_mop_browser_create.pl - Create a new Catalyst Component
+
+=head1 SYNOPSIS
+
+class_mop_browser_create.pl [options] model|view|controller name [helper] [options]
+
+ Options:
+ -force don't create a .new file where a file to be created exists
+ -mechanize use Test::WWW::Mechanize::Catalyst for tests if available
+ -help display this help and exits
+
+ Examples:
+ class_mop_browser_create.pl controller My::Controller
+ class_mop_browser_create.pl -mechanize controller My::Controller
+ class_mop_browser_create.pl view My::View
+ class_mop_browser_create.pl view MyView TT
+ class_mop_browser_create.pl view TT TT
+ class_mop_browser_create.pl model My::Model
+ class_mop_browser_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
+ dbi:SQLite:/tmp/my.db
+ class_mop_browser_create.pl model AnotherDB DBIC::Schema MyApp::Schema create=static\
+ dbi:Pg:dbname=foo root 4321
+
+ See also:
+ perldoc Catalyst::Manual
+ perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Create a new Catalyst Component.
+
+Existing component files are not overwritten. If any of the component files
+to be created already exist the file will be written with a '.new' suffix.
+This behavior can be suppressed with the C<-force> option.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri@oook.de>
+Maintained by the Catalyst Core Team.
+
+=head1 COPYRIGHT
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
--- /dev/null
+#!/usr/bin/perl -w
+
+BEGIN { $ENV{CATALYST_ENGINE} ||= 'FastCGI' }
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+use Class::MOP::Browser;
+
+my $help = 0;
+my ( $listen, $nproc, $pidfile, $manager, $detach );
+
+GetOptions(
+ 'help|?' => \$help,
+ 'listen|l=s' => \$listen,
+ 'nproc|n=i' => \$nproc,
+ 'pidfile|p=s' => \$pidfile,
+ 'manager|M=s' => \$manager,
+ 'daemon|d' => \$detach,
+);
+
+pod2usage(1) if $help;
+
+Class::MOP::Browser->run(
+ $listen,
+ { nproc => $nproc,
+ pidfile => $pidfile,
+ manager => $manager,
+ detach => $detach,
+ }
+);
+
+1;
+
+=head1 NAME
+
+class_mop_browser_fastcgi.pl - Catalyst FastCGI
+
+=head1 SYNOPSIS
+
+class_mop_browser_fastcgi.pl [options]
+
+ Options:
+ -? -help display this help and exits
+ -l -listen Socket path to listen on
+ (defaults to standard input)
+ can be HOST:PORT, :PORT or a
+ filesystem path
+ -n -nproc specify number of processes to keep
+ to serve requests (defaults to 1,
+ requires -listen)
+ -p -pidfile specify filename for pid file
+ (requires -listen)
+ -d -daemon daemonize (requires -listen)
+ -M -manager specify alternate process manager
+ (FCGI::ProcManager sub-class)
+ or empty string to disable
+
+=head1 DESCRIPTION
+
+Run a Catalyst application as fastcgi.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri@oook.de>
+Maintained by the Catalyst Core Team.
+
+=head1 COPYRIGHT
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
--- /dev/null
+#!/usr/bin/perl -w
+
+BEGIN {
+ $ENV{CATALYST_ENGINE} ||= 'HTTP';
+ $ENV{CATALYST_SCRIPT_GEN} = 28;
+}
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+my $debug = 0;
+my $fork = 0;
+my $help = 0;
+my $host = undef;
+my $port = 3000;
+my $keepalive = 0;
+my $restart = 0;
+my $restart_delay = 1;
+my $restart_regex = '\.yml$|\.yaml$|\.pm$';
+my $restart_directory = undef;
+
+my @argv = @ARGV;
+
+GetOptions(
+ 'debug|d' => \$debug,
+ 'fork' => \$fork,
+ 'help|?' => \$help,
+ 'host=s' => \$host,
+ 'port=s' => \$port,
+ 'keepalive|k' => \$keepalive,
+ 'restart|r' => \$restart,
+ 'restartdelay|rd=s' => \$restart_delay,
+ 'restartregex|rr=s' => \$restart_regex,
+ 'restartdirectory=s' => \$restart_directory,
+);
+
+pod2usage(1) if $help;
+
+if ( $restart ) {
+ $ENV{CATALYST_ENGINE} = 'HTTP::Restarter';
+}
+if ( $debug ) {
+ $ENV{CATALYST_DEBUG} = 1;
+}
+
+# This is require instead of use so that the above environment
+# variables can be set at runtime.
+require Class::MOP::Browser;
+
+Class::MOP::Browser->run( $port, $host, {
+ argv => \@argv,
+ 'fork' => $fork,
+ keepalive => $keepalive,
+ restart => $restart,
+ restart_delay => $restart_delay,
+ restart_regex => qr/$restart_regex/,
+ restart_directory => $restart_directory,
+} );
+
+1;
+
+=head1 NAME
+
+class_mop_browser_server.pl - Catalyst Testserver
+
+=head1 SYNOPSIS
+
+class_mop_browser_server.pl [options]
+
+ Options:
+ -d -debug force debug mode
+ -f -fork handle each request in a new process
+ (defaults to false)
+ -? -help display this help and exits
+ -host host (defaults to all)
+ -p -port port (defaults to 3000)
+ -k -keepalive enable keep-alive connections
+ -r -restart restart when files get modified
+ (defaults to false)
+ -rd -restartdelay delay between file checks
+ -rr -restartregex regex match files that trigger
+ a restart when modified
+ (defaults to '\.yml$|\.yaml$|\.pm$')
+ -restartdirectory the directory to search for
+ modified files
+ (defaults to '../')
+
+ See also:
+ perldoc Catalyst::Manual
+ perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst Testserver for this application.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri@oook.de>
+Maintained by the Catalyst Core Team.
+
+=head1 COPYRIGHT
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
--- /dev/null
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+use Catalyst::Test 'Class::MOP::Browser';
+
+my $help = 0;
+
+GetOptions( 'help|?' => \$help );
+
+pod2usage(1) if ( $help || !$ARGV[0] );
+
+print request($ARGV[0])->content . "\n";
+
+1;
+
+=head1 NAME
+
+class_mop_browser_test.pl - Catalyst Test
+
+=head1 SYNOPSIS
+
+class_mop_browser_test.pl [options] uri
+
+ Options:
+ -help display this help and exits
+
+ Examples:
+ class_mop_browser_test.pl http://localhost/some_action
+ class_mop_browser_test.pl /some_action
+
+ See also:
+ perldoc Catalyst::Manual
+ perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst action from the command line.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri@oook.de>
+Maintained by the Catalyst Core Team.
+
+=head1 COPYRIGHT
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
--- /dev/null
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+BEGIN { use_ok 'Catalyst::Test', 'Class::MOP::Browser' }
+
+ok( request('/')->is_success, 'Request should succeed' );
--- /dev/null
+use strict;
+use warnings;
+use Test::More;
+
+eval "use Test::Pod 1.14";
+plan skip_all => 'Test::Pod 1.14 required' if $@;
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+
+all_pod_files_ok();
--- /dev/null
+use strict;
+use warnings;
+use Test::More;
+
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+
+all_pod_coverage_ok();
--- /dev/null
+use strict;
+use warnings;
+use Test::More tests => 1;
+
+BEGIN { use_ok 'Class::MOP::Browser::View::TT' }
+