AUBBC

 view release on metacpan or  search on metacpan

AUBBC.pm  view on Meta::CPAN

 $protect_email =~ s/\,\z/]/g if $AUBBC{protect_email} eq 3 || $AUBBC{protect_email} eq 4;

 return make_link('javascript:void(0)',$AUBBC{email_message},"javascript:MyEmCode('$AUBBC{protect_email}',$protect_email);",'')
  if $AUBBC{protect_email} eq '2' || $AUBBC{protect_email} eq '3' || $AUBBC{protect_email} eq '4';
 }
  else {
   return $Tag_SecLVL{url}{text};
   }
}

sub js_print {
my $self = shift;
print <<JS;
Content-type: text/javascript

/*
AUBBC v$VERSION
JS

print <<'JS';
Fully supports dynamic view in XHTML.
*/
function MyEmCode (type, content) {
var returner = false;
if (type == 4) {
 var farray= new Array(content.length,1);
 for(farray[1];farray[1]<farray[0];farray[1]++) { returner+=String.fromCharCode(content[farray[1]].charCodeAt(0)^content[farray[1]-1]);farray[1]++; }
} else if (type == 3) {
 for (i = 0; i < content.length; i++) { returner+=String.fromCharCode(content[i]); }
} else if (type == 2) { returner=content; }

AUBBC.pm  view on Meta::CPAN

Advanced Universal Bulletin Board Code a Perl BBcode API

shakaflex [at] gmail.com

http://search.cpan.org/~sflex/

http://aubbc.googlecode.com/

Development Notes: Highlighting functions list and tags/commands for more
language highlighters. Ideas make some new tags like [perl] or have a command in the code
tag like [code]perl:print 'perl';[/code] with a default highlighting method if
a command was not used. Then highlighting of many types of code could be allowed
even markup like HTML.

Notes: This code has a lot of settings and works good
with most default settings see the POD and example files
in the archive for usage.

=head1 NAME

AUBBC

=head1 SYNOPSIS

  use AUBBC;
  my $aubbc = AUBBC->new();

  my $message = 'Lets [b]Bold in HTML[/b]';

  print $aubbc->do_all_ubbc($message);

=head1 ABSTRACT

Advanced Universal Bulletin Board Code a Perl BBcode API

=head1 DESCRIPTION

AUBBC is a object oriented BBcode API designed as a developers tool for themes, wiki's, forums and other BBcode to HTML Parser needs.

Features:

AUBBC.pod  view on Meta::CPAN


AUBBC

=head1 SYNOPSIS

  use AUBBC;
  my $aubbc = AUBBC->new();

  my $message = 'Lets [b]Bold in HTML[/b]';

  print $aubbc->do_all_ubbc($message);

=head1 ABSTRACT

Advanced Universal Bulletin Board Code a Perl BBcode API

=head1 DESCRIPTION

AUBBC is a object oriented BBcode API designed as a developers tool for themes, wiki's, forums and other BBcode to HTML Parser needs.

Features:

AUBBC.pod  view on Meta::CPAN

example:

 code_extra => 'Codes may not reflect what is in the current version.',

 code_extra => '<div style="clear: left"> </div>',

=head2 code_download

Default is '^Download above code^' this message will
be the links name. the link will open a JavaScript popup window and write the
code in it to be copyed or printed. A new JavaScript function was
added to the js_print method called MyCodePrint.

To turn off set this to ''

example:

 code_download => 'Click here to get above code.',

 code_download => '',
 
=head2 href_class

AUBBC.pod  view on Meta::CPAN



        2 - Javascript and unicode type protection.


        3 - Javascript and unicode type protection.


        4 - Javascript encryption

The settings 2, 3 and 4 require the JavaScript function in the js_print method of
this module. js_print can be used directly and it will print out the proper file
headers for a browser to know its a JavaScript file.

=head2 email_message

When the protect_email setting is 2, 3 or 4 it will display this message as the link name.
Default message is '&#67;&#111;&#110;&#116;&#97;&#99;&#116;&#32;&#69;&#109;&#97;&#105;&#108;'
and that say's 'Contact Email'.

=head2 highlight_class#

AUBBC.pod  view on Meta::CPAN

  $aubbc->add_build_tag(
        name     => 'hello',
        pattern  => '',
        type     => 4,
        function => 'Hello World!',
        );
  my $message = '[ok://test me] [ok://test other] [ok://n0 w00rk] [ip] [agent] [hello]';

  $message = $aubbc->do_all_ubbc($message);

  print $message;

  sub check_ok_tag {
  my ($tag_name, $text_from_AUBBC) = @_;

   if ($text_from_AUBBC eq 'test me') {
        return 'Works Good 1';
        }
         else {
               return 'Works Good 2';
               }

AUBBC.pod  view on Meta::CPAN

the instance and any new tag that had an error will not be processed.

Since there is only two errors for add_build_tag you can check this method after
all new tags have been added. All errors stack in this method and are seperaited
by a \n newline.

Usage:

        $aubbc->aubbc_error('Insert Your Error'); # Add an error

        print $aubbc->aubbc_error();

        die $aubbc->aubbc_error() if $aubbc->aubbc_error();

=head1 Memoize

This setting can turn AUBBC's usage of Memoize on or off.

=head2 $AUBBC::MEMOIZE

Default setting 1 will check if it needs to load Memoize, if loaded then load the sub's that need the speed.

AUBBC.pod  view on Meta::CPAN

=head2 $aubbc->version();


 Usage:

  use AUBBC;
  my $aubbc = AUBBC->new();

  my $Current_Version = $aubbc->version();

  print $Current_Version;


=head1 Bugs and Reports

Please report anything you think is a bug to bug-AUBBC [at] rt.cpan.org or shakaflex [at] gmail.com

=head1 History

v4.06 - 04/12/2011

AUBBC.pod  view on Meta::CPAN

&TheName; and a Perl subroutine looked the same till ; got converted.

Addition - AUBBC::make_image($align,$src,$width,$height,$alt) this is useful enough
to mention once.

v4.00 - 11/02/2010

Addition - New feature to the code tags aubbc_setting code_download.
the default setting for code_download is '^Download above code^' this message will
be the links name. the link will open a JavaScript pop-up window and write the
code in it to be copied or printed to a printer. A new JavaScript function was
added to the js_print method called MyCodePrint. JavaScript makes this feature
portable and dynamic. the link for code_download is added after the code_extra
setting so a disclaimer can be added before the code_download link

Addition - $AUBBC::MEMOIZE This setting can turn AUBBC's usage of Memoize on or off.
Default setting 1 will check if it needs to load Memoize, if loaded then load the sub's that need the speed.
Setting 0 will not use Memoize.

Addition - AUBBC::make_link($link,$name,$javascript,$target) this is useful enough
to mention once.

AUBBC.pod  view on Meta::CPAN


Fixed - fixed a line break and new line sandbox bug

Improvement - Massive speed improvement to the hole module and no features lost.
changed new for faster loading, the module uses vars for some variables,
re-spaced the hole code.

v2.10 - 08/31/2010 11:17:13

Addition - adding type 4 to add_build_tag this will use style 3 but will work
different then the other built functions. Type 4 will print the text defined in
function and not point to a defined Perl subroutine.

Addition - added line_break setting to have control over the script_escape and
html_to_text methods converting html line break <br> and new line \n

Addition - added fix_amp this setting finds all the & that need to covert to the amp; html code name
so the w3c xhtml validation checks ok.

Addition - added no_img this setting will allow some control for using [img] tags
for security reasons

AUBBC.pod  view on Meta::CPAN

v2.0 - 10/07/2008 13:52:11

Fixed single tag [name] for build tags

Changed the regex in plain URL's

Removed bad patter setting and now using a more standard way to detect bad image tags

Fixed dynamic view in XHTML for the protect email method.

Added js_print method which will print out the javascript needed for the new protect email method

Added values for the code highlighter so it can support CSS classes

Added highlighting of variables and changed 2 quote regex to allow multi line quotes

and a few other things that make this 2.0

v1.30 - 09/08/2008 14:12:10

Fixed the function check in add_build_tag(), when the 1.20 changes where made this check was neglected

CHANGES  view on Meta::CPAN

&TheName; and a Perl subroutine looked the same till ; got converted.

Addition - AUBBC::make_image($align,$src,$width,$height,$alt) this is useful enough
to mention once.

v4.00 - 11/02/2010

Addition - New feature to the code tags aubbc_setting code_download.
the default setting for code_download is '^Download above code^' this message will
be the links name. the link will open a JavaScript pop-up window and write the
code in it to be copied or printed to a printer. A new JavaScript function was
added to the js_print method called MyCodePrint. JavaScript makes this feature
portable and dynamic. the link for code_download is added after the code_extra
setting so a disclaimer can be added before the code_download link

Addition - $AUBBC::MEMOIZE This setting can turn AUBBC's usage of Memoize on or off.
Default setting 1 will check if it needs to load Memoize, if loaded then load the sub's that need the speed.
Setting 0 will not use Memoize.

Addition - AUBBC::make_link($link,$name,$javascript,$target) this is useful enough
to mention once.

CHANGES  view on Meta::CPAN


Fixed - fixed a line break and new line sandbox bug

Improvement - Massive speed improvement to the hole module and no features lost.
changed new for faster loading, the module uses vars for some variables,
re-spaced the hole code.

v2.10 - 08/31/2010 11:17:13

Addition - adding type 4 to add_build_tag this will use style 3 but will work
different then the other built functions. Type 4 will print the text defined in
function and not point to a defined Perl subroutine.

Addition - added line_break setting to have control over the script_escape and
html_to_text methods converting html line break <br> and new line \n

Addition - added fix_amp this setting finds all the & that need to covert to the amp; html code name
so the w3c xhtml validation checks ok.

Addition - added no_img this setting will allow some control for using [img] tags
for security reasons

CHANGES  view on Meta::CPAN

v2.0 - 10/07/2008 13:52:11

Fixed single tag [name] for build tags

Changed the regex in plain URL's

Removed bad patter setting and now using a more standard way to detect bad image tags

Fixed dynamic view in XHTML for the protect email method.

Added js_print method which will print out the javascript needed for the new protect email method

Added values for the code highlighter so it can support CSS classes

Added highlighting of variables and changed 2 quote regex to allow multi line quotes

and a few other things that make this 2.0

v1.30 - 09/08/2008 14:12:10

Fixed the function check in add_build_tag(), when the 1.20 changes where made this check was neglected

README  view on Meta::CPAN


AUBBC

=head1 SYNOPSIS

  use AUBBC;
  my $aubbc = AUBBC->new();

  my $message = 'Lets [b]Bold in HTML[/b]';

  print $aubbc->do_all_ubbc($message);

=head1 ABSTRACT

Advanced Universal Bulletin Board Code a Perl BBcode API

=head1 DESCRIPTION

AUBBC is a object oriented BBcode API designed as a developers tool for themes, wiki's, forums and other BBcode to HTML Parser needs.

Features:

README  view on Meta::CPAN

example:

 code_extra => 'Codes may not reflect what is in the current version.',

 code_extra => '<div style="clear: left"> </div>',

=head2 code_download

Default is '^Download above code^' this message will
be the links name. the link will open a JavaScript popup window and write the
code in it to be copyed or printed. A new JavaScript function was
added to the js_print method called MyCodePrint.

To turn off set this to ''

example:

 code_download => 'Click here to get above code.',

 code_download => '',

=head2 href_class

README  view on Meta::CPAN



        2 - Javascript and unicode type protection.


        3 - Javascript and unicode type protection.


        4 - Javascript encryption

The settings 2, 3 and 4 require the JavaScript function in the js_print method of
this module. js_print can be used directly and it will print out the proper file
headers for a browser to know its a JavaScript file.

=head2 email_message

When the protect_email setting is 2, 3 or 4 it will display this message as the link name.
Default message is '&#67;&#111;&#110;&#116;&#97;&#99;&#116;&#32;&#69;&#109;&#97;&#105;&#108;'
and that say's 'Contact Email'.

=head2 highlight_class#

README  view on Meta::CPAN

  $aubbc->add_build_tag(
        name     => 'hello',
        pattern  => '',
        type     => 4,
        function => 'Hello World!',
        );
  my $message = '[ok://test me] [ok://test other] [ok://n0 w00rk] [ip] [agent] [hello]';

  $message = $aubbc->do_all_ubbc($message);

  print $message;

  sub check_ok_tag {
  my ($tag_name, $text_from_AUBBC) = @_;

   if ($text_from_AUBBC eq 'test me') {
        return 'Works Good 1';
        }
         else {
               return 'Works Good 2';
               }

README  view on Meta::CPAN

the instance and any new tag that had an error will not be processed.

Since there is only two errors for add_build_tag you can check this method after
all new tags have been added. All errors stack in this method and are seperaited
by a \n newline.

Usage:

        $aubbc->aubbc_error('Insert Your Error'); # Add an error

        print $aubbc->aubbc_error();

        die $aubbc->aubbc_error() if $aubbc->aubbc_error();

=head1 Memoize

This setting can turn AUBBC's usage of Memoize on or off.

=head2 $AUBBC::MEMOIZE

Default setting 1 will check if it needs to load Memoize, if loaded then load the sub's that need the speed.

README  view on Meta::CPAN

=head2 $aubbc->version();


 Usage:

  use AUBBC;
  my $aubbc = AUBBC->new();

  my $Current_Version = $aubbc->version();

  print $Current_Version;


=head1 Bugs and Reports

Please report anything you think is a bug to bug-AUBBC [at] rt.cpan.org or shakaflex [at] gmail.com

=head1 History

v4.06 - 04/12/2011

README  view on Meta::CPAN

&TheName; and a Perl subroutine looked the same till ; got converted.

Addition - AUBBC::make_image($align,$src,$width,$height,$alt) this is useful enough
to mention once.

v4.00 - 11/02/2010

Addition - New feature to the code tags aubbc_setting code_download.
the default setting for code_download is '^Download above code^' this message will
be the links name. the link will open a JavaScript pop-up window and write the
code in it to be copied or printed to a printer. A new JavaScript function was
added to the js_print method called MyCodePrint. JavaScript makes this feature
portable and dynamic. the link for code_download is added after the code_extra
setting so a disclaimer can be added before the code_download link

Addition - $AUBBC::MEMOIZE This setting can turn AUBBC's usage of Memoize on or off.
Default setting 1 will check if it needs to load Memoize, if loaded then load the sub's that need the speed.
Setting 0 will not use Memoize.

Addition - AUBBC::make_link($link,$name,$javascript,$target) this is useful enough
to mention once.

README  view on Meta::CPAN


Fixed - fixed a line break and new line sandbox bug

Improvement - Massive speed improvement to the hole module and no features lost.
changed new for faster loading, the module uses vars for some variables,
re-spaced the hole code.

v2.10 - 08/31/2010 11:17:13

Addition - adding type 4 to add_build_tag this will use style 3 but will work
different then the other built functions. Type 4 will print the text defined in
function and not point to a defined Perl subroutine.

Addition - added line_break setting to have control over the script_escape and
html_to_text methods converting html line break <br> and new line \n

Addition - added fix_amp this setting finds all the & that need to covert to the amp; html code name
so the w3c xhtml validation checks ok.

Addition - added no_img this setting will allow some control for using [img] tags
for security reasons

README  view on Meta::CPAN

v2.0 - 10/07/2008 13:52:11

Fixed single tag [name] for build tags

Changed the regex in plain URL's

Removed bad patter setting and now using a more standard way to detect bad image tags

Fixed dynamic view in XHTML for the protect email method.

Added js_print method which will print out the javascript needed for the new protect email method

Added values for the code highlighter so it can support CSS classes

Added highlighting of variables and changed 2 quote regex to allow multi line quotes

and a few other things that make this 2.0

v1.30 - 09/08/2008 14:12:10

Fixed the function check in add_build_tag(), when the 1.20 changes where made this check was neglected

examples/Database_Manipulation.cgi  view on Meta::CPAN

# This will be a two part subroutine. This first one will get the message from
# the backend and display the data in a HTML form to be edited lets say its
# in variable $form_data

# Since this gets into sandboxing the html_to_text method you may want
# to play with settings for other view's or can skip the form feilds sandboxing
# the option 1 for html_to_text is needed to not convert &, spaces, tab's

$form_data = $aubbc->html_to_text( $form_data );

# Now $form_data can be printed in the form feild
# When the HTML form is submitted we fictitiously sent the edited data to editing_data2
# of this file to be saved
}

sub editing_data2 {
# Part 2 of editing data, you will need to use a module like CGI or what ever is out there
# to recive the HTML form data

# Before the HTML form data can be saved you will have to use the script_escape
# method on the variable that holds the HTML form data lets say its $message2

$message2 = $aubbc->script_escape($message2);

# Then save it to your database, extra security methods maybe required or desired
# depending on the type of backend used.......

}

sub display_data {
# Get the data from the backend lets say we did that and its in $message3
# use do_all_ubbc on $message3 and now $message3 is ready to be printed in HTML.
$message3 = $aubbc->do_all_ubbc($message3);

# Here you would want to print the propper HTML headers and elements with $message3 in it
# or return the variable, how ever you want to make it!!
}

examples/Mixing_HTML_and_BBcode.cgi  view on Meta::CPAN

# Since this gets into sandboxing the script_escape method you may want
# to play with settings for other view's or can skip the form feilds sandboxing
# the option 1 for script_escape is needed to not convert spaces, tab's, new lines

$form_data =~ s/(<aubbc>(?s)(.*?)<\/aubbc>)/
        my $ret = $aubbc->html_to_text( $2 );
        $ret ? '<aubbc>'.$ret."<\/aubbc>" : $1;
        /exg;
$form_data = $aubbc->script_escape( $form_data, 1 );

# Now $form_data can be printed in the form feild
# When the HTML form is submitted we fictitiously sent the edited data to editing_data2
# of this file to be saved
}

sub editing_data2 {
# Part 2 of editing data, you will need to use a module like CGI or what ever is out there
# to recive the HTML form data

# Before the HTML form data can be saved you will have to use the script_escape
# method with the regex on the variable that holds the HTML form data lets say its $message2

examples/Mixing_HTML_and_BBcode.cgi  view on Meta::CPAN

# depending on the type of backend used.......

}

sub display_data {
# Get the data from the backend lets say we did that and its in $message3
# use do_all_ubbc on $message3 and

$message3 = $aubbc->do_all_ubbc($message3);

# Before you print we want to remove the <aubbc> home made element
$message3 =~ s{\<\/?aubbc\>}{}g;

# now $message3 is ready to be printed in HTML.
# Here you would want to print the propper HTML headers and elements with $message3 in it
# or return the variable, how ever you want to make it!!
}

examples/bench.pl  view on Meta::CPAN

[sup]Sup[/sup][br]
[sub]Sub[/sub][br]
[pre]]Pre[[/pre] = [pre]Pre[/pre][br]
[img]]http://www.google.com/intl/en/images/about_logo.gif[[/img] =
[img]http://www.google.com/intl/en/images/about_logo.gif[/img][br][br]
[url=URL]]Name[[/url] = [url=http://www.google.com]http://www.google.com[/url][br]
http[utf://#58]//google.com = http://google.com[br]
[email]]Email[/email] = [email]some@email.com[/email] Recommended Not to Post your email in a public area[br]
[code]]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[[/code] =
[code]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[/code][br]
[c]]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[/c]] =
[c]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[/c][br]
[[c=My Code]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[/c]] =
[c=My Code]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[/c][br][br]
[quote]]Quote[/quote]] = [quote]Quote[/quote][br]
[quote=Flex]]Quote[/quote]] = [quote=Flex]Quote[/quote][br]
[color=Red]]Color[/color]] = [color=Red]Color[/color][br]
[blockquote]]Your Text here[[/blockquote] = [blockquote]Your Text here[/blockquote]
[[hr] = [hr]
[list]
[*=1]stuff
[*]stuff2
[*]stuff3
[/list]

examples/bench.pl  view on Meta::CPAN


my $pb = &create_pb;
my $bp = &create_bp;
my $hb = &create_hb;
my $bbr = &create_bbr;
my $au = &create_au;

# un-commit below to see each modules output

#my $rendered1 = $pb->render($code);
#print "Parse::BBCode\t$loaded{'Parse::BBCode'}\n$rendered1\n\n";

#my $tree = $bp->parse($code);
#my $rendered2 = $tree->toHTML();
#print "BP\t$loaded{'BBCode::Parser'}\n$rendered2\n\n";

#my $rendered3 = $hb->parse($code);
#print "HB\t$loaded{'HTML::BBCode'}\n$rendered3\n\n";

#my $rendered4 = $bbr->parse($code);
#print "BBR\t$loaded{'HTML::BBReverse'}\n$rendered4\n\n";

#my $rendered5 = $au->do_all_ubbc($code);
#print "AUBBC\t$loaded{AUBBC}\n$rendered5\n\n";


timethese($ARGV[0] || -1, {
    $loaded{'Parse::BBCode'} ?  (
        'P::B::new'  => \&create_pb,
        'P::B::x'  => sub { my $out = $pb->render($code) },
    ) : (),
    $loaded{'HTML::BBCode'} ?  (
        'H::B::new'  => \&create_hb,
        'H::B::x'  => sub { my $out = $hb->parse($code) },

examples/tag_list.cgi  view on Meta::CPAN

        );
  }

  $aubbc->add_build_tag(
        name     => 'time',
        pattern  => '',
        type     => 3,
        function => 'main::other_sites',
        );

# This is so eather the print_list sub will run or the js_print
# if this file was ran on a web server
        $ENV{'QUERY_STRING'}
                ? $aubbc->js_print()
                : print_list->();

sub print_list {
# The list
my $message = <<'HTML';
[br][b]The Very common UBBC Tags[/b][br]
[[b]Bold[[/b] = [b]Bold[/b][br]
[[strong]Strong[[/strong] = [strong]Strong[/strong][br]
[[small]Small[[/small] = [small]Small[/small][br]
[[big]Big[[/big] = [big]Big[/big][br]
[[h1]Head 1[[/h1] = [h1]Head 1[/h1][br]
through.....[br]
[[h6]Head 6[[/h6] = [h6]Head 6[/h6][br]

examples/tag_list.cgi  view on Meta::CPAN

[[sup]Sup[/sup]] = [sup]Sup[/sup][br]
[[sub]Sub[/sub]] = [sub]Sub[/sub][br]
[pre]]Pre[[/pre] = [pre]Pre[/pre][br]
[img]]http://www.google.com/intl/en/images/about_logo.gif[[/img] =
[img]http://www.google.com/intl/en/images/about_logo.gif[/img][br][br]
[url=URL]]Name[[/url] = [url=http://www.google.com]http://www.google.com[/url][br]
http[utf://#58]//google.com = http://google.com[br]
[email]]Email[/email] = [email]some@email.com[/email] Recommended Not to Post your email in a public area[br]
[code]]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[[/code] =
[code]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[/code][br]
[c]]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[/c]] =
[c]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[/c][br]
[[c=My Code]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[/c]] =
[c=My Code]# Some Code ......
my %hash = ( stuff => { '1' => 1, '2' => 2 }, );
print $hash{stuff}{'1'};[/c][br][br]
[quote]]Quote[/quote]] =[br]
[quote]Quote[/quote][br]
[quote=Flex]]Quote[/quote]] =[br]
[quote=Flex]Quote[/quote][br]
[blockquote]]Your Text here[[/blockquote] = [blockquote]Your Text here[/blockquote][br]
[ul]][li]].....[/li]][li]].....[/li]][li]].....[/li]][/ul]] =
[ul]
[li]a.....[/li]
[li]b.....[/li]
[li]c.....[/li]

examples/tag_list.cgi  view on Meta::CPAN

[[ws://Wikisource:About_Wikisource] or [wikisource://Wikisource:About_Wikisource] Wikisource[br]
[[cpan://Cpan] = [cpan://Cpan] Cpan Module Search[br]
[[time] = [time]
HTML

# replace the list with any error that may happen
$message = $aubbc->aubbc_error()
 ? $aubbc->aubbc_error()
 : $aubbc->do_all_ubbc($message);

print "Content-type: text/html\n\n";
print <<HTML;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AUBBC.pm Tag List</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<script type="text/javascript" src="?js_print">
</script>
<style type="text/css">
.codepost {
background-color: #ffffff;
 width: 80%;
 height: auto;
 white-space: nowrap;
 overflow: scroll;
 padding-left: 2px;
 padding-bottom: 5px;

test.pl  view on Meta::CPAN

# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'

######################### We start with some black magic to print on failure.

# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)

my ($count, $message, $setting, $aubbc, $Current_version, %msg) =
 (1, '[br][utf://#x23]', '', '', '', (1 => 'Test good ', 2 => 'Test error ',) );

BEGIN {
 $| = 1;
 print "Test's 1 to 4\n";
}

use AUBBC;
$aubbc = new AUBBC;
{
 # did it load?
 #$aubbc = ''; # main reinforce failure
 $aubbc
  ? print $msg{1} . "$count\n"
  : print $msg{2} . "$count\n";

 $aubbc->settings(html_type => 'xhtml') if $aubbc;
 $message = $aubbc->do_all_ubbc($message) if $aubbc;
 $setting = $aubbc->get_setting('html_type') if $aubbc;
 $Current_version = $aubbc->version() if $aubbc;

 $count++;
 # did it convert?
 #$message .= ']'; # reinforce failure
 $message !~ m/[\[\]\:]+/
  ? print $msg{1} . "$count\n"
  : print $msg{2} . "$count\n";
}

END {
 $count++;
 # did we get a setting?
 #$setting = 5; # reinforce failure
 $setting eq ' /'
  ? print $msg{1} . "$count\n"
  : print $msg{2} . "$count\n";

  $count++;
 # did we get the version?
 #$Current_version = 5; # reinforce failure
 $Current_version eq '4.06'
  ? print $msg{1} . "$count\n"
  : print $msg{2} . "$count\n";
}



( run in 0.364 second using v1.01-cache-2.11-cpan-de7293f3b23 )