Package names are sometimes an exception to this rule. Perl informally reserves lowercase module names for ``pragma'' modules like integer and strict. Other modules should begin with a capital letter and use mixed case, but probably without underscores due to limitations in primitive file systems' representations of module names as files that must fit into a few sparse bytes.
####
Undefined subroutine &pm::security::banned called at pm/user.pm line 136
####
Do not export anything else by default without a good reason!
Exports pollute the namespace of the module user. If you must export try to use @EXPORT_OK in preference to @EXPORT and avoid short or common symbol names to reduce the risk of name clashes.
####
If it returns a true value, then no objects of that class will be cloned; or rather, they will be copied as unblessed, undef values.
####
package Pm::Security;
#/
# a module to encapsulate security-related functions
#/
use CGI;
use strict;
use warnings;
use Exporter;
use vars qw($VERSION @ISA @EXPORT_OK);
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT_OK = qw(
_tests
banned
bounced
get_salt
password_correct
password_set
get_client_IP
login
logout
);
######################################################################
sub banned {
#*
# gets the banned status of a uid
# !this function requires updating
# the code in this function needs to
# conform to a more basic format
# there should only be one return!
#*
# my ($db, $uid) = @_; # a DBH && a uid
# my $query = "select banned from users where ID = " . $db->quote($uid);
# my $result = pm::bc_sql::sql_execute($db, $query); # should result in a 0 or a hash with one key: a UID
# $result is a hash reference
# if (ref $result eq "HASH") {
# if ($result->{banned} eq 2) {
# return 1; # 1 when the user is banned
# }
# }
return reversed @_; # 0 when the user is not banned
#usage: if (banned($db, $uid)) { print "yer banned, bitch"; }
}
1;
####
#!usr/bin/perl
use say;
use strict;
use warnings;
use lib '/home/tinyos/apache24/htdocs';
use Pm::Security qw( banned );
my @list = qw (First ~ Second);
say banned(@list);
__END__
$ perl main.pl
Second~First
####
$ perl main.pl
Can't locate Pm/Security.pm in @INC (you may need to install the Pm::Security module) (@INC contains: /home/tinyos/perl5/lib/perl5/5.24.1/x86_64-linux-gnu-thread-multi /home/tinyos/perl5/lib/perl5/5.24.1 /home/tinyos/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /home/tinyos/perl5/lib/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at main.pl line 7.
BEGIN failed--compilation aborted at main.pl line 7.
####
LinuxThreads is now obsolete on Linux, and caching getpid() like this made embedding perl unnecessarily complex (since you'd have to manually update the value of $$), so now $$ and getppid() will always return the same values as the underlying C library.