r75547 - in /trunk/libcss-packer-perl: ./ debian/ inc/Module/ inc/Module/Install/ lib/CSS/ t/

jotamjr-guest at users.alioth.debian.org jotamjr-guest at users.alioth.debian.org
Sun Jun 12 22:38:12 UTC 2011


Author: jotamjr-guest
Date: Sun Jun 12 22:38:05 2011
New Revision: 75547

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=75547
Log:
New upstream release

Added:
    trunk/libcss-packer-perl/META.yml
      - copied unchanged from r75545, branches/upstream/libcss-packer-perl/current/META.yml
    trunk/libcss-packer-perl/t/01-interface.t
      - copied unchanged from r75545, branches/upstream/libcss-packer-perl/current/t/01-interface.t
    trunk/libcss-packer-perl/t/02-io.t
      - copied unchanged from r75545, branches/upstream/libcss-packer-perl/current/t/02-io.t
Removed:
    trunk/libcss-packer-perl/t/01-io.t
Modified:
    trunk/libcss-packer-perl/Changes
    trunk/libcss-packer-perl/MANIFEST
    trunk/libcss-packer-perl/Makefile.PL
    trunk/libcss-packer-perl/README
    trunk/libcss-packer-perl/debian/changelog
    trunk/libcss-packer-perl/inc/Module/Install.pm
    trunk/libcss-packer-perl/inc/Module/Install/AutoInstall.pm
    trunk/libcss-packer-perl/inc/Module/Install/Base.pm
    trunk/libcss-packer-perl/inc/Module/Install/Can.pm
    trunk/libcss-packer-perl/inc/Module/Install/Fetch.pm
    trunk/libcss-packer-perl/inc/Module/Install/Include.pm
    trunk/libcss-packer-perl/inc/Module/Install/Makefile.pm
    trunk/libcss-packer-perl/inc/Module/Install/Metadata.pm
    trunk/libcss-packer-perl/inc/Module/Install/Win32.pm
    trunk/libcss-packer-perl/inc/Module/Install/WriteAll.pm
    trunk/libcss-packer-perl/lib/CSS/Packer.pm

Modified: trunk/libcss-packer-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcss-packer-perl/Changes?rev=75547&op=diff
==============================================================================
--- trunk/libcss-packer-perl/Changes (original)
+++ trunk/libcss-packer-perl/Changes Sun Jun 12 22:38:05 2011
@@ -1,4 +1,19 @@
 Revision history for CSS-Packer
+
+1.002   2011-06-07
+    - Raised version number.
+
+1.001_002   2011-05-19
+    - Added "copyright" and "remove_copyright" options. Suggested by Marc S. Brooks.
+    - Updated POD.
+    - Added tests.
+    - Fixed comment regexp.
+
+1.001_001   2011-04-07
+    - Added accessors.
+    - Added tests.
+    - Minor Bugfixes.
+    - Cleanup.
 
 1.000001    2011-02-27
     - Changed requirements to Regexp::RegGrp 1.000001 due to "undefined submatches bug" in Regexp::RegGrp.

Modified: trunk/libcss-packer-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcss-packer-perl/MANIFEST?rev=75547&op=diff
==============================================================================
--- trunk/libcss-packer-perl/MANIFEST (original)
+++ trunk/libcss-packer-perl/MANIFEST Sun Jun 12 22:38:05 2011
@@ -15,9 +15,11 @@
 lib/CSS/Packer.pm
 Makefile.PL
 MANIFEST
+META.yml
 README
 t/00-load.t
-t/01-io.t
+t/01-interface.t
+t/02-io.t
 t/pod.t
 t/stylesheets/s1-expected.css
 t/stylesheets/s1.css

Modified: trunk/libcss-packer-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcss-packer-perl/Makefile.PL?rev=75547&op=diff
==============================================================================
--- trunk/libcss-packer-perl/Makefile.PL (original)
+++ trunk/libcss-packer-perl/Makefile.PL Sun Jun 12 22:38:05 2011
@@ -5,9 +5,10 @@
 
 all_from        'lib/CSS/Packer.pm';
 test_requires   'Test::More'        => 0;
-requires        'Regexp::RegGrp'    => "1.000001";
+requires        'Regexp::RegGrp'    => "1.001_001";
 
 repository 'http://github.com/nevesenin/css-packer-perl';
