Net::Delicious::Constants - del.icio.us constant variables


Net-Delicious documentation Contained in the Net-Delicious distribution.

Index


Code Index:

NAME

Top

Net::Delicious::Constants - del.icio.us constant variables

SYNOPSIS

Top

  # Import all the constants exported
  # by Net::Delicious::Constants::Uri
  # into the current package.

  use Net::Delicious::Constants qw (:uri);

DESCRIPTION

Top

Import del.icio.us constant variables

VERSION

Top

1.13

DATE

Top

$Date: 2008/03/03 16:55:04 $

AUTHOR

Top

Aaron Straup Cope <ascope@cpan.org>

SEE ALSO

Top

Net::Delicious

LICENSE

Top

Copyright (c) 2004-2008 Aaron Straup Cope. All rights reserved.

This is free software, you may use it and distribute it under the same terms as Perl itself.


Net-Delicious documentation Contained in the Net-Delicious distribution.
# $Id: Constants.pm,v 1.13 2008/03/03 16:55:04 asc Exp $
use strict;

package Net::Delicious::Constants;

$Net::Delicious::Constants::VERSION = '1.14';

sub import {
    my $self = shift;
    
    #
    
    my @sets  = ();
    my $debug = 0;
    
    foreach (@_) {
	if ($_ =~ /^:(.*)/) {
	    push @sets, $1;
	}
	
	elsif (/^\+(.*)/) {
	    
	    if ($1 eq "debug") {
		$debug = 1;
	    }
	}
	
	else { next; }
    }
    
    #
    
    foreach my $set (@sets) {
	
	# paranoia / 
	# will destroy ya
	$set =~ s/:://g;
	
	my $package = join("::",__PACKAGE__,ucfirst(lc($set)));
	my $caller  = caller;
	
	print STDERR "* $caller wants to import $set\n"
	    if ($debug);
	
	eval "require $package;";
	die $@ if ($@);
	
	no strict 'refs';
	
	foreach my $constant (@{$package."::EXPORT_OK"}) {
	    *{join("::",$caller,$constant)} = \&{join("::",$package,$constant)};
	}
    }
}


return 1;