Re: use Win32::TieRegistry if ($^O =~ /win32/i)



shelden0@xxxxxxxxxxx wrote:
I thought this would be really easy...how do I conditionally use a
package? I.e., only use the Registry Package if I'm on Windows?

Assuming you have a recent version of perl (I think 5.8.0 or higher,
maybe?), see:
perldoc if

If you don't have that recent a version of perl, either download this
module from CPAN (http://search.cpan.org/~ilyaz/if-0.0401/if.pm) or use
an eval on the two separate components of a 'use' statement. (See
perldoc -f use)

I tried wrapping in evals, etc., but they don't seem to work.

"does not work" is the worst of all possible error descriptions. *how*
does it not work? Syntax error? Runtime error? Incorrect output?
Computer blows up?

In fact, in this case, it must also be asked *what* does not work?
Where is the code that demonstrates what you tried? How can we help
you fix your code if you don't show us your code?

Perhaps because compliation errors cannot be trapped?

Ahh, there's the old standby. "I can't figure out how to do this,
therefore it must not be possible." Do you even realize how supremely
arrogant that question is?

Please read the posting guidelines for this group. They will help you
to ask better questions and therefore to get better answers.

Paul Lalli

.



Relevant Pages

  • Re: Net::DNS
    ... function because you still use $rr within the foreach, ... > So I can find the all these object methods in the perl docs listed below? ... > the return value of 'grep'. ... > perldoc perlboot ...
    (perl.beginners)
  • Re: Posting Guidelines changes (was Re: variable interpolation of refs to anonymous subroutines)
    ... Experts at Perl or experts at posting to newsgroups? ... use warnings; # see perldoc warnings ...
    (comp.lang.perl.misc)
  • Re: Multitasking
    ... Just a comment for the archives, and to any other beginner to the Perl ... When you look at the perldoc for select, perldoc -f select, you ... select FILEHANDLE ... I just meant avoid using the "Low-level socket functions" ...
    (perl.beginners)
  • Re: Teach me how to fish, regexp
    ... Thanks for your response on this thread: ... On the other hand, maybe "older" perl is ... > everything up in perldoc and man pages. ... > pattern so that a quantifier can apply to it. ...
    (comp.lang.perl.misc)
  • Re: Parse and Compare Text Files
    ... > I'm new to Perl and have what I hope is a simple question: ... > log with the categorized domains list file and creates a new file that looks ... perldoc -f print ... open file for writing to store updated log to ...
    (perl.beginners)