Showing revision 15

Writing Perl Modules

Basic module structure

sh: 1: pygmentize: not found

use strict;
use warnings;

package ProgArm;
our(%Keys);

@Keys{MyNewSub} = 'g';

sub MyNewSub {
    # Write your code here
}

Repeats

By default actions are called without any parameters, however repeat.pl will pass 1 or -1 to indicate repeat and negative repeat.

The longest way to detect negative repeat is to use

sh: 1: pygmentize: not found

if defined $_[0] and $_[0] == -1

You can shorten it to

sh: 1: pygmentize: not found

if ($_[0] // 0) == -1

However, it is much easier to use experimental smartmatch operator

sh: 1: pygmentize: not found

if $_[0] ~~ -1

Even though it is deprecated, all modules use smartmatch operator. You should use it too! (A simple sed command can easily change it in every module, that's why we ask you to respect consistency)

We can rewrite previous example to handle negative repeats:

sh: 1: pygmentize: not found

use strict;
use warnings;

package ProgArm;
our(%Keys);

@Keys{MyNewSub} = 'g';

sub MyNewSub {
    return MyNewSubNegative() if $_[0] ~~ -1;
    # Write your code here
}

sub MyNewSubNegative {
    # Write your code here
}

Comments:

ivermectin 2ml - <a href="https://ivermecti.com/">ivermectin medication</a> stromectol tablet 3 mg

-- Racraw 2021-08-20 12:48 UTC

ventolin inhalers - <a href="https://onventolinp.com/">ventolin price uk</a> ventolin cost canada

-- Aeelio 2021-08-22 09:08 UTC

misoprostol price - <a href="https://fastcytoteh.com/">cytotec tablets</a> buy cytotec online fast delivery

-- Ucbecn 2021-08-23 19:06 UTC

doxycycline 300 mg - <a href="https://doxycyclinegn.com/">doxycycline best price</a> doxycycline online usa

-- Zhxvyb 2021-08-25 05:50 UTC

neurontin capsules 100mg - <a href="https://neurontinpl.com/">where to buy neurontin</a> levothyroxine 75 mcg cheap

-- Wrxxnw 2021-08-26 17:38 UTC

sildenafil 200 mg online - buy sildenafil usa

-- Cunxvb 2021-08-28 07:04 UTC

vardenafil generic names - <a href="https://blevitrarx.com/">vardenafil generic</a> generic vardenafil canada

-- Mwonto 2021-08-30 18:12 UTC

stromectol human - <a href="https://ivermecrx.com/">ivermectin 1</a> stromectol 6mg

-- Pyyred 2021-09-01 07:14 UTC

2.5 mg prednisone - <a href="https://prednipill.com/">prednisone 5mg</a> prednisone 20mg online

-- Begiwl 2021-09-02 08:27 UTC

accutane 2009 - <a href="https://accutans.com/">where can you buy accutane</a> accutane drug

-- Jmtode 2021-09-03 15:16 UTC

amoxil USA - <a href="https://gnamoxil.com/">generic amoxicillin 500mg</a> amoxicillin without a doctor’s prescription

-- Xxckll 2021-09-05 03:37 UTC

medrol buy - <a href="https://gnmedrol.com/">medrol 2mg price</a> buy lyrica online usa

-- Dlmzgr 2021-09-06 09:22 UTC