ycdsb first class
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 4985
DB_cart Class 1.13
DB_cart Class is a MySQL shopping cart script that can be used with third party product catalogues and membership systems. more>>
DB_cart Class is a MySQL shopping cart script that can be used with third party product catalogues and membership systems. The MySQL database structure is neutral to existing systems.
DB_cart Class can handle the shopping cart (add, update, and empty) and checkout process (set the shipment address and email the order).
For existing cart users, the shopping cart is still available upon the users next visit and is visible by checkout. The last option is configurable togther with a time period.
Enhancements:
- There are modifications and improvements inside the main class file, several examples, and the table structure has been extended.
- There two additional fields for the shipment values (name2 and address2).
- All messages are available in German, English, and Dutch.
- The standard text inside the email messages is in external files now; this content is parsed inside the improved email method.
<<lessDB_cart Class can handle the shopping cart (add, update, and empty) and checkout process (set the shipment address and email the order).
For existing cart users, the shopping cart is still available upon the users next visit and is visible by checkout. The last option is configurable togther with a time period.
Enhancements:
- There are modifications and improvements inside the main class file, several examples, and the table structure has been extended.
- There two additional fields for the shipment values (name2 and address2).
- All messages are available in German, English, and Dutch.
- The standard text inside the email messages is in external files now; this content is parsed inside the improved email method.
Download (0.035MB)
Added: 2006-06-16 License: BSD License Price:
1227 downloads
Calendario Class 1.0
Calendario Class provides a PHP class that is useful for creating calendars and organizers. more>>
Calendario Class provides a PHP class that is useful for creating calendars and organizers.
Calendario Class is a PHP class that helps you to create calendar and organizers.
Its highly configurable, letting you choose how many days are in a week, when a week starts, the details of the HTML output, and so on.
It also knows about holidays.
Enhancements:
- Added holidays functionality
<<lessCalendario Class is a PHP class that helps you to create calendar and organizers.
Its highly configurable, letting you choose how many days are in a week, when a week starts, the details of the HTML output, and so on.
It also knows about holidays.
Enhancements:
- Added holidays functionality
Download (0.096MB)
Added: 2007-03-16 License: LGPL (GNU Lesser General Public License) Price:
956 downloads
Access_user Class 1.92
Access_user Class is an easy to use system for protecting pages and registering users. more>>
Access_user Class is an easy to use system for protecting pages and registering users. The main features are user login, user registration, page protection, forgotten password recovery, and email-based account activation.
The class is powered by MySQL and PHP sessions. Inside the package are examples for all primary methods.
Enhancements:
- Its now possible to store the session data in your database.
- This is much safer if you use sessions on a shared hosting server.
- The password is always encoded with MD5 now.
- session_destroy() was added to the logout method.
- The links used in the email messages are now double MD5-encoded.
<<lessThe class is powered by MySQL and PHP sessions. Inside the package are examples for all primary methods.
Enhancements:
- Its now possible to store the session data in your database.
- This is much safer if you use sessions on a shared hosting server.
- The password is always encoded with MD5 now.
- session_destroy() was added to the logout method.
- The links used in the email messages are now double MD5-encoded.
Download (0.036MB)
Added: 2006-10-20 License: GPL (GNU General Public License) Price:
1100 downloads
PHP Greeting card class 1.1
PHP Greeting card class can be used to compose and send greeting cards by email. more>>
PHP Greeting card class can be used to compose and send greeting cards by email.
PHP Greeting card class can compose and send an email message with a greeting either in text, in HTML with an image, or in HTML with Flash content.
The HTML version of the card may include a greeting picture.
<<lessPHP Greeting card class can compose and send an email message with a greeting either in text, in HTML with an image, or in HTML with Flash content.
The HTML version of the card may include a greeting picture.
Download (0.95MB)
Added: 2006-12-21 License: GPL (GNU General Public License) Price:
1043 downloads
PHP ImageMagick Class 1.0
PHP ImageMagick Class is a class for processing images with ImageMagick. more>>
PHP ImageMagick Class is a class for processing images with ImageMagick. This PHP Class makes it possible to process images in a very easy way.
To scale an image to 640x480 when its bigger youy can do this:
include(imagemagick.class.php);
$im = new Imagemagick($targetdir);
$im->Resize(640, 480, keep_aspect);
$im->Save();
$im->CleanUp();
?>
Enhancements:
- retrieve image data
- flip
- dither
- monochrome
- negate
- rotate
- blur
- draw frame
- resize
- square
- crop
- convert
- save
<<lessTo scale an image to 640x480 when its bigger youy can do this:
include(imagemagick.class.php);
$im = new Imagemagick($targetdir);
$im->Resize(640, 480, keep_aspect);
$im->Save();
$im->CleanUp();
?>
Enhancements:
- retrieve image data
- flip
- dither
- monochrome
- negate
- rotate
- blur
- draw frame
- resize
- square
- crop
- convert
- save
Download (0.005MB)
Added: 2006-07-14 License: GPL (GNU General Public License) Price:
712 downloads
Exception::Class 1.23
Exception::Class is a Perl module that allows you to declare real exception classes in Perl. more>>
Exception::Class is a Perl module that allows you to declare real exception classes in Perl.
SYNOPSIS
use Exception::Class
( MyException,
AnotherException =>
{ isa => MyException },
YetAnotherException =>
{ isa => AnotherException,
description => These exceptions are related to IPC },
ExceptionWithFields =>
{ isa => YetAnotherException,
fields => [ grandiosity, quixotic ],
alias => throw_fields,
},
);
# try
eval { MyException->throw( error => I feel funny. ) };
my $e;
# catch
if ( $e = Exception::Class->caught(MyException) )
{
warn $e->error, "n", $e->trace->as_string, "n";
warn join , $e->euid, $e->egid, $e->uid, $e->gid, $e->pid, $e->time;
exit;
}
elsif ( $e = Exception::Class->caught(ExceptionWithFields) )
{
$e->quixotic ? do_something_wacky() : do_something_sane();
}
else
{
$e = Exception::Class->caught();
ref $e ? $e->rethrow : die $e;
}
# use an alias - without parens subroutine name is checked at
# compile time
throw_fields error => "No strawberry", grandiosity => "quite a bit";
Exception::Class allows you to declare exception hierarchies in your modules in a "Java-esque" manner.
It features a simple interface allowing programmers to declare exception classes at compile time. It also has a base exception class, Exception::Class::Base, that can be easily extended.
It is designed to make structured exception handling simpler and better by encouraging people to use hierarchies of exceptions in their applications, as opposed to a single catch-all exception class.
This module does not implement any try/catch syntax. Please see the "OTHER EXCEPTION MODULES (try/catch syntax)" section for more information on how to get this syntax.
<<lessSYNOPSIS
use Exception::Class
( MyException,
AnotherException =>
{ isa => MyException },
YetAnotherException =>
{ isa => AnotherException,
description => These exceptions are related to IPC },
ExceptionWithFields =>
{ isa => YetAnotherException,
fields => [ grandiosity, quixotic ],
alias => throw_fields,
},
);
# try
eval { MyException->throw( error => I feel funny. ) };
my $e;
# catch
if ( $e = Exception::Class->caught(MyException) )
{
warn $e->error, "n", $e->trace->as_string, "n";
warn join , $e->euid, $e->egid, $e->uid, $e->gid, $e->pid, $e->time;
exit;
}
elsif ( $e = Exception::Class->caught(ExceptionWithFields) )
{
$e->quixotic ? do_something_wacky() : do_something_sane();
}
else
{
$e = Exception::Class->caught();
ref $e ? $e->rethrow : die $e;
}
# use an alias - without parens subroutine name is checked at
# compile time
throw_fields error => "No strawberry", grandiosity => "quite a bit";
Exception::Class allows you to declare exception hierarchies in your modules in a "Java-esque" manner.
It features a simple interface allowing programmers to declare exception classes at compile time. It also has a base exception class, Exception::Class::Base, that can be easily extended.
It is designed to make structured exception handling simpler and better by encouraging people to use hierarchies of exceptions in their applications, as opposed to a single catch-all exception class.
This module does not implement any try/catch syntax. Please see the "OTHER EXCEPTION MODULES (try/catch syntax)" section for more information on how to get this syntax.
Download (0.016MB)
Added: 2007-05-23 License: Perl Artistic License Price:
884 downloads
PHP Date Picker Class 1.0.5
PHP Date Picker Class will automatically generate the required HTML and JavaScript code. more>>
PHP Date Picker Class library will automatically generate the required HTML and JavaScript code that will make a pop-up window appear to let the user choose a date from a calendar. The selected date will be passed to a user-specified control from the calling page.
Every aspect is customizable by modifying a template and a related CSS file. The format in which the date is returned, the default date and time period, and the first day of the week can be selected.
Many thanks to Johan van Ieperen for sending in the dutch translation for the PHP class and for the valuable comments he made for improving usability, to Achim from Germany for finding the bug that would screw up the calendar on certain situations and also thank to Wassilios Meletiadis for sending in the german translation for this PHP class.
Further suggestions, comments and requests are welcommed. Id also really appreciate if you could send me links to the web pages where you are using the class so I can give them as refference and convince more people to use it. Thanks!
Enhancements:
- The selected date and time were not preserved if the month or year were changed.
- Using any date format other than the default would cause all dates to be disabled everywhere.
- A potential problem with selectableYearsRange and selectableTimesRange was fixed.
- The cause of the problem was the fact that PHPs date() function returns a string and therefore date("Y") would return the current date as a string rather than an integer, which made the calendar unusable.
<<lessEvery aspect is customizable by modifying a template and a related CSS file. The format in which the date is returned, the default date and time period, and the first day of the week can be selected.
Many thanks to Johan van Ieperen for sending in the dutch translation for the PHP class and for the valuable comments he made for improving usability, to Achim from Germany for finding the bug that would screw up the calendar on certain situations and also thank to Wassilios Meletiadis for sending in the german translation for this PHP class.
Further suggestions, comments and requests are welcommed. Id also really appreciate if you could send me links to the web pages where you are using the class so I can give them as refference and convince more people to use it. Thanks!
Enhancements:
- The selected date and time were not preserved if the month or year were changed.
- Using any date format other than the default would cause all dates to be disabled everywhere.
- A potential problem with selectableYearsRange and selectableTimesRange was fixed.
- The cause of the problem was the fact that PHPs date() function returns a string and therefore date("Y") would return the current date as a string rather than an integer, which made the calendar unusable.
Download (0.063MB)
Added: 2007-03-05 License: Free for non-commercial use Price:
984 downloads
Cgiapp.class.php 2.0.0
Cgiapp.class.php is a port of CGI::Application to PHP. more>>
Cgiapp.class.php is a port of CGI::Application to PHP. Cgiapp.class.php utilizes Smarty as its default templating engine, much as CGI::Application uses HTML::Template, due to its prevalence and acceptance in the PHP community.
Due to PHPs built-in session support, it also adds two methods, s_param() and s_delete(), to handle session parameters.
A number of static methods have also been included to facilitate error handling and array/hash conversion.
<<lessDue to PHPs built-in session support, it also adds two methods, s_param() and s_delete(), to handle session parameters.
A number of static methods have also been included to facilitate error handling and array/hash conversion.
Download (0.16MB)
Added: 2006-06-05 License: GPL (GNU General Public License) Price:
1236 downloads
KinoSearch::Util::Class 0.13
KinoSearch::Util::Class is a Perl class building utility. more>>
KinoSearch::Util::Class is a Perl class building utility.
PRIVATE CLASS
This is a private class and the interface may change radically and without warning. Do not use it on its own.
SYNOPSIS
package KinoSearch::SomePackage::SomeClass;
use base qw( KinoSearch::Util::Class );
BEGIN {
__PACKAGE__->init_instance_vars(
# constructor params / members
foo => undef,
bar => {},
# members
baz => {},
);
}
KinoSearch::Util::Class is a class-building utility a la Class::Accessor, Class::Meta, etc. It provides four main services:
- A mechanism for inheriting instance variable declarations.
- A constructor with basic argument checking.
- Manufacturing of get_xxxx and set_xxxx methods.
- Convenience methods which help in defining abstract classes.
<<lessPRIVATE CLASS
This is a private class and the interface may change radically and without warning. Do not use it on its own.
SYNOPSIS
package KinoSearch::SomePackage::SomeClass;
use base qw( KinoSearch::Util::Class );
BEGIN {
__PACKAGE__->init_instance_vars(
# constructor params / members
foo => undef,
bar => {},
# members
baz => {},
);
}
KinoSearch::Util::Class is a class-building utility a la Class::Accessor, Class::Meta, etc. It provides four main services:
- A mechanism for inheriting instance variable declarations.
- A constructor with basic argument checking.
- Manufacturing of get_xxxx and set_xxxx methods.
- Convenience methods which help in defining abstract classes.
Download (0.21MB)
Added: 2006-09-02 License: Perl Artistic License Price:
1147 downloads
WebServerInfo PHP class 1.0.0
WebServerInfo PHP class is intended for developer who create software that will run on different web servers. more>>
WebServerInfo PHP class is intended for developer who create software that will run
on different web servers. The project gives a developer a consistent interface
for accessing web servers variables.
Usage:
You have following options:
Option #1
require_once("WebServerInfo.class.php");
$obj = new WebServerInfo();
print $_SERVER[DOCUMENT_ROOT];
Option #2
require_once("WebServerInfo.class.php");
$obj = new WebServerInfo();
print $obj->get(DOCUMENT_ROOT);
Option #3
uncomment the 3rd line from WebServerInfo.class.php
and all you have to do is require the WebServerInfo.class.php class.
Note:
The constructor of WebServerInfo class overrides $_SERVER variable and
variables can be accessed as usual way.
Following base variables are exported if they do not exist.
REQUEST_URI
REDIRECT_URL
DOCUMENT_ROOT
SERVER_SIGNATURE
SERVER_ADDR
SCRIPT_FILENAME
<<lesson different web servers. The project gives a developer a consistent interface
for accessing web servers variables.
Usage:
You have following options:
Option #1
require_once("WebServerInfo.class.php");
$obj = new WebServerInfo();
print $_SERVER[DOCUMENT_ROOT];
Option #2
require_once("WebServerInfo.class.php");
$obj = new WebServerInfo();
print $obj->get(DOCUMENT_ROOT);
Option #3
uncomment the 3rd line from WebServerInfo.class.php
and all you have to do is require the WebServerInfo.class.php class.
Note:
The constructor of WebServerInfo class overrides $_SERVER variable and
variables can be accessed as usual way.
Following base variables are exported if they do not exist.
REQUEST_URI
REDIRECT_URL
DOCUMENT_ROOT
SERVER_SIGNATURE
SERVER_ADDR
SCRIPT_FILENAME
Download (0.013MB)
Added: 2006-11-22 License: LGPL (GNU Lesser General Public License) Price:
1067 downloads
TagCloud Maker Class 1.0
TagCloud Maker Class is a class that takes a single dimensional array of terms and outputs a piece of HTML with each term. more>>
TagCloud Maker Class is a class that takes a single dimensional array of terms and outputs a piece of HTML with each term wrapped in a span tag with an ID that you can define in your CSS.
TagCloud Maker Class script can be called either as an object or as a static class.
Check out the example page. The keywords from the sample page come from the last 30 entries of my blog. Ill admit I cheated and just open the database and pull them from there instead of trying to call my blog w/curl or fopen and parse it. (Although that would have been cooler.) I then ran each blog entry against Yahoos Term Extraction API to get the terms. Then I pumped that array into my new TagCloud maker. The important code you cant see from the index.php is below.
require_once(TagCloud.php);
$x = TagCloud::fetch_cloud($thisArray,...,tagcloud_,http://www.technorati.com/tags/%s);
$o = new TagCloud($thisArray,...,tagcloud_,http://www.technorati.com/tags/%s,10,weight,2);
$o->get_cloud();
$y = $o->output_cloud;
As you can see, I used 2 different methods of creating the 2 lists. The first is just calling the object::method statically with all the necessary parameters. This is by far the easiest way to use this class and unless you need something special, its the way I recommend. The second way it to instantiate an object. I pass all the variables into the constructor but you could just as easily use the setters to set them all. (dont know why you would but hey, I spent an extra 15 minutes creating getters and setters so use them, by all means use them!)
<<lessTagCloud Maker Class script can be called either as an object or as a static class.
Check out the example page. The keywords from the sample page come from the last 30 entries of my blog. Ill admit I cheated and just open the database and pull them from there instead of trying to call my blog w/curl or fopen and parse it. (Although that would have been cooler.) I then ran each blog entry against Yahoos Term Extraction API to get the terms. Then I pumped that array into my new TagCloud maker. The important code you cant see from the index.php is below.
require_once(TagCloud.php);
$x = TagCloud::fetch_cloud($thisArray,...,tagcloud_,http://www.technorati.com/tags/%s);
$o = new TagCloud($thisArray,...,tagcloud_,http://www.technorati.com/tags/%s,10,weight,2);
$o->get_cloud();
$y = $o->output_cloud;
As you can see, I used 2 different methods of creating the 2 lists. The first is just calling the object::method statically with all the necessary parameters. This is by far the easiest way to use this class and unless you need something special, its the way I recommend. The second way it to instantiate an object. I pass all the variables into the constructor but you could just as easily use the setters to set them all. (dont know why you would but hey, I spent an extra 15 minutes creating getters and setters so use them, by all means use them!)
Download (0.012MB)
Added: 2006-01-25 License: GPL (GNU General Public License) Price:
1380 downloads
Perl6::Classes 0.22
Perl6::Classes project contains first class classes in Perl 5. more>>
Perl6::Classes project contains first class classes in Perl 5.
SYNOPSIS
use Perl6::Classes;
class Composer {
submethod BUILD { print "Giving birth to a new composern" }
method compose { print "Writing some music...n" }
}
class ClassicalComposer is Composer {
method compose { print "Writing some muzak...n" }
}
class ModernComposer is Composer {
submethod BUILD($) { $.length = shift }
method compose() { print((map { int rand 10 } 1..$.length), "n") }
has $.length;
}
my $beethoven = new ClassicalComposer;
my $barber = new ModernComposer 4;
my $mahler = ModernComposer->new(400);
$beethoven->compose; # Writing some muzak...
$barber->compose # 7214
compose $mahler; # 89275869347968374698756....
Perl6::Classes allows the creation of (somewhat) Perl 6-style classes in Perl 5. The following features are currently supported:
subs, methods, and submethods
And their respective scoping rules.
Attributes
Which are available through the has keyword, and look like $.this.
Inheritance
Both single and multiple inheritance are available through the is keyword.
Signatures
Signatures on methods, subs, and submethods are supported, but just the Perl 5 kind.
Data hiding
Using the public, protected, and private traits, you can enforce (run-time) data hiding. This is not supported on attributes, which are always private.
Anonymous classes
That respect closures. You can now nest them inside methods of other classes, even other anonymous ones!
The Perl6::Classes module augments Perls syntax with a new declarator: class. It offers the advantage over Perls standard OO mechanism that it is conceptually easier to see (especially for those from a C++/Java background). It offers the disadvantage, of course, of being less versatile.
<<lessSYNOPSIS
use Perl6::Classes;
class Composer {
submethod BUILD { print "Giving birth to a new composern" }
method compose { print "Writing some music...n" }
}
class ClassicalComposer is Composer {
method compose { print "Writing some muzak...n" }
}
class ModernComposer is Composer {
submethod BUILD($) { $.length = shift }
method compose() { print((map { int rand 10 } 1..$.length), "n") }
has $.length;
}
my $beethoven = new ClassicalComposer;
my $barber = new ModernComposer 4;
my $mahler = ModernComposer->new(400);
$beethoven->compose; # Writing some muzak...
$barber->compose # 7214
compose $mahler; # 89275869347968374698756....
Perl6::Classes allows the creation of (somewhat) Perl 6-style classes in Perl 5. The following features are currently supported:
subs, methods, and submethods
And their respective scoping rules.
Attributes
Which are available through the has keyword, and look like $.this.
Inheritance
Both single and multiple inheritance are available through the is keyword.
Signatures
Signatures on methods, subs, and submethods are supported, but just the Perl 5 kind.
Data hiding
Using the public, protected, and private traits, you can enforce (run-time) data hiding. This is not supported on attributes, which are always private.
Anonymous classes
That respect closures. You can now nest them inside methods of other classes, even other anonymous ones!
The Perl6::Classes module augments Perls syntax with a new declarator: class. It offers the advantage over Perls standard OO mechanism that it is conceptually easier to see (especially for those from a C++/Java background). It offers the disadvantage, of course, of being less versatile.
Download (0.007MB)
Added: 2007-06-08 License: Perl Artistic License Price:
868 downloads
DBIx::Class::CDBICompat 0.07002
DBIx::Class::CDBICompat is a Class::DBI Compatibility layer. more>>
DBIx::Class::CDBICompat is a Class::DBI Compatibility layer.
SYNOPSIS
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/CDBICompat Core DB/);
DBIx::Class features a fully featured compatibility layer with Class::DBI to ease transition for existing CDBI users. In fact, this class is just a receipe containing all the features emulated. If you like, you can choose which features to emulate by building your own class and loading it like this:
__PACKAGE__->load_own_components(qw/CDBICompat/);
this will automatically load the features included in My::DB::CDBICompat, provided it looks something like this:
package My::DB::CDBICompat;
__PACKAGE__->load_components(qw/
CDBICompat::ColumnGroups
CDBICompat::Retrieve
CDBICompat::HasA
CDBICompat::HasMany
CDBICompat::MightHave
/);
<<lessSYNOPSIS
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/CDBICompat Core DB/);
DBIx::Class features a fully featured compatibility layer with Class::DBI to ease transition for existing CDBI users. In fact, this class is just a receipe containing all the features emulated. If you like, you can choose which features to emulate by building your own class and loading it like this:
__PACKAGE__->load_own_components(qw/CDBICompat/);
this will automatically load the features included in My::DB::CDBICompat, provided it looks something like this:
package My::DB::CDBICompat;
__PACKAGE__->load_components(qw/
CDBICompat::ColumnGroups
CDBICompat::Retrieve
CDBICompat::HasA
CDBICompat::HasMany
CDBICompat::MightHave
/);
Download (0.17MB)
Added: 2006-10-24 License: Perl Artistic License Price:
1096 downloads
PHP Advanced Graphing Class 1.4
PHP Advanced Graphing Class is a PHP class that can be used to generate line, bar, and 2D/3D pie graphs. more>>
PHP Advanced Graphing Class is a PHP class that can be used to generate line, bar, and 2D/3D pie graphs from multiple data sets. PHP Advanced Graphing Class offers many style and data formatting options.
The graphs can be built from data defined with PHP code or with data imported from XML or CSV files. It can use custom colors, custom data point shapes or images, custom end arrows, an optional inline format, a custom graph scale, etc.
The graphs can be generated in PNG format either to a file or served as the current script output.
Enhancements:
- Bar charts and 2D/3D pie charts were added.
<<lessThe graphs can be built from data defined with PHP code or with data imported from XML or CSV files. It can use custom colors, custom data point shapes or images, custom end arrows, an optional inline format, a custom graph scale, etc.
The graphs can be generated in PNG format either to a file or served as the current script output.
Enhancements:
- Bar charts and 2D/3D pie charts were added.
Download (MB)
Added: 2006-04-10 License: Public Domain Price:
1298 downloads
Exception::Class::TCF 0.03
Exception::Class::TCF is a Java/C++ style exception handling. more>>
Exception::Class::TCF is a Java/C++ style exception handling.
SYNOPSIS
try BLOCK [ [catch] NAME FUN_REF ]*
throw [ EXCEPTION LIST ]
package EnclosureException;
@ISA = qw(Exception::Class::TCF);
package main;
use Exception::Class::TCF;
try {
if ($Lost) {
throw new EnclosureException Message => "Help!";
}
else {
throw Error;
}
}
catch EnclosureException => sub {
warn "Message ",$_[0]->message," received.n"
},
Default => sub {
warn $_[0]->type, " exception ignored, trace:", $_[0]->trace
};
The Exception::Class::TCF module provides the possibility of executing a code block and specifying actions when different exceptions are raised. The try function takes as its argument a code block followed by a list of pairs of exception package names and function references, representing the action to take if a subclass of that package is raised. To increase readability the keyword catch may be inserted before any name-action pair. The return value of try is the return value of the block if no exception is thrown and the return value of the action of the chosen action in case one is found.
Even though the builtin die is used in the implementation any explicit use of die within the dynamic scope is ignored by the exception mechanism and thus works as usual. On the other hand an eval block will catch a thrown exception if it has not been caught by a try block. The clean-up routines after such a block may call throw as in the next section.
How to create an exception context.
An exception context in which thrown exceptions are handled is created using try as in
try { throw Error }
catch Default => sub { warn "Wow" };
The first argument is a code block (or a function reference). It will be referred to as a try block and any code executed inside it (including psossibly nested calls of functions in it) will be said to be in the dynamic scope of the block. After the try block follows a sequence of exception name - handling code pairs. The name will be referred to as the exception key and the corresponding code the handler (or catch handler) for that key.
An exception is either the name of a package inheriting from the package Exception::Class::TCF or an object blessed in such a package. In both cases the name of the package will be referred to as the name of the exception. All exception keys has to be names of exceptions except the special exception key Default which is the name for exceptions of package Exception::Class::TCF. In order not to clutter package name space, package names are normally prefixed by the Exception::Class::TCF:: prefix. To increase readability this prefix may be removed in exception key names and when calling throw with a package name as first argument.
The exception key may also be the string Finally. This does not correspond to an exception but instead its handler will be called just before the try function returns. Its value will be ignored however.
As new is a virtual function it can not be called with these shortened package names. For this on can use Exception::Class::TCF::make instead.
<<lessSYNOPSIS
try BLOCK [ [catch] NAME FUN_REF ]*
throw [ EXCEPTION LIST ]
package EnclosureException;
@ISA = qw(Exception::Class::TCF);
package main;
use Exception::Class::TCF;
try {
if ($Lost) {
throw new EnclosureException Message => "Help!";
}
else {
throw Error;
}
}
catch EnclosureException => sub {
warn "Message ",$_[0]->message," received.n"
},
Default => sub {
warn $_[0]->type, " exception ignored, trace:", $_[0]->trace
};
The Exception::Class::TCF module provides the possibility of executing a code block and specifying actions when different exceptions are raised. The try function takes as its argument a code block followed by a list of pairs of exception package names and function references, representing the action to take if a subclass of that package is raised. To increase readability the keyword catch may be inserted before any name-action pair. The return value of try is the return value of the block if no exception is thrown and the return value of the action of the chosen action in case one is found.
Even though the builtin die is used in the implementation any explicit use of die within the dynamic scope is ignored by the exception mechanism and thus works as usual. On the other hand an eval block will catch a thrown exception if it has not been caught by a try block. The clean-up routines after such a block may call throw as in the next section.
How to create an exception context.
An exception context in which thrown exceptions are handled is created using try as in
try { throw Error }
catch Default => sub { warn "Wow" };
The first argument is a code block (or a function reference). It will be referred to as a try block and any code executed inside it (including psossibly nested calls of functions in it) will be said to be in the dynamic scope of the block. After the try block follows a sequence of exception name - handling code pairs. The name will be referred to as the exception key and the corresponding code the handler (or catch handler) for that key.
An exception is either the name of a package inheriting from the package Exception::Class::TCF or an object blessed in such a package. In both cases the name of the package will be referred to as the name of the exception. All exception keys has to be names of exceptions except the special exception key Default which is the name for exceptions of package Exception::Class::TCF. In order not to clutter package name space, package names are normally prefixed by the Exception::Class::TCF:: prefix. To increase readability this prefix may be removed in exception key names and when calling throw with a package name as first argument.
The exception key may also be the string Finally. This does not correspond to an exception but instead its handler will be called just before the try function returns. Its value will be ignored however.
As new is a virtual function it can not be called with these shortened package names. For this on can use Exception::Class::TCF::make instead.
Download (0.011MB)
Added: 2007-06-05 License: Perl Artistic License Price:
872 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above ycdsb first class search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed