<<

NAME

ProductOpener::URL - generates the URL of the product

SYNOPSIS

ProductOpener::URL is used to generate a URL of the product according to the subdomain .

        use ProductOpener::URL qw/:all/;

        my $image = "$BASE_DIRS{PRODUCTS_IMAGES}/$path/$filename.full.jpg";
        my $image_url = format_subdomain('static') . "/images/products/$path/$filename.full.jpg";
        
        # subdomain format:
        # [2 letters country code or "world" or "static"]

DESCRIPTION

The module implements the URL generation on the basis of subdomain format which can be country code, world or static and on the basis of subdomain's support for https or http.

FUNCTIONS

format_subdomain($sd, $product_type = undef))

format_subdomain() returns URL on the basis of subdomain and scheme (http/https)

Arguments

subdomain

A scalar variable to indicate the subdomain (e.g. "us" or "static") needs to be passed as an argument.

product_type (optional)

Defaults to the current server product type. If passed, use the domain for that product type. (e.g. "beauty" -> "openbeautyfacts.org")

Return Values

The function returns a URL by concatenating scheme, subdomain and server-domain.

subdomain_supports_https( SUBDOMAIN )

subdomain_supports_https() determines if the subdomain supports https.

Arguments

A scalar variable to indicate the subdomain (e.g. "us" or "static") needs to be passed as an argument.

Return Values

The function returns true after evaluating the true value for the regular expression using grep or subdomain, ssl_subdomains

<<