<div dir="ltr"><div><div><div><div><div><div><div>Hi peoples,<br></div> I am back to web-dev after a break to start a restaurant (now coding for the restaurant instead of cooking all the time).<br><br>Anyway I believe I am having a problem revolving around utf-8 encoding (breaking dbix internals with data going in) - maybe in the way I have the dbic setup. I also suspect that this is something that would cause me bigger problems in the future.<br>
<br></div><div>Here is the relevant parts of my config.yaml - this would be my first guess as to the source - this is my first dancer project.<br><br>charset: "UTF-8"<br><br># template engine<br># simple: default and very basic template engine<br>
# template_toolkit: TT<br><br>template: "simple"<br>session: YAML<br>#template: "template_toolkit"<br>## engines:<br># template_toolkit:<br># encoding: 'utf8'<br># start_tag: '[%'<br>
# end_tag: '%]'<br><br>plugins:<br> Auth::RBAC:<br> credentials:<br> class: SanteriaAuth<br> DBIC:<br> default:<br> dsn: dbi:mysql:Santeria<br> user: root<br> pass: secritpass<br>
schema_class: My::Schema<br> options:<br> mysql_enable_utf8: 1<br> Database:<br> driver: 'mysql'<br> database: 'Santeria'<br> host: 'localhost'<br>
port: 3306<br> username: 'root'<br> password: 'secritpass'<br> connection_check_threshold: 10<br> dbi_params:<br> RaiseError: 1<br> AutoCommit: 1<br>
on_connect_do: ["SET NAMES 'utf8'", "SET CHARACTER SET 'utf8'" ]<br> log_queries: 1<br><br></div><div>Other possible problems:<br><br></div><div>I am running Ubuntu 12.04.1 LTS as my platform - so I would hope to have necessary perl versions, mysql versions to make that work. However I will happily dig in deeper in that area if needed.<br>
<br></div><div>Maybe a mysql configuration?<br><br></div><div>Any help appreciated - if you live near Portland Oregon I'll buy you a burrito.<br></div><div><br></div><div>from here on down may not be necessary reading for someone familiar with the utf8 issues if the stuff above is ok then maybe deeper digging is required.<br>
<br></div><div><br><br></div>The problem came up when using Dancer::Plugin::Passphrase but I think that this is not relevant to my real problem.<br><br></div>I noticed in when I ran this code<br><br>any '/makehash' => sub{<br>
my $hash = passphrase( param('1234') )->generate_hash;<br> my $user = schema->resultset('SantEmployee')->find(15);<br> $user->pin($hash);<br> $user->update;<br><br>};<br></div>
when I try to update the users pin, it crashes dbix internals- <br><br>Operation "eq": no method found,<br> left argument has no overloaded magic,<br> right argument in overloaded package Dancer::Plugin::Passphrase at /usr/local/share/perl/5.14.2/DBIx/Class/Row.pm line 901, <DATA> line 16. in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 98<br>
<br></div>I can quote the value of hash going into dbix like so<br> <br>$user->pin($hash);<br></div><br>but I don't remember doing that in my pre utf-8 days of coding so I am thinking I have mysql taking the data from perl incorrecty.<br>
<br></div>Also when I try to match the passphrase against the pin, it doesn’t match and I really think it should.<br><br> my $user = schema->resultset('SantEmployee')->find(15);<br> my $pin = $user->pin;<br>
my $result = passphrase('1234')->matches($pin);<br> if ($result){print $result}else{print "nomatches $pin"};<br><br><pre><p>nomatches {CRYPT}$2a$04$..XDNZXxKq9/zhpeu4VsbOgXSSonxsoPHX75/kN9H6nvM/oIhhYIWHTTP/1.0 200 OK</pre>
<br><div><br><br><br><div><div><div><br clear="all"><div><div><div>
<div><div><br>-- <br>Wade Burgett<br>el hefe<br>
Santeria<br>
<a href="http://thesanteria.com" target="_blank">http://thesanteria.com</a><br>
<a href="tel:503-939-4719" value="+15039394719" target="_blank">503-939-4719</a>
</div></div></div></div></div></div></div></div></div></div>