user-pic

Aristotle

Subscribe to feed Recent Actions from Aristotle

  • BooK commented on MakeMaker among the stars

    Yay! Don't let sticklers spoil a good pun!

  • Henryk Paluch commented on A Simple Mojolicious/DBI Example

    Hello!

    For Unicode support there are few fixes needed:

    Add:

    use Encode;
    plugin Charset => {charset => 'utf-8'};
    

    modify / method to:

    any '/' => sub {
      my $self = shift;
      my $rows = $self->select;
      # convert utf-8 octets -> unicode
      for my $Item ( @{ $rows } ){
          map { $_ = decode('utf-8',$_) } @{ $Item };
      }
      $self->stash( rows => $rows );
      $self->render('index');
    };
    

    Best regards

     —Henryk Paluch

  • shawnhcorey commented on Converting glob patterns to regular expressions

    Or you could use a hash for the convertion:

    my %convert = (
    '*' => '.*',
    '?' => '.',
    );

    s/(\W)/$convert{$1}||$1/eg;

  • Neil Bowers commented on Converting glob patterns to regular expressions

    You could have a look at glob_to_regex() in Text::Glob.

    I haven't checked it, but if it doesn't handle the cases discussed here, you could submit a PR tomorrow, as part of your CPAN Day celebration :-)

    And while you're there, you could add the github repo to the dist's metadata, so it will appear in the sidebar on MetaCPAN.

  • smls commented on Converting glob patterns to regular expressions

    I wrote this once, for one of my own scripts:

    
    # Given a glob pattern, return a regex that has the following behavior when
    # matched against Cwd::realpath canolicalized path strings:
    #  - matches successfully if and only if the path would have been matched by
    #    the original glob
    #  - $1, $2, ... will contain what would have been matched by groups of
    #    consecutive wildcards (*, ?, [...]) in the original glob
    #  - $::REGMARK will contain the numeric index of the "brace expansion"
    #    alternative in the original glob that would have first matched the path
    # If  tree => 1 …
Subscribe to feed Responses to Comments from Aristotle

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is hosted by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.