[Catalyst-commits] r10241 - in CatalystX-CRUD/CatalystX-CRUD/trunk:
. lib/CatalystX lib/CatalystX/CRUD
lib/CatalystX/CRUD/Iterator lib/CatalystX/CRUD/Model
lib/CatalystX/CRUD/ModelAdapter lib/CatalystX/CRUD/Object
lib/CatalystX/CRUD/Test
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Sat May 23 09:57:25 GMT 2009
Author: karpet
Date: 2009-05-23 09:57:25 +0000 (Sat, 23 May 2009)
New Revision: 10241
Modified:
CatalystX-CRUD/CatalystX-CRUD/trunk/Changes
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Controller.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Iterator.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Iterator/File.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/File.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/Utils.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/ModelAdapter/File.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Object.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Object/File.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/REST.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Results.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Controller.pm
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Form.pm
Log:
fix rt46314
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/Changes
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/Changes 2009-05-23 07:20:22 UTC (rev 10240)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/Changes 2009-05-23 09:57:25 UTC (rev 10241)
@@ -213,4 +213,10 @@
Notably, it caused a strange bug in Rose::DBx::Garden::Catalyst where the MyApp->config
class hashref would get nuked after a call to Class::C3::initialize(). Yes. That fsked up.
-
+0.44 23 May 2009
+ * check for symlink() support in Model::File at compile time and return from rm_related()
+ if not supported. Fixes spurious test breakage on Win32.
+ See https://rt.cpan.org/Ticket/Display.html?id=46314
+
+
+
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Controller.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Controller.pm 2009-05-23 07:20:22 UTC (rev 10240)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Controller.pm 2009-05-23 09:57:25 UTC (rev 10241)
@@ -37,7 +37,7 @@
naked_results => 0,
);
-our $VERSION = '0.43';
+our $VERSION = '0.44';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Iterator/File.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Iterator/File.pm 2009-05-23 07:20:22 UTC (rev 10240)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Iterator/File.pm 2009-05-23 09:57:25 UTC (rev 10241)
@@ -3,7 +3,7 @@
use warnings;
use Carp;
-our $VERSION = '0.43';
+our $VERSION = '0.44';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Iterator.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Iterator.pm 2009-05-23 07:20:22 UTC (rev 10240)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Iterator.pm 2009-05-23 09:57:25 UTC (rev 10241)
@@ -4,7 +4,7 @@
use Carp;
use base qw( CatalystX::CRUD );
-our $VERSION = '0.43';
+our $VERSION = '0.44';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/File.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/File.pm 2009-05-23 07:20:22 UTC (rev 10240)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/File.pm 2009-05-23 09:57:25 UTC (rev 10241)
@@ -10,8 +10,11 @@
__PACKAGE__->mk_accessors(qw( inc_path ));
-our $VERSION = '0.43';
+our $VERSION = '0.44';
+# test whether symlink() works at compile time
+my $SYMLINK_SUPPORTED = eval { symlink("",""); 1 };
+
=head1 NAME
CatalystX::CRUD::Model::File - filesystem CRUD model
@@ -238,6 +241,13 @@
sub add_related {
my ( $self, $file, $rel_name, $other_file_name ) = @_;
+
+ if (!$SYMLINK_SUPPORTED) {
+ $self->context->log->error(
+ "symlink() is not supported on this system");
+ return;
+ }
+
my $other_file = $self->fetch( file => $other_file_name );
unless ( -r $other_file ) {
@@ -252,30 +262,12 @@
}
# if not, create symlink
- # wrap in eval since win32 (others?) do not support symlink
my $link = $self->object_class->delegate_class->new( $file->dir,
$other_file->basename );
- my $success = 1;
- my $symlink_supported
- = eval { $success = symlink( "$file", "$link" ); 1 };
- if ($symlink_supported) {
- if ( !$success ) {
- $self->throw_error("failed to symlink $link => $file: $@");
- }
- else {
- return 1;
- }
+ if (!symlink( "$file", "$link" )) {
+ $self->throw_error("failed to symlink $link => $file: $@");
}
- else {
- # symlink() is not supported on this system.
- # we do not throw_error because that will cause
- # tests to fail unnecessarily.
- # however, we need to signal the problem somehow.
- $self->context->log->error(
- "symlink() is not supported on this system");
- }
-
}
else {
$self->throw_error("unsupported relationship name: $rel_name");
@@ -287,6 +279,9 @@
For I<rel_name> of "dir" will create a symlink for I<other_file_name>'s
basename to I<file> in the same directory as I<file>.
+If the symlink() function is not supported, will log an error and return
+without doing anything.
+
If the symlink represented by I<other_file_name> does not exist
or is not a symlink, will throw an error.
@@ -297,6 +292,12 @@
sub rm_related {
my ( $self, $file, $rel_name, $other_file_name ) = @_;
+ if (!$SYMLINK_SUPPORTED) {
+ $self->context->log->error(
+ "symlink() is not supported on this system");
+ return;
+ }
+
my $other_file = $self->fetch( file => $other_file_name );
unless ( -r $other_file ) {
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/Utils.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/Utils.pm 2009-05-23 07:20:22 UTC (rev 10240)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/Utils.pm 2009-05-23 09:57:25 UTC (rev 10241)
@@ -9,7 +9,7 @@
__PACKAGE__->mk_accessors(qw( use_ilike ne_sign ));
-our $VERSION = '0.43';
+our $VERSION = '0.44';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model.pm 2009-05-23 07:20:22 UTC (rev 10240)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model.pm 2009-05-23 09:57:25 UTC (rev 10241)
@@ -9,7 +9,7 @@
Catalyst::Model
);
-our $VERSION = '0.43';
+our $VERSION = '0.44';
__PACKAGE__->mk_accessors(qw( object_class page_size ));
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/ModelAdapter/File.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/ModelAdapter/File.pm 2009-05-23 07:20:22 UTC (rev 10240)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/ModelAdapter/File.pm 2009-05-23 09:57:25 UTC (rev 10241)
@@ -3,7 +3,7 @@
use warnings;
use base qw( CatalystX::CRUD::ModelAdapter );
-our $VERSION = '0.43';
+our $VERSION = '0.44';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Object/File.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Object/File.pm 2009-05-23 07:20:22 UTC (rev 10240)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Object/File.pm 2009-05-23 09:57:25 UTC (rev 10241)
@@ -13,7 +13,7 @@
__PACKAGE__->mk_accessors(qw( content file ));
__PACKAGE__->delegate_class('Path::Class::File');
-our $VERSION = '0.43';
+our $VERSION = '0.44';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Object.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Object.pm 2009-05-23 07:20:22 UTC (rev 10240)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Object.pm 2009-05-23 09:57:25 UTC (rev 10241)
@@ -12,7 +12,7 @@
__PACKAGE__->mk_ro_accessors(qw( delegate ));
__PACKAGE__->mk_classdata('delegate_class');
-our $VERSION = '0.43';
+our $VERSION = '0.44';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/REST.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/REST.pm 2009-05-23 07:20:22 UTC (rev 10240)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/REST.pm 2009-05-23 09:57:25 UTC (rev 10241)
@@ -10,7 +10,7 @@
__PACKAGE__->mk_accessors(qw( enable_rpc_compat ));
__PACKAGE__->config( enable_rpc_compat => 0 );
-our $VERSION = '0.43';
+our $VERSION = '0.44';
#warn "REST VERSION = $VERSION";
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Results.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Results.pm 2009-05-23 07:20:22 UTC (rev 10240)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Results.pm 2009-05-23 09:57:25 UTC (rev 10241)
@@ -8,7 +8,7 @@
__PACKAGE__->mk_ro_accessors(qw( count pager query results ));
-our $VERSION = '0.43';
+our $VERSION = '0.44';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Controller.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Controller.pm 2009-05-23 07:20:22 UTC (rev 10240)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Controller.pm 2009-05-23 09:57:25 UTC (rev 10241)
@@ -8,7 +8,7 @@
__PACKAGE__->mk_accessors( qw( form_fields ) );
-our $VERSION = '0.43';
+our $VERSION = '0.44';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Form.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Form.pm 2009-05-23 07:20:22 UTC (rev 10240)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Test/Form.pm 2009-05-23 09:57:25 UTC (rev 10241)
@@ -7,7 +7,7 @@
__PACKAGE__->mk_accessors(qw( params fields ));
-our $VERSION = '0.43';
+our $VERSION = '0.44';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD.pm 2009-05-23 07:20:22 UTC (rev 10240)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD.pm 2009-05-23 09:57:25 UTC (rev 10241)
@@ -4,7 +4,7 @@
use strict;
use Carp;
-our $VERSION = '0.43';
+our $VERSION = '0.44';
=head1 NAME
More information about the Catalyst-commits
mailing list