RoPkg:...eptions(3pm)

πŸ“¦ version 0.4, in ubuntu jammy

πŸ’– RoPkg::Exceptions β€” the perl manpage, but make it cute ✨

okay bestie, this is RoPkg::Exceptions(3pm) from the User Contributed Perl Documentation corner of the internet, and we're about to have a whole moment about it. sit down, grab a strawberry πŸ“, let's go.


🌸 NAME 🌸

RoPkg::Exceptions β€” exceptions used by RoPkg packages πŸ’…


✨ DESCRIPTION ✨

So basically RoPkg::Exceptions is a collection of predefined exceptions used by all the modules from the RoPkg namespace. it's the shared emotional support exception library of the family, no cap 🫢


πŸŽ€ SYNOPSIS πŸŽ€

here's the vibe, verbatim, don't touch anything:

#!/usr/bin/perl

use strict;
use warnings;

use RoPkg::Exceptions;

sub main {
  eval {
    if ( $#ARGV == -1 ) {
      Param::Missing->throw('No parameter found');
    }
  };

  if ( my $e = Exception::Class->caught('Param::Missing') ) {
    print STDERR $e->message,$/,$e->trace,$/;
  }
}

main();

ngl, it is very possible that you don't find a good reason for using exceptions from this example. and you are right β€” this example is kind of silly πŸ™ˆ. but bestie, try to use exceptions in a real project. then you will apreciate their real value. trust. πŸ”₯


πŸ¦‹ DEPENDENCIES πŸ¦‹

RoPkg::Exceptions requires:

  • perl 5.008 or later
  • the Exception::Class module

that's it, that's the whole guest list ✨


πŸ‘‘ Exceptions List πŸ‘‘

the following exceptions are defined in this class, and yes we're doing all of them:

  • General β€” general pourpose exception 🌈
  • OutsideClass β€” raised when a method is called outside a class instance πŸ’€
  • File β€” the base for all file related exceptions. this exception has the filename parameter, who can be used to specify the path to the file. filename parameter can be used by all derivated exceptions. the following exceptions are derivated from File:
    • File::NotFound β€” the file was not found 😭
    • File::Open β€” error while opening file πŸ™ˆ
    • File::Create β€” could not create file
  • Dir β€” the base for all directory related exceptions. this exception has the dirname parameter, who can be used to specify the path to the directory. dirname parameter can be used by all derivated exceptions. the following exceptions are derivated from Dir:
    • Dir::NotFound β€” the directory was not found 😭
    • Dir::Open β€” error while opening directory πŸ™ˆ
    • Dir::Create β€” could not create directory
  • Param β€” the base for all parameters related exceptions. this exception has the name parameter, who can be used to specify the parameter name. name can be used by all derivated exceptions. the following exceptions are derivated from Param:
    • Param::Missing β€” the parameter was not found
    • Param::Unknown β€” the parameter is unknown
    • Param::Wrong β€” the parameter has the wrong value or is not defined
  • DB β€” the base for all database related exceptions. this exception has the following parameters: dsn, user and pass. this exception (and the ones derivated from her) are mostly used in RoPkg::DB class. of course, this doesn't means that you can't use them in your application ;) .The following exceptions are derivated from DB:
    • DB::Connect β€” raised when the connection with the database could not be established πŸ”Œ
    • DB::ConnExists β€” raised when a connection with the same name already exists. πŸ‘―
    • DB::ConnNotFound β€” the requested connection was not found
    • DB::NoResults β€” the sql query returned no results πŸ’€

🧚 Exceptions Tree 🧚

look at the family tree, it's giving ancestral slay:

ROOT
  General
  OutsideClass
  File
         File::NotFound
         File::Open
         File::Create
  Dir
         Dir::NotFound
         Dir::Open
         Dir::Create
  Param
         Param::Missing
         Param::Unknown
         Param::Wrong
  DB
         DB::Connect
         DB::ConnExists
         DB::ConnNotFound
         DB::NoResults

🌈 SEE ALSO 🌈

  • RoPkg::Utils

go read that one too bestie, it's the sibling πŸ’œ


πŸ’œ AUTHOR πŸ’œ

Subredu Manuel <diablo@iasi.roedu.net> πŸ‘‘


⭐ VERSION ⭐

the current version is 0.2.1 πŸŽ€


πŸ”₯ DIAGNOSTICS πŸ”₯

the tests for this module are located in t directory. to run those tests, use the following command:

make test

and then watch them pass. iconic behaviour only ✨


πŸ’… SUBROUTINES/METHODS πŸ’…

this module does not have any public methods. it's mysterious. it's lowkey main character energy. it simply is πŸ¦‹


🫢 INCOMPATIBILITIES 🫢

None known to me 🀷


πŸŽ€ PERL CRITIC πŸŽ€

this module is perl critic level 1 compliant with 1 exception. so close to perfect, honestly relatable πŸ’€


😭 BUGS AND LIMITATIONS 😭

No known bugs. if you find one (or many) please send me a detailed report. and bestie, be detailed, don't just say "it's broken" πŸ™


🌸 CONFIGURATION AND ENVIRONMENT 🌸

No configuration file or environment variables are used by this module. nothing to set up, nothing to export, just vibes ✨


Copyright (C) 2005 Subredu Manuel. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The LICENSE file contains the full text of the license. periodt. πŸ’…


and that's the whole page, bestie 🫢 this was RoPkg::Exceptions(3pm), rendered by perl v5.32.1 on 2021-12-26. mwah πŸ’‹ πŸŽ€
πŸ“¦ where this page comes from