[Israel.pm] Win32::TieRegistry question

Shmuel Fomberg semuelf at 012.net.il
Mon Jul 9 08:27:39 PDT 2007


Hello There.

I don't have 'ODBC Data Sources/' so I'm using 'ODBC File DSN/' instead,

But here it's working fine even without the first dump.

$VAR1 = bless( {
                 '/DefaultDSNDir' => 'C:\\Program Files\\Common
Files\\ODBC\\Data Sources'
               }, 'Win32::TieRegistry' );

Shmuel.

>-----Original Message-----
>From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On
Behalf
>Of Scott Weisman
>Sent: Monday, July 09, 2007 3:49 PM
>To: Perl in Israel
>Subject: [Israel.pm] Win32::TieRegistry question
>
>Hello,
>
>I've had the need to do some Perl development on Windows. One of the
>things I need to do is get all the DSNs available. I figured doing
>this using the Registry was easier than using the ODBC API. After much
>trial and error, this is what I got to work:
>
>===BEGIN CODE
>use Win32::TieRegistry ();
>
>
>use Data::Dumper;
>
>my $registry;
>
>
>
>use Win32::TieRegistry (Delimiter => '/', ArrayValues => 0, TiedRef =>
>\$registry, 'KEY_READ');
>
>
>
>my $entry = $$registry{'LMachine/SOFTWARE/ODBC/ODBC.INI/'};
>
>my $odbc_list = $$entry{'ODBC Data Sources/'};
>
>
>
>print Dumper($entry), "\n"; # see note below
>
>print Dumper($odbc_list), "\n";
>===END CODE
>
>
>Note 1: If I include this line, $odbc_list dumps this (which is
correct):
>
>$VAR1 = bless( {
>
>                 '/TEMPDB' => 'Pervasive ODBC Engine Interface',
>
>                 '/afw_davis' => 'SQL Server',
>
>                 '/afw_moser' => 'SQL Server',
>
>                 '/DEMODATA' => 'Pervasive ODBC Engine Interface',
>
>                 '/DefaultDB' => 'Pervasive ODBC Engine Interface',
>
>                 '/AGYFORMS' => 'Pervasive ODBC Engine Interface'
>
>               }, 'Win32::TieRegistry' );
>
>
>However, if don't dump $entry first, all I get is this (which is
>incorrect):
>
>$VAR1 = bless( {}, 'Win32::TieRegistry' );
>
>
>Even if I just reference $entry, nothing happens. I have to dump it
first.
>
>Can someone please help me? This is driving me crazy!
>
>Thanks,
>
>Scott
>_______________________________________________
>Perl mailing list
>Perl at perl.org.il
>http://perl.org.il/mailman/listinfo/perl
>
>
>--
>No virus found in this incoming message.
>Checked by AVG Free Edition.
>Version: 7.5.476 / Virus Database: 269.10.2/890 - Release Date:
07/07/2007
>15:26





More information about the Perl mailing list