Loading

DADA::App::Subscriptions

NAME

DADA::App::Subscriptions

SYNOPSIS

 # Import
 use DADA::App::Subscriptions; 
  
 # Create a new object - no arguments needed
 my $das = DADA::App::Subscriptions->new; 
 
 # Awkwardly use CGI.pm's param() method to stuff parameters for 
 # DADA::App::Subscriptions->subscribe() to use
 
 use CGI; 
 my $q = CGI->new; 
 $q->param('list', 'yourlist');
 $q->param('email', 'user@example.com');
 
 # subscribe
 my $das = DADA::App::Subscriptions->new;
    $das->subscribe(
    {
          -cgi_obj     => $q,
    }
  );

DESCRIPTION

This module holds reusable code for a user to subscribe or unsubscribe from a Dada Mail mailing list.

Public Methods

Initializing

new

 my $das = DADA::App::Subscriptions->new; 

new takes no arguments.

test

 $das->test(1);

Passing, test a value of, 1 will turn this module into testing mode. Usually (and also, awkwardly) this module will perform the needed job of printing any HTML needed to complete the request you've given it.

If testing mode is on, the HTML will merely be returned to you.

Email messages will also be printed to a text file, instead of being sent out.

You probably only want to use, test if you're actually testing, via the unit tests that ship with Dada Mail.

subscribe

 # Awkwardly use CGI.pm's param() method to stuff parameters for 
 # DADA::App::Subscriptions->subscribe() to use
 
 use CGI; 
 my $q = CGI->new; 
 $q->param('list', 'yourlist');
 $q->param('email', 'user@example.com');
 
 # subscribe
 my $das = DADA::App::Subscriptions->new;
    $das->subscribe(
    {
          -cgi_obj     => $q,
    }
 );

subscribe requires one parameter, -cgi-obj, which needs to be a CGI.pm object (a CGI.pm param-compatible module won't work, but we may work on that) THAT IN ITSELF has two parameters:

-html_output is an optional parameter, if set to, 0, this method will not print out the HTML user message telling the user if everything went well (or not).

On success, this method will return, undef

Notes on awkwardness of the API

It's quite apparrent that the API of this method is not very well thought-out. The history of this method started as a subroutine in the main, mail.cgi script itself that overgrown its bounds considerably, but didn't receive a re-design of its API. Also, returning, undef on success is also not very helpful.

Rather, you may want to look into Dada Mail's Experimental JSON API:

http://dadamailproject.com/d/COOKBOOK-subscriptions.pod.html

AUTHOR

Justin Simoni http://dadamailproject.com

LICENCE AND COPYRIGHT

Copyright (c) 1999 - 2014 Justin Simoni All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Dada Mail Project

Download

Installation

Support