+bugtracker 'http://github.com/nevesenin/css-packer-perl/issues';
 
 clean_files 't/stylesheets/s?-got.css';
 

Modified: trunk/libcss-packer-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcss-packer-perl/README?rev=75547&op=diff
==============================================================================
--- trunk/libcss-packer-perl/README (original)
+++ trunk/libcss-packer-perl/README Sun Jun 12 22:38:05 2011
@@ -17,6 +17,9 @@
     perldoc CSS::Packer
 
 You can also look for information at:
+
+    github
+        http://github.com/nevesenin/css-packer-perl
 
     RT, CPAN's request tracker
         http://rt.cpan.org/NoAuth/Bugs.html?Dist=CSS-Packer

Modified: trunk/libcss-packer-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcss-packer-perl/debian/changelog?rev=75547&op=diff
==============================================================================
--- trunk/libcss-packer-perl/debian/changelog (original)
+++ trunk/libcss-packer-perl/debian/changelog Sun Jun 12 22:38:05 2011
@@ -1,3 +1,9 @@
+libcss-packer-perl (1.002-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Jotam Jr. Trejo <jotamjr at debian.org.sv>  Sun, 12 Jun 2011 16:35:41 -0600
+
 libcss-packer-perl (1.000001-1) unstable; urgency=low
 
   [ gregor herrmann ]

Modified: trunk/libcss-packer-perl/inc/Module/Install.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcss-packer-perl/inc/Module/Install.pm?rev=75547&op=diff
==============================================================================
--- trunk/libcss-packer-perl/inc/Module/Install.pm (original)
+++ trunk/libcss-packer-perl/inc/Module/Install.pm Sun Jun 12 22:38:05 2011
@@ -31,7 +31,7 @@
 	# This is not enforced yet, but will be some time in the next few
 	# releases once we can make sure it won't clash with custom
 	# Module::Install extensions.
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 
 	# Storage for the pseudo-singleton
 	$MAIN    = undef;
@@ -467,4 +467,4 @@
 
 1;
 
-# Copyright 2008 - 2010 Adam Kennedy.
+# Copyright 2008 - 2011 Adam Kennedy.

Modified: trunk/libcss-packer-perl/inc/Module/Install/AutoInstall.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcss-packer-perl/inc/Module/Install/AutoInstall.pm?rev=75547&op=diff
==============================================================================
--- trunk/libcss-packer-perl/inc/Module/Install/AutoInstall.pm (original)
+++ trunk/libcss-packer-perl/inc/Module/Install/AutoInstall.pm Sun Jun 12 22:38:05 2011
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }

Modified: trunk/libcss-packer-perl/inc/Module/Install/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcss-packer-perl/inc/Module/Install/Base.pm?rev=75547&op=diff
==============================================================================
--- trunk/libcss-packer-perl/inc/Module/Install/Base.pm (original)
+++ trunk/libcss-packer-perl/inc/Module/Install/Base.pm Sun Jun 12 22:38:05 2011
@@ -4,7 +4,7 @@
 use strict 'vars';
 use vars qw{$VERSION};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 }
 
 # Suspend handler for "redefined" warnings

Modified: trunk/libcss-packer-perl/inc/Module/Install/Can.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcss-packer-perl/inc/Module/Install/Can.pm?rev=75547&op=diff
==============================================================================
--- trunk/libcss-packer-perl/inc/Module/Install/Can.pm (original)
+++ trunk/libcss-packer-perl/inc/Module/Install/Can.pm Sun Jun 12 22:38:05 2011
@@ -9,7 +9,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }

Modified: trunk/libcss-packer-perl/inc/Module/Install/Fetch.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcss-packer-perl/inc/Module/Install/Fetch.pm?rev=75547&op=diff
==============================================================================
--- trunk/libcss-packer-perl/inc/Module/Install/Fetch.pm (original)
+++ trunk/libcss-packer-perl/inc/Module/Install/Fetch.pm Sun Jun 12 22:38:05 2011
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }

Modified: trunk/libcss-packer-perl/inc/Module/Install/Include.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcss-packer-perl/inc/Module/Install/Include.pm?rev=75547&op=diff
==============================================================================
--- trunk/libcss-packer-perl/inc/Module/Install/Include.pm (original)
+++ trunk/libcss-packer-perl/inc/Module/Install/Include.pm Sun Jun 12 22:38:05 2011
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }

