Sympa::DataSource(3Sympa)

πŸ’– Sympa::DataSource β€” the base class glow-up ✨

okay bestie, this is Sympa::DataSource(3Sympa) from the sympa 6.2.80 manual, and she is the mother of all the data source subclasses. every data source subclass in Sympa is her daughter, and she's here to serve the inheritance πŸ’…


🌸 NAME 🌸

Sympa::DataSource β€” the base class of the Sympa data source subclasses. like, the blueprint. the blueprint-est blueprint. everything else is just building on her foundation, periodt πŸ‘‘


✨ SYNOPSIS ✨

so first, if you're out here trying to implement Sympa::DataSource::Foo, it's giving:

# To implemnt Sympa::DataSource::Foo:

package Sympa::DataSource::Foo;

use base qw(Sympa::DataSource);

sub _open {
    my $self = shift;
    ...
    return $handle;
}

sub _next {
    my $self = shift;
    ...
    return [$email, $gecos];
}

1;

(no I did not fix the typo in the comment. the typo stays. we respect the original here, no cap 🫢)

and using it? also iconic:

# To use Sympa::DataSource::Foo:

usr Sympa::DataSource;

$ds = Sympa::DataSource->new('Foo', 'member', context => $list,
    key => val, ...);
if ($ds and $ds->open) {
    while (my $member = $ds->next) {
        ...
    }
    $ds->close;
}

πŸ¦‹ DESCRIPTION πŸ¦‹

TBD.

... yeah. that's literally all she wrote. the description is ✨to be determined✨. we love a mysterious queen who says nothing and yet does everything 🌈

πŸ’œ Methods πŸ’œ

new ( $type, $role, context => $that, [ key => val, ... ] )

the constructor, bestie. makes you a fresh new instance of Sympa::DataSource like it's a new semester πŸ’–

Parameters:

  • $type β€” the type of data source. this maps to whatever subclasses actually got implemented, iykyk.
  • $role β€” the role of the data source. she's serving one of: 'member', 'owner', 'editor' or 'custom_attribute'. pick your lane πŸŽ€
  • context => $that β€” the context. a Sympa::List instance and so on. the vibe setter.
  • key => val, ... β€” optional or mandatory params, depending on the mood.

Returns:

a new instance, or undef on failure 😭 (crying, throwing up, but make it a failed constructor).

close ( )

instance method. closes the backend and does the cleanup. she's logging off 🧚

is_external ( )

instance method. returns a true value if the data source is an external data source. "external" means it's not include_sympa_list (aka not an instance of Sympa::DataSource::List) or not including any lists on the local domain.

Known bug:

  • If a data source is a list included from the other external data source(s), this method will treat it as non-external, so that some requests not allowed for external data sources β€” such as move_user request β€” on corresponding users may be allowed. πŸ’€ so yeah, that's a permissions oopsie, and per the manual it's a known bug. be aware.

next ( )

instance method. returns the next entry in the data source. the data source should have been opened first, bestie β€” don't skip the open, it's not a vibe βœ‹

open ( )

instance method. opens the backend and returns a handle. like opening a group chat πŸ’¬

get_id ( )

instance method. gets the unique ID of the instance. one of one πŸ”₯

get_short_id ( )

instance method. gets the data source ID, a hexadecimal string with 8 columns. cute and compact πŸŽ€

name ( )

instance method. gets the human-readable name of the data source. typically it's the value of {name} attribute or the result of get_short_id(). aesthetic AND functional, we stan 🌸

role ( )

instance method. returns $role set by new(). she remembers who she is πŸ‘‘

__dsh ( )

instance method, protected. returns the native query handle which _open() returned. this may be used only at inside of each subclass β€” like, stay in your house, this is family business πŸ™ˆ


πŸ’… Methods subclass should implement πŸ’…

required_modules

class or instance method. TBD.

_open ( [ options... ] )

instance mthod. TBD.

(yes, "mthod". the typo is part of the lore now. 🧚)

_next ( [ options... ] )

instance method, mandatory. TBD. like she's required and still says TBD. β€” main character energy fr fr ⭐

_next_ca ( [ options... ] )

instance method, mandatory if the data source supports custom attribute. TBD.

_close ( )

instance method. TBD.


🌈 Attributes 🌈

{context}

the context of the data source set by new().

Others

the other options set by new() may be accessed as attributes. surprise! everything's an attribute if you believe hard enough πŸ’«


πŸŽ€ HISTORY πŸŽ€

Sympa::DataSource appeared on Sympa 6.2.45b. see also "HISTORY" in Sympa::Request::Handler::include. she's been around, she's got lore πŸ“œ


lowkey reminder bestie: every option, method, param and typo up there is verbatim from the page. I just gave it a wardrobe change. the facts did not move. πŸ’–

and that's a wrap on Sympa::DataSource(3Sympa) from sympa version 6.2.80, dated 2026-10-19 πŸ’…βœ¨ slay, stay safe, and always call $ds->close when you're done 🫢🌸

πŸ“¦ where this page comes from