Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: storing pre-compiled binary regexes

by Random_Walk (Prior)
on Apr 14, 2008 at 10:57 UTC ( #680246=note: print w/replies, xml ) Need Help??


in reply to •Re: storing pre-compiled binary regexes
in thread storing pre-compiled binary regexes

Six years on and 5.10 is with us. Is it now possible to serialise and store the binary compiled version of the regex ?

Cheers,
R.

Pereant, qui ante nos nostra dixerunt!
  • Comment on Re^2: storing pre-compiled binary regexes

Replies are listed 'Best First'.
Re^3: storing pre-compiled binary regexes
by Random_Walk (Prior) on Apr 15, 2008 at 13:31 UTC

    OK, not sure if I am doing something wrong but from my testing Perl 5.10 can not do this either

    This is perl, v5.10.0 built for MSWin32-x86-multi-thread (with 3 registered patches, see perl -V for more detail)
    Here is an attempt to store some compiled regex
    #!/usr/bin/perl #create the Storable file use warnings; use Storable; use Data::Dumper; my %sigs; while (<DATA>){ chomp; ($name,$value) = split(/\s+=\s+/,$_); next unless $value; $sigs{$name}= qr/$value/; } store(\%sigs, 'z1.bin') or die "Can't store %a in z1.bin !\n"; print Dumper \%sigs; exit;
    And here I try to read it back again
    #!/usr/bin/perl #read the Storable file #use strict; use warnings; use Storable; use Data::Dumper; my %sigs = %{retrieve('z1.bin')} or die "Unable to retrieve from z1.bi +n:$!\n" ; print Dumper \%sigs; exit; __DATA__ 1_Friday = Friday 2_random = [Rr]andom 3_catch any = .*
    These are the results of the two dumps:
    C:\Perl_5_10\play>..\bin\perl store.pl $VAR1 = { '3_catch any' => qr/(?-xism:.*)/, '2_random' => qr/(?-xism:[Rr]andom)/, '1_Friday' => qr/(?-xism:Friday)/ }; C:\Perl_5_10\play>..\bin\perl read.pl $VAR1 = { '3_catch any' => qr/Regexp=SCALAR(0x1a6bca4)/, '2_random' => qr/Regexp=SCALAR(0x1a7c90c)/, '1_Friday' => qr/Regexp=SCALAR(0x1c47c7c)/ };
    if I try to use the read back regex they fail to match

    Cheers,
    R.

    Pereant, qui ante nos nostra dixerunt!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://680246]
help
Chatterbox?
[stonecolddevin]: https://open. spotify.com/track/ 0UVM9trirBK5s1xBwL oVhZ rather
[Corion]: Sadly I must go to bed now :-| See y'all!
[erix]: I really loved/love this "Recorded Live" record, 1973 (yes, I'm that old)
[stonecolddevin]: goodnight Corion
[erix]: cya Corion :)
[stevieb]: Joan Jett, Hendrix, Neil Young, Dave Keuning (The Killers)... I have my mind elsewhere so I'm limited in my capacity to think about this righ tnow ;)
[erix]: another blues with Big Red :)
[stonecolddevin]: I will say John Mayer is an excellent guitarist, I don't like his music but he's pretty damn good
[erix]: scd: maybe you like John Mayall better :)
[erix]: (mayall = british blues)

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2017-06-22 21:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (531 votes). Check out past polls.