[asterisk-users] Asterisk dialplan best practices syntax

Tech Support asterisk at voipbusiness.us
Sun Jun 28 11:11:03 CDT 2015


Hey;
    Don't forget Perl. I'm not sure what everyone else calls it, but most
Perl programmers call it a "fat comma".

    From Chromatic's "Modern Perl" book: One of the simplest but most useful
examples of TIMTOWTDI in the design of Perl is the fat comma operator (=>),
which acts like a regular comma except that it automatically quotes
barewords used as its left operands. It also looks like an arrow, so it
leads from left to right and implies a stronger association between its
operands than the normal comma does.

You can see this in hash initializers:

my %dogs = (
    alpha => 'Rodney',
    clown => 'Lucky',
    puppy => 'Rosie',
);

Regards;
John V.

-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Steve Edwards
Sent: Sunday, June 28, 2015 11:08 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Asterisk dialplan best practices syntax

On Sun, 28 Jun 2015, Ludovic Gasc wrote:

> It's interesting because from my point of view, I prefer to use '=>', 
> because, to me, '=' is for config files. The dialplan is a programming 
> language, not a config file.

The only language I'm familiar with (I'm primarily a 'c' guy) that uses '=>'
is PHP. In PHP, '=>' is used with associative arrays.

I tend to think of a dialplan as a group of one dimensional linear arrays
with the name of the array being the context concatenated with the exten so
for me, a simple assignment makes sense.

--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to
Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list