Skip Menu |

This queue is for tickets about the Path-Class-Versioned CPAN distribution.

Report information
The Basics
Id: 64183
Status: open
Priority: 0/
Queue: Path-Class-Versioned

People
Owner: Nobody in particular
Requestors: meir [...] guttman.co.il
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Add "->latest_xxx" methods
Hey, I am rather a newbie, so may be I am not aware of an already available feature to do the same. Having said that, I think that adding methods to retrieve the name of the LATEST version of the file to the "->next_xxx" methods of this package, would be a good idea. If one uses this package for the "next_xxx" he/she will be glad to also use it to find out which one is the latest. Regards, Meir
Sure that would work, you are welcome to whip up a patch to do that if you want, I am currently too busy with work and the holidays to get it right now. - Stevan On Thu Dec 23 15:35:20 2010, meir@guttman.co.il wrote: Show quoted text
> Hey, I am rather a newbie, so may be I am not aware of an already > available feature to do the same. > Having said that, I think that adding methods to retrieve the name of > the LATEST version of the file to the "->next_xxx" methods of this > package, would be a good idea. > If one uses this package for the "next_xxx" he/she will be glad to also > use it to find out which one is the latest. > Regards, > Meir
Subject: RE: [rt.cpan.org #64183] Add "->latest_xxx" methods
Date: Fri, 24 Dec 2010 11:43:09 +0200
To: bug-Path-Class-Versioned [...] rt.cpan.org
From: Meir Guttman <meir [...] guttman.co.il>
Dear Steven, As I said in my original post, I am rather a newbie, and a fairly naïve user of Perl at that. I never wrote an OO package (although I used many) and I am not familiar with all the packages on which it is based. So I am not sure you want me to go and mess up your simple to use, very helpful package... Yes, I'll try, but don't hold your breath. May be somebody more experienced could do it with no trouble? And all this is by no means urgent. Christmas and being with your loved ones are definitely at a much higher priority! So, enjoy the holidays, and merry Christmas! Meir Show quoted text
-----Original Message----- From: Stevan Little via RT [mailto:bug-Path-Class-Versioned@rt.cpan.org] Sent: Friday, December 24, 2010 12:06 AM To: meir@guttman.co.il Subject: [rt.cpan.org #64183] Add "->latest_xxx" methods <URL: https://rt.cpan.org/Ticket/Display.html?id=64183 > Sure that would work, you are welcome to whip up a patch to do that if you want, I am currently too busy with work and the holidays to get it right now. - Stevan On Thu Dec 23 15:35:20 2010, meir@guttman.co.il wrote:
> Hey, I am rather a newbie, so may be I am not aware of an already > available feature to do the same. > Having said that, I think that adding methods to retrieve the name of > the LATEST version of the file to the "->next_xxx" methods of this > package, would be a good idea. > If one uses this package for the "next_xxx" he/she will be glad to also > use it to find out which one is the latest. > Regards, > Meir
Subject: RE: [rt.cpan.org #64183] Add "->latest_xxx" methods
Date: Wed, 26 Jan 2011 15:47:01 +0200
To: bug-Path-Class-Versioned [...] rt.cpan.org
From: Meir Guttman <meir [...] guttman.co.il>
Dear Steven, So far I could determine what is the current version using other means. But now I am doing a file Read-Modify-Write application that should preserve all previous file versions. The Path::Class::Versioned would be the right and coolest way to go. Are you less pressed now than before the holidays...? Best regards, Meir Show quoted text
-----Original Message----- From: Stevan Little via RT [mailto:bug-Path-Class-Versioned@rt.cpan.org] Sent: Friday, December 24, 2010 12:06 AM To: meir@guttman.co.il Subject: [rt.cpan.org #64183] Add "->latest_xxx" methods <URL: https://rt.cpan.org/Ticket/Display.html?id=64183 > Sure that would work, you are welcome to whip up a patch to do that if you want, I am currently too busy with work and the holidays to get it right now. - Stevan
Subject: Re: [rt.cpan.org #64183] Add "->latest_xxx" methods
Date: Wed, 26 Jan 2011 09:35:29 -0500
To: bug-Path-Class-Versioned [...] rt.cpan.org
From: Stevan Little <stevan.little [...] iinteractive.com>
Sorry, I am still very busy. And looking quickly over the code, it is a little tricky to determine the latest one since the pattern of the filename is so arbitrary. However, if you use a Path::Class::Versioned pattern that is sortable, for instance, something like: my $v = Path::Class::Versioned->new( version_format => '%03d', name_pattern => [ undef, '-File.txt' ], parent => $dir ); Which will produce file names like so: 001-File.txt 002-File.txt 003-File.txt 004-File.txt Then you can sort the files in the directory and find the latest like this: my $dir = Path::Class::Dir- Show quoted text
>new( $directory_where_files_are_located );
my @files = grep { $_->isa('Path::Class::File') } $dir->children; my @sorted_files = sort { $a->basename cmp $b->basename } @files; my $latest = pop @sorted_files; You can likely put this into a subroutine for use within your application. Hopefully this helps. - Stevan On Jan 26, 2011, at 9:06 AM, Meir Guttman via RT wrote: Show quoted text
> Queue: Path-Class-Versioned > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=64183 > > > Dear Steven, > > So far I could determine what is the current version using other > means. But > now I am doing a file Read-Modify-Write application that should > preserve all > previous file versions. The Path::Class::Versioned would be the > right and > coolest way to go. > Are you less pressed now than before the holidays...? > Best regards, > Meir > > > > -----Original Message----- > From: Stevan Little via RT [mailto:bug-Path-Class-Versioned@rt.cpan.org > ] > Sent: Friday, December 24, 2010 12:06 AM > To: meir@guttman.co.il > Subject: [rt.cpan.org #64183] Add "->latest_xxx" methods > > <URL: https://rt.cpan.org/Ticket/Display.html?id=64183 > > > Sure that would work, you are welcome to whip up a patch to do that > if you > want, I am currently too busy with work and the holidays to get it > right > now. > > - Stevan > > > >
Subject: RE: [rt.cpan.org #64183] Add "->latest_xxx" methods
Date: Wed, 26 Jan 2011 17:13:13 +0200
To: bug-Path-Class-Versioned [...] rt.cpan.org
From: Meir Guttman <meir [...] guttman.co.il>
Thanks Stevan, Yes, this should work. I'll implement and report... Meir Show quoted text
-----Original Message----- From: Stevan Little via RT [mailto:bug-Path-Class-Versioned@rt.cpan.org] Sent: Wednesday, January 26, 2011 4:36 PM To: meir@guttman.co.il Subject: Re: [rt.cpan.org #64183] Add "->latest_xxx" methods <URL: http://rt.cpan.org/Ticket/Display.html?id=64183 > Sorry, I am still very busy. And looking quickly over the code, it is a little tricky to determine the latest one since the pattern of the filename is so arbitrary. However, if you use a Path::Class::Versioned pattern that is sortable, for instance, something like: my $v = Path::Class::Versioned->new( version_format => '%03d', name_pattern => [ undef, '-File.txt' ], parent => $dir ); Which will produce file names like so: 001-File.txt 002-File.txt 003-File.txt 004-File.txt Then you can sort the files in the directory and find the latest like this: my $dir = Path::Class::Dir-
>new( $directory_where_files_are_located );
my @files = grep { $_->isa('Path::Class::File') } $dir->children; my @sorted_files = sort { $a->basename cmp $b->basename } @files; my $latest = pop @sorted_files; You can likely put this into a subroutine for use within your application. Hopefully this helps. - Stevan On Jan 26, 2011, at 9:06 AM, Meir Guttman via RT wrote:
> Queue: Path-Class-Versioned > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=64183 > > > Dear Steven, > > So far I could determine what is the current version using other > means. But > now I am doing a file Read-Modify-Write application that should > preserve all > previous file versions. The Path::Class::Versioned would be the > right and > coolest way to go. > Are you less pressed now than before the holidays...? > Best regards, > Meir > > > > -----Original Message----- > From: Stevan Little via RT [mailto:bug-Path-Class-Versioned@rt.cpan.org > ] > Sent: Friday, December 24, 2010 12:06 AM > To: meir@guttman.co.il > Subject: [rt.cpan.org #64183] Add "->latest_xxx" methods > > <URL: https://rt.cpan.org/Ticket/Display.html?id=64183 > > > Sure that would work, you are welcome to whip up a patch to do that > if you > want, I am currently too busy with work and the holidays to get it > right > now. > > - Stevan > > > >