What are the best-practices for implementing a CLI tool in Perl?

As a preface, I spent 3 years engineering and implementing a pretty complicated command line toolset in Perl for a major financial company. The ideas below are basically part of our team’s design guidelines. User Interface Command line option: allow as many as possible have default values. NO positional parameters for any command that has … Read more

How do I read in the contents of a directory in Perl?

opendir(D, “/path/to/directory”) || die “Can’t open directory: $!\n”; while (my $f = readdir(D)) { print “\$f = $f\n”; } closedir(D); EDIT: Oh, sorry, missed the “into an array” part: my $d = shift; opendir(D, “$d”) || die “Can’t open directory $d: $!\n”; my @list = readdir(D); closedir(D); foreach my $f (@list) { print “\$f = … Read more

Trying to install Perl-Mysql DBD, mysql_config can’t be found

If you installed the mysql server that everybody installs: sudo apt-get install mysql-server (or something like this) you are missing a few extra files on which the makefile for this perl module depends. You can try to work around this issue by installing the following package: sudo apt-get install libmysqlclient-dev REFERECE: http://cpansearch.perl.org/src/RUDY/DBD-mysql-2.9008/INSTALL.html#configuration

Shell script working fine without shebang line? Why? [duplicate]

The parent shell, where you entered ./myscript.sh, first tried to execve it, which is where the shebang line would take effect if present. When this works, the parent is unaware of the difference between scripts and ELFs because the kernel takes care of it. The execve failed, so an ancient unix compatibility feature, predating the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)