[26397] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 8568 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 25 18:05:30 2005

Date: Tue, 25 Oct 2005 15:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 25 Oct 2005     Volume: 10 Number: 8568

Today's topics:
    Re: Access a c++ module from Perl <"harryfmudd [AT] comcast [DOT] net">
        FAQ 7.16 What's the difference between dynamic and lexi <comdog@pair.com>
    Re: varhash question (Jeremy Billones)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 25 Oct 2005 14:51:59 -0400
From: "harryfmudd [AT] comcast [DOT] net" <"harryfmudd [AT] comcast [DOT] net">
Subject: Re: Access a c++ module from Perl
Message-Id: <2qGdncmm-bpN48PeRVn-hg@comcast.com>

bg-greece wrote:
> the dll was created with with Microsoft Visual C++ 6.0

Are you using the Cygwin distribution of Perl? I think you will find 
that it was _not_ made with Visual C++ V6, but with gcc.

I personally have had good luck with Win32::API, though sometimes it was 
not obvious how to describe the function I wanted to import, and when 
you get the description wrong, you do get segment violations. I do not 
remember using the new, sexy prototype interface, just the old, clunky 
one. See Win32::Process::Info::NT for an example.

Disclaimer: I wrote the cited module. And I never said it was a _good_ 
example.

Tom Wyant


------------------------------

Date: Tue, 25 Oct 2005 22:03:01 +0000 (UTC)
From: PerlFAQ Server <comdog@pair.com>
Subject: FAQ 7.16 What's the difference between dynamic and lexical (static) scoping?  Between local() and my()?
Message-Id: <djma2l$6r7$1@reader2.panix.com>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.

--------------------------------------------------------------------

7.16: What's the difference between dynamic and lexical (static) scoping?  Between local() and my()?

    "local($x)" saves away the old value of the global variable $x and
    assigns a new value for the duration of the subroutine *which is visible
    in other functions called from that subroutine*. This is done at
    run-time, so is called dynamic scoping. local() always affects global
    variables, also called package variables or dynamic variables.

    "my($x)" creates a new variable that is only visible in the current
    subroutine. This is done at compile-time, so it is called lexical or
    static scoping. my() always affects private variables, also called
    lexical variables or (improperly) static(ly scoped) variables.

    For instance:

        sub visible {
            print "var has value $var\n";
        }

        sub dynamic {
            local $var = 'local';   # new temporary value for the still-global
            visible();              #   variable called $var
        }

        sub lexical {
            my $var = 'private';    # new private variable, $var
            visible();              # (invisible outside of sub scope)
        }

        $var = 'global';

        visible();                  # prints global
        dynamic();                  # prints local
        lexical();                  # prints global

    Notice how at no point does the value "private" get printed. That's
    because $var only has that value within the block of the lexical()
    function, and it is hidden from called subroutine.

    In summary, local() doesn't make what you think of as private, local
    variables. It gives a global variable a temporary value. my() is what
    you're looking for if you want private variables.

    See "Private Variables via my()" in perlsub and "Temporary Values via
    local()" in perlsub for excruciating details.



--------------------------------------------------------------------

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-2002 Tom Christiansen and Nathan
    Torkington, and other contributors as noted. All rights 
    reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.


------------------------------

Date: Tue, 25 Oct 2005 18:57:06 -0000
From: billones@radix.net (Jeremy Billones)
Subject: Re: varhash question
Message-Id: <11lt0022j6458f8@corp.supernews.com>

I've discovered that a major portion of the problem is a conflict within
Cygwin as to how it accesses files and filenames, which is propogated
all the way through the application (which assumes a UNIX file layout
and which cygwin doesn't quite support completely).

*Those* scripts I think I can edit.

Again, thanks all for putting up with (yet another) Perl newbie.

-- 
Jeremy Billones
"It's a place used the world over where people can come together to bitch about
movies and share pornography together."  This is a much more sophisticated idea
of the Net than we find in high-tech cyberthrillers, where the Net is a place
that makes your computer beep a lot.     - Roger Ebert on "Jay & Silent Bob..."



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 8568
***************************************


home help back first fref pref prev next nref lref last post