Modified: trunk/libcss-packer-perl/inc/Module/Install/Makefile.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcss-packer-perl/inc/Module/Install/Makefile.pm?rev=75547&op=diff
==============================================================================
--- trunk/libcss-packer-perl/inc/Module/Install/Makefile.pm (original)
+++ trunk/libcss-packer-perl/inc/Module/Install/Makefile.pm Sun Jun 12 22:38:05 2011
@@ -8,7 +8,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }

Modified: trunk/libcss-packer-perl/inc/Module/Install/Metadata.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcss-packer-perl/inc/Module/Install/Metadata.pm?rev=75547&op=diff
==============================================================================
--- trunk/libcss-packer-perl/inc/Module/Install/Metadata.pm (original)
+++ trunk/libcss-packer-perl/inc/Module/Install/Metadata.pm Sun Jun 12 22:38:05 2011
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
@@ -515,6 +515,7 @@
 		'GNU Free Documentation license'     => 'unrestricted', 1,
 		'GNU Affero General Public License'  => 'open_source',  1,
 		'(?:Free)?BSD license'               => 'bsd',          1,
+		'Artistic license 2\.0'              => 'artistic_2',   1,
 		'Artistic license'                   => 'artistic',     1,
 		'Apache (?:Software )?license'       => 'apache',       1,
 		'GPL'                                => 'gpl',          1,
@@ -550,9 +551,9 @@
 
 sub _extract_bugtracker {
 	my @links   = $_[0] =~ m#L<(
-	 \Qhttp://rt.cpan.org/\E[^>]+|
-	 \Qhttp://github.com/\E[\w_]+/[\w_]+/issues|
-	 \Qhttp://code.google.com/p/\E[\w_\-]+/issues/list
+	 https?\Q://rt.cpan.org/\E[^>]+|
+	 https?\Q://github.com/\E[\w_]+/[\w_]+/issues|
+	 https?\Q://code.google.com/p/\E[\w_\-]+/issues/list
 	 )>#gx;
 	my %links;
 	@links{@links}=();

Modified: trunk/libcss-packer-perl/inc/Module/Install/Win32.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcss-packer-perl/inc/Module/Install/Win32.pm?rev=75547&op=diff
==============================================================================
--- trunk/libcss-packer-perl/inc/Module/Install/Win32.pm (original)
+++ trunk/libcss-packer-perl/inc/Module/Install/Win32.pm Sun Jun 12 22:38:05 2011
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }

Modified: trunk/libcss-packer-perl/inc/Module/Install/WriteAll.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcss-packer-perl/inc/Module/Install/WriteAll.pm?rev=75547&op=diff
==============================================================================
--- trunk/libcss-packer-perl/inc/Module/Install/WriteAll.pm (original)
+++ trunk/libcss-packer-perl/inc/Module/Install/WriteAll.pm Sun Jun 12 22:38:05 2011
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.00';
+	$VERSION = '1.01';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }

Modified: trunk/libcss-packer-perl/lib/CSS/Packer.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcss-packer-perl/lib/CSS/Packer.pm?rev=75547&op=diff
==============================================================================
--- trunk/libcss-packer-perl/lib/CSS/Packer.pm (original)
+++ trunk/libcss-packer-perl/lib/CSS/Packer.pm Sun Jun 12 22:38:05 2011
@@ -6,7 +6,22 @@
 use Carp;
 use Regexp::RegGrp;
 
-our $VERSION        = '1.000001';
+our $VERSION            = '1.002';
+
+our @COMPRESS           = ( 'minify', 'pretty' );
+our $DEFAULT_COMPRESS   = 'pretty';
+
+our @BOOLEAN_ACCESSORS = (
+    'no_compress_comment',
+    'remove_copyright'
+);
+
+our @COPYRIGHT_ACCESSORS = (
+    'copyright',
+    'copyright_comment'
+);
+
+our $COPYRIGHT_COMMENT  = '\/\*((?>[^*]|\*[^/])*copyright(?>[^*]|\*[^/])*)\*\/';
 
 our $DICTIONARY     = {
     'STRING1'   => qr~"(?>(?:(?>[^"\\]+)|\\.|\\"|\\\s)*)"~,
