UPWORK/ODESK guru: Tips and Tricks for clients

skype: odesk.by / upwork.link , email: info@odesk.by/upwork.link

Archive for the ‘Perl’ Category

Backup of Directories, version 3.5 – perl script for backup copies of directories of sites of WEB server.

without comments

Example of configuration:

work directory:

/etc/file_backup

Read the rest of this entry »

Written by spectre

March 26th, 2015 at 8:56 pm

Posted in Perl

Perl: process monitoring

without comments

Written by spectre

December 30th, 2014 at 12:00 pm

Posted in Perl

Rebuild Perl on a cPanel Server

without comments

Every now and again perl will become broken or corrupt either because of something we’ve done or, like most things, out of nowhere with now warning. Run the following:

Read the rest of this entry »

Written by spectre

April 16th, 2014 at 3:09 pm

Posted in Perl

Perl does not work because suexec denies execution

without comments

Short solution.

If you have for example:

[root@server]# suexec -V
-D AP_DOC_ROOT=”/var/www” <<<<<<<<<<<<<<<<<<<<<<<< correct place for suexec scripts -D AP_GID_MIN=100 -D AP_HTTPD_USER="apache" -D AP_LOG_EXEC="/var/log/httpd/suexec.log" -D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin" -D AP_UID_MIN=500 -D AP_USERDIR_SUFFIX="public_html" [root@server]# then: 1.) create a directory /var/www/cgi-bin (owner root / chmod 0701) 2.) create a directory /var/www/cgi-bin/YOUR_CUSTOMER (owner YOUR_CUSTOMER / chmod 0701) 3.) add symlink $HOME_of_virtualhost/cgi-bin which points to /var/www/cgi-bin/YOUR_CUSTOMER 4.) add path option which allows executing scripts (perl etc etc) in $HOME_of_virtualhost/cgi-bin CGI will work.

Written by spectre

January 11th, 2014 at 9:19 pm

Posted in Perl,Tips and Tricks

CGI – web status of system’s command.

without comments

#!/usr/bin/perl

use strict;
use warnings;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);

#print header(-type=>'text/plain');
print header( -charset => 'utf-8', -refresh => '10' );
print start_html();

my $info1 = `cat /proc/mdstat`;

print "...html";

print end_html();

Written by spectre

October 28th, 2013 at 10:16 pm

Posted in Perl,Tips and Tricks

The Fool’s Guide to CGI.pm

without comments

No, this guide is not for fools but by a fool, who had kept wondering how CGI.pm is supposed to work and finally got a clue. So here’s how (I think) it works in simplest cases. I hope this might make some other people’s learning curve a little better.

Read the rest of this entry »

Written by spectre

October 4th, 2013 at 3:49 pm

Posted in Perl

How do I get the full path to a Perl script that is executing? – Right way.

without comments

  • THESE ALL WRONG !!!!!!
    use Cwd qw(abs_path cwd);
    my $cwd = cwd();
    my $abs_path = abs_path();
    my $FILE = __FILE__;
    print "1. $cwd $abs_path $FILE\n";
    
     Read the rest of this entry »

Written by spectre

December 6th, 2012 at 12:12 pm

Posted in Perl

Keeping packages neatly wrapped up or How to use local Perl modules on public hosting.

without comments

Who the heck installed WWW::AdventCalendar on the server?

Imagine this not-exactly-hypothetical conversation:

  <Alice> Who the heck installed WWW::AdventCalendar on the server?
  <Bob>   I did.  Why?
  <Alice> We're trying to set up a new server just like it, and we found
          this installed, and it wants all kinds of crazy prerequisites.
          Why on Earth do we need this in production?
  <Bob>   Oh, we don't.  I just wanted to play around with it.
  <Alice> ...so you installed it globally?
  <Bob>   Well, how else was I going to play with it?

Read the rest of this entry »

Written by spectre

November 16th, 2012 at 3:20 pm

Posted in Perl

Regular expression to match string not containing a word.

without comments

The fact that regex doesn’t support inverse matching is not entirely true. You can mimic this behavior by using negative look-arounds:

^((?!hede).)*$

The regex above will match any string, or line without a line break, not containing the (sub) string ‘hede’.As mentioned, this is not something regex is “good” at (or should do), but still, it is possible.

Explanation

Read the rest of this entry »

Written by spectre

November 15th, 2012 at 9:34 pm

Posted in Perl

The bluetooth agent for pairing device on Linux with Perl.

without comments

in process …

Written by spectre

June 9th, 2012 at 12:47 pm

Posted in Perl