@@ -25,17 +40,86 @@
 
 our $DECLARATION    = '((?>[^;:]+)):(?<=:)((?>[^;]*))(?:;|\s*$)';
 
-our $COMMENT        = '(\/\*[^*]*\*+([^\/][^*]*\*+)*\/)';
+our $COMMENT        = '(\/\*[^*]*\*+([^/][^*]*\*+)*\/)';
 
 our $PACKER_COMMENT = '\/\*\s*CSS::Packer\s*(\w+)\s*\*\/';
 
 our $CHARSET        = '^(\@charset)\s+(' . $DICTIONARY->{STRING1} . '|' . $DICTIONARY->{STRING2} . ');';
 
+our @REGGRPS        = ( 'whitespaces', 'url', 'import', 'declaration', 'rule', 'content_value', 'mediarules', 'global' );
+
 # --------------------------------------------------------------------------- #
 
+{
+    no strict 'refs';
+
+    foreach my $reggrp ( @REGGRPS ) {
+        next if defined *{ __PACKAGE__ . '::reggrp_' . $reggrp }{CODE};
+
+        *{ __PACKAGE__ . '::reggrp_' . $reggrp } = sub {
+            my ( $self ) = shift;
+
+            return $self->{ '_reggrp_' . $reggrp };
+        };
+    }
+
+    foreach my $field ( @BOOLEAN_ACCESSORS ) {
+        next if defined *{ __PACKAGE__ . '::' . $field }{CODE};
+
+        *{ __PACKAGE__ . '::' . $field} = sub {
+            my ( $self, $value ) = @_;
+
+            $self->{'_' . $field} = $value ? 1 : undef if ( defined( $value ) );
+
+            return $self->{'_' . $field};
+        };
+    }
+
+    foreach my $field ( @COPYRIGHT_ACCESSORS ) {
+        $field = '_' . $field if ( $field eq 'copyright_comment' );
+        next if defined *{ __PACKAGE__ . '::' . $field }{CODE};
+
+        *{ __PACKAGE__ . '::' . $field} = sub {
+            my ( $self, $value ) = @_;
+
+            if ( defined( $value ) and not ref( $value ) ) {
+                $value =~ s/^\s*|\s*$//gs;
+                $self->{'_' . $field} = $value;
+            }
+
+            my $ret = '';
+
+            if ( $self->{'_' . $field} ) {
+                $ret = '/* ' . $self->{'_' . $field} . ' */' . "\n";
+            }
+
+            return $ret;
+        };
+    }
+}
+
+sub compress {
+    my ( $self, $value ) = @_;
+
+    if ( defined( $value ) ) {
+        if ( grep( $value eq $_, @COMPRESS ) ) {
+            $self->{_compress} = $value;
+        }
+        elsif ( ! $value ) {
+            $self->{_compress} = undef;
+        }
+    }
+
+    $self->{_compress} ||= $DEFAULT_COMPRESS;
+
+    return $self->{_compress};
+}
+
 sub init {
-    my $class    = shift;
+    my $class   = shift;
     my $self    = {};
+
+    bless( $self, $class );
 
     $self->{content_value}->{reggrp_data} = [
         {
@@ -81,15 +165,10 @@
                 my $submatches  = $_[0]->{submatches};
                 my $url         = $submatches->[0];
                 my $mediatype   = $submatches->[2];
-                my $opts        = $_[0]->{opts} || {};
-
-                my $compress    = _get_opt( $opts, 'compress' );
-
-                # I don't like this, but
-                # $self->{url}->{reggrp}->exec( \$url );
-                # will not work. It isn't initialized jet.
-                # If someone has a better idea, please let me know
-                $self->_process_wrapper( 'url', \$url, $opts );
+
+                my $compress    = $self->compress();
+
+                $self->reggrp_url()->exec( \$url );
 
                 $mediatype =~ s/^\s*|\s*$//gs;
                 $mediatype =~ s/\s*,\s*/,/gsm;
@@ -106,19 +185,14 @@
                 my $submatches  = $_[0]->{submatches};
                 my $key         = $submatches->[0];
                 my $value       = $submatches->[1];
-                my $opts        = $_[0]->{opts} || {};
-
-                my $compress    = _get_opt( $opts, 'compress' );
+
+                my $compress    = $self->compress();
 
                 $key    =~ s/^\s*|\s*$//gs;
                 $value  =~ s/^\s*|\s*$//gs;
 
                 if ( $key eq 'content' ) {
-                    # I don't like this, but
-                    # $self->{content_value}->{reggrp}->exec( \$value );
-                    # will not work. It isn't initialized jet.
-                    # If someone has a better idea, please let me know
-                    $self->_process_wrapper( 'content_value', \$value, $opts );
+                    $self->reggrp_content_value->exec( \$value );
                 }
                 else {
                     $value =~ s/\s*,\s*/,/gsm;
@@ -139,9 +213,8 @@
                 my $submatches  = $_[0]->{submatches};
                 my $selector    = $submatches->[0];
                 my $declaration = $submatches->[1];
-                my $opts        = $_[0]->{opts} || {};
-
-                my $compress    = _get_opt( $opts, 'compress' );
+
+                my $compress    = $self->compress();
 
                 $selector =~ s/^\s*|\s*$//gs;
                 $selector =~ s/\s*,\s*/,/gsm;
@@ -149,11 +222,7 @@
 
                 $declaration =~ s/^\s*|\s*$//gs;
 
-                # I don't like this, but
-                # $self->{declaration}->{reggrp}->exec( \$declaration );
-                # will not work. It isn't initialized jet.
-                # If someone has a better idea, please let me know
-                $self->_process_wrapper( 'declaration', \$declaration, $opts );
+                $self->reggrp_declaration()->exec( \$declaration );
 
                 my $store = $selector . '{' . ( $compress eq 'pretty' ? "\n" : '' ) . $declaration . '}' .
                     ( $compress eq 'pretty' ? "\n" : '' );
@@ -176,9 +245,10 @@
             regexp      => $CHARSET,
             replacement => sub {
                 my $submatches  = $_[0]->{submatches};
-                my $opts        = $_[0]->{opts} || {};
-
-                return $submatches->[0] . " " . $submatches->[1] . ( $opts->{compress} eq 'pretty' ? "\n" : '' );
+
+                my $compress    = $self->compress();
+
+                return $submatches->[0] . " " . $submatches->[1] . ( $compress eq 'pretty' ? "\n" : '' );
             }
         },
         {
@@ -187,18 +257,13 @@
                 my $submatches  = $_[0]->{submatches};
                 my $mediatype   = $submatches->[0];
                 my $mediarules  = $submatches->[1];
-                my $opts        = $_[0]->{opts} || {};
-
-                my $compress    = _get_opt( $opts, 'compress' );
+
+                my $compress    = $self->compress();
 
                 $mediatype =~ s/^\s*|\s*$//gs;
                 $mediatype =~ s/\s*,\s*/,/gsm;
 
-                # I don't like this, but
-                # $self->{mediarules}->{reggrp}->exec( \$mediarules );
-                # will not work. It isn't initialized jet.
-                # If someone has a better idea, please let me know
-                $self->_process_wrapper( 'mediarules', \$mediarules, $opts );
+                $self->reggrp_mediarules()->exec( \$mediarules );
 
                 return '@media ' . $mediatype . '{' . ( $compress eq 'pretty' ? "\n" : '' ) .
                     $mediarules . '}' . ( $compress eq 'pretty' ? "\n" : '' );
@@ -209,14 +274,12 @@
 
 
     map {
-        $self->{$_}->{reggrp} = Regexp::RegGrp->new(
+        $self->{ '_reggrp_' . $_ } = Regexp::RegGrp->new(
             {
                 reggrp => $self->{$_}->{reggrp_data}
             }
         );
-    } ( 'whitespaces', 'url', 'import', 'declaration', 'rule', 'content_value', 'mediarules', 'global' );
-
-    bless( $self, $class );
+    } @REGGRPS;
 
     return $self;
 }
@@ -256,56 +319,44 @@
         $css = ref( $input ) ? $input : \$input;
     }
 
-    if ( ref( $opts ) ne 'HASH' ) {
-        carp( 'Second argument must be a hashref of options! Using defaults!' ) if ( $opts );
-        $opts = { compress => 'pretty', no_compress_comment => 0 };
-    }
-    else {
-        $opts->{compress}               = grep( $opts->{compress}, ( 'minify', 'pretty' ) ) ? $opts->{compress} : 'pretty';
-        $opts->{no_compress_comment}    = $opts->{no_compress_comment} ? 1 : 0;
-    }
-
-    if ( not $opts->{no_compress_comment} and ${$css} =~ /$PACKER_COMMENT/ ) {
+    if ( ref( $opts ) eq 'HASH' ) {
+        foreach my $field ( @BOOLEAN_ACCESSORS ) {
+            $self->$field( $opts->{$field} ) if ( defined( $opts->{$field} ) );
+        }
+
+        foreach my $field ( 'compress', 'copyright' ) {
+            $self->$field( $opts->{$field} ) if ( defined( $opts->{$field} ) );
+        }
+    }
+
+    my $copyright_comment = '';
+
+    if ( ${$css} =~ /$COPYRIGHT_COMMENT/ism ) {
+        $copyright_comment = $1;
+    }
+    # Resets copyright_comment() if there is no copyright comment
+    $self->_copyright_comment( $copyright_comment );
+
+    if ( not $self->no_compress_comment() and ${$css} =~ /$PACKER_COMMENT/ ) {
         my $compress = $1;
         if ( $compress eq '_no_compress_' ) {
             return ( $cont eq 'scalar' ) ? ${$css} : undef;
         }
 
-        $opts->{compress} = grep( $compress, ( 'minify', 'pretty' ) ) ? $compress : $opts->{compress};
+        $self->compress( $compress );
     }
 
     ${$css} =~ s/$COMMENT/ /gsm;
 
-    $self->{global}->{reggrp}->exec( $css, $opts );
+    $self->reggrp_global()->exec( $css );
+
+    if ( not $self->remove_copyright() ) {
+        ${$css} = ( $self->copyright() || $self->_copyright_comment() ) . ${$css};
+    }
 
     return ${$css} if ( $cont eq 'scalar' );
 }
 
-sub _process_wrapper {
-    my ( $self, $reg_name, $in, $opts ) = @_;
-
-    $self->{$reg_name}->{reggrp}->exec( $in, $opts );
-}
-
-sub _restore_wrapper {
-    my ( $self, $reg_name, $in ) = @_;
-
-    $self->{$reg_name}->{reggrp}->restore_stored( $in );
-}
-
-sub _get_opt {
-    my ( $opts_hash, $opt ) = @_;
-
-    $opts_hash  ||= {};
-    $opt       ||= '';
-
-    my $ret = '';
-
-    $ret = $opts_hash->{$opt} if ( defined( $opts_hash->{$opt} ) );
-
-    return $ret;
-}
-
 1;
 
 __END__
@@ -316,7 +367,7 @@
 
 =head1 VERSION
 
-Version 1.000001
+Version 1.002
 
 =head1 DESCRIPTION
 
@@ -339,7 +390,7 @@
     CSS::Packer::minify( $scalarref, $opts );
 
 First argument must be a scalarref of CSS-Code.
-Second argument must be a hashref of options. The only option is
+Second argument must be a hashref of options. Possible options are:
 
 =over 4
 
@@ -370,6 +421,26 @@
 
     a{color:black;}div{width:100px;}
 
+=item copyright
+
+You can add a copyright notice at the top of the script.
+
+=item remove_copyright
+
+If there is a copyright notice in a comment it will only be removed if this
+option is set to a true value. Otherwise the first comment that contains the
+word "copyright" will be added at the top of the packed script. A copyright
+comment will be overwritten by a copyright notice defined with the copyright
+option.
+
+=item no_compress_comment
+
+If not set to a true value it is allowed to set a CSS comment that
+prevents the input being packed or defines a compression level.
+
+    /* CSS::Packer _no_compress_ */
+    /* CSS::Packer pretty */
+
 =back
 
 =head1 AUTHOR
@@ -378,8 +449,8 @@
 
 =head1 BUGS
 
-Please report any bugs or feature requests to C<bug-css-packer at rt.cpan.org>, or through
-the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CSS-Packer>.  I will be notified, and then you'll
+Please report any bugs or feature requests through
+the web interface at L<http://github.com/nevesenin/css-packer-perl/issues>.  I will be notified, and then you'll
 automatically be notified of progress on your bug as I make changes.
 
 =head1 SUPPORT




More information about the Pkg-perl-cvs-commits mailing list