[30041] in Perl-Users-Digest
Perl-Users Digest, Issue: 1284 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 18 00:09:50 2008
Date: Sun, 17 Feb 2008 21:09:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 17 Feb 2008 Volume: 11 Number: 1284
Today's topics:
Re: a newbie encounters difficulties in using module <bik.mido@tiscalinet.it>
bash and perl <dw149@acmex.gatech.edu>
Re: bash and perl <ben@morrow.me.uk>
Re: Fast checksums? <joe@inwap.com>
Linux, IO::Socket::INET and recv'ing broadcasted UDP <DJStunks@gmail.com>
Re: Linux, IO::Socket::INET and recv'ing broadcasted UD <ben@morrow.me.uk>
Re: Linux, IO::Socket::INET and recv'ing broadcasted UD <DJStunks@gmail.com>
Re: Net::Ping - problems with syn proto <ben@morrow.me.uk>
new CPAN modules on Sun Feb 17 2008 (Randal Schwartz)
Re: Newbie: Non-interactive status displays - HOWTO? <halfcountplus@intergate.com>
OS X Foundation.pm, PerlObjCBridge, and Wacom tablet is <BLOCKSPAMfishfry@your-mailbox.com>
Re: OS X Foundation.pm, PerlObjCBridge, and Wacom table <ben@morrow.me.uk>
Re: OS X Foundation.pm, PerlObjCBridge, and Wacom table <BLOCKSPAMfishfry@your-mailbox.com>
Regular Expression to Replace UPPER Case Text with lowe <kevin.penny@gmail.com>
Re: Regular Expression to Replace UPPER Case Text with <noreply@gunnar.cc>
Re: Strange behaviour while string concatenation <joe@inwap.com>
Re: Why `for local $var (LIST) ...' not allowed? <uri@stemsystems.com>
Re: Why `for local $var (LIST) ...' not allowed? <xueweizhong@gmail.com>
Re: Why `for local $var (LIST) ...' not allowed? <tadmc@seesig.invalid>
Re: Why `for local $var (LIST) ...' not allowed? <uri@stemsystems.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 18 Feb 2008 00:20:43 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: a newbie encounters difficulties in using module
Message-Id: <3aghr39jouepeg182ug0pgogqv1rv0ud6u@4ax.com>
On Sat, 16 Feb 2008 23:55:19 +0000, Ben Morrow <ben@morrow.me.uk>
wrote:
>> Unless she "installed" by copying Imager.pm into the appropriate
>> directory, which in "I'm testing the codes obtained from internet"
>> context may not be completely unreasonable as a possibility.
>
>No, but she did say
>
>> >> I already installed Imager by CPAN.
>> >>
>> >> install Imager
>
>which ought to have done the right thing.
Sorry!
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Mon, 18 Feb 2008 01:49:53 +0000 (UTC)
From: David Williams <dw149@acmex.gatech.edu>
Subject: bash and perl
Message-Id: <fpao81$t96$1@news-int2.gatech.edu>
I don't think my first message went through.
Wondering if there is a way to mix perl and shell scripts?
Like this:
#!/usr/bin/perl
.
.
.
#!/bin/bash
.
.
.
I tried this above but Perl did not like it.
David
--
David Williams
Georgia Institute of Technology, Atlanta Georgia, 30332
Email: dw149@prism.gatech.edu
------------------------------
Date: Mon, 18 Feb 2008 02:41:42 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: bash and perl
Message-Id: <6s7n85-iuc.ln1@osiris.mauzo.dyndns.org>
Quoth David Williams <dw149@acmex.gatech.edu>:
> I don't think my first message went through.
> Wondering if there is a way to mix perl and shell scripts?
>
> Like this:
>
> #!/usr/bin/perl
<snip>
> #!/bin/bash
<snip>
> I tried this above but Perl did not like it.
What are you actually trying to achieve? When do you want the shell to
be executed? You can easily include shell in your Perl script, as a
heredoc, and then feed it to /bin/bash or anything else...
Ben
------------------------------
Date: Sun, 17 Feb 2008 02:09:57 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: Fast checksums?
Message-Id: <S7idnRNpw91qmiXanZ2dnUVZ_vqpnZ2d@comcast.com>
George Adams wrote:
> info they find in the ID3 tags?). Even if no changes are ultimately
> made to the file, the mtime is still changed, fooling my Perl script
> into thinking it needs backing up. And that's just for MP3s.
I solved a similar problem. It won't work for the general case,
but it did work for the types of files I was dealing with: checksum
only part of the file.
For files greater than 2 megabytes, feed only the first megabyte of
the file and the last megabyte of the file to the checksum algorithm.
In my case, there were only a handful of files that received random-access
updates into the middle of the file. Those were databases that needed
to be special-cased anyway. All other modifications were detected
by the first+last MB checksum trick.
-Joe
------------------------------
Date: Sun, 17 Feb 2008 07:24:24 -0800 (PST)
From: DJ Stunks <DJStunks@gmail.com>
Subject: Linux, IO::Socket::INET and recv'ing broadcasted UDP
Message-Id: <d7a5480d-5c13-49fa-8115-2db9a356a4d4@u10g2000prn.googlegroups.com>
Hey all, it's been a while since I hung out here but I still use Perl
from time to time (and miss using it!).
Anyway, I originally posted this question at comp.lang.perl.modules
but I'm not getting any responses and I'm not sure it's a modules
question anyway - maybe more a socket/Linux problem.
Original post here (includes code):
http://groups.google.com/group/comp.lang.perl.modules/msg/8ce530096fe7fdac?
In summary, I'm attempting to use Net::DHCP::Packet and
IO::Socket::INET to generate, transmit and receive DHCP messages
(discover, offer, request, ack). The problem is that I'm not able to
use the IO::Socket recv method to receive a broadcasted DHCP offer
packet. My script blocks indefinitely though I see the offer arrive
via Wireshark.
I'm following the example from the Net::DHCP::Packet package and, in
Googling, no one else mentions issues with this. Therefore I assume
that the error is on my part - probably a simple error - but I don't
know enough to diagnose it.
As I mentioned, I'm using Linux with eth0 set up with a static IP
(10.0.0.1). I was not able to set the interface to 0.0.0.0 as I'd
assumed I should in order to perform DHCP transactions.
I'm open to any and all suggestions, tips, etc.
Thanks in advance,
-jp
------------------------------
Date: Mon, 18 Feb 2008 04:10:58 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Linux, IO::Socket::INET and recv'ing broadcasted UDP
Message-Id: <i3dn85-g8h.ln1@osiris.mauzo.dyndns.org>
Quoth DJ Stunks <DJStunks@gmail.com>:
> Hey all, it's been a while since I hung out here but I still use Perl
> from time to time (and miss using it!).
>
> Anyway, I originally posted this question at comp.lang.perl.modules
> but I'm not getting any responses and I'm not sure it's a modules
> question anyway - maybe more a socket/Linux problem.
>
> Original post here (includes code):
>
> http://groups.google.com/group/comp.lang.perl.modules/msg/8ce530096fe7fdac?
>
> In summary, I'm attempting to use Net::DHCP::Packet and
> IO::Socket::INET to generate, transmit and receive DHCP messages
> (discover, offer, request, ack). The problem is that I'm not able to
> use the IO::Socket recv method to receive a broadcasted DHCP offer
> packet. My script blocks indefinitely though I see the offer arrive
> via Wireshark.
In that message, you wrote:
|
| #open socket for packet tx & rx
| my $socket = IO::Socket::INET->new( Proto => 'udp',
| Broadcast => 1,
| LocalAddr => '10.0.0.1',
| LocalPort => 68,
| PeerAddr => '255.255.255.255',
| PeerPort => 67,
| ) || die "Unable to create socket: $@\n";
|
| my $discover = Net::DHCP::Packet->new(
| Xid => int rand(0xFFFFFFFF),
| Chaddr => 00011aabbccd,
| DHO_DHCP_MESSAGE_TYPE() => DHCPDISCOVER(),
| DHO_VENDOR_CLASS_IDENTIFIER() => 'MyVendorClassID',
| DHO_DHCP_PARAMETER_REQUEST_LIST() => '1 2 6 12 15 28 67',
| );
RFC 2131 says "If the broadcast bit is not set and 'giaddr' is zero and
'ciaddr' is zero, then the server unicasts DHCPOFFER and DHCPACK
messages to the client's hardware address and 'yiaddr' address.". That
applies here, so the packet will not be broadcast, it will be sent as a
unicast Ethernet frame to your claimed hardware address
(00:01:1a:ab:bc:cd) with an IP packet addressed to your claimed IP addr
(0.0.0.0, since you didn't set yiaddr) inside.
Even if this packet gets to you (are you using your real hardware
address?) you can't read such a packet from an IP socket under Linux.
You need to put the interface in promiscuous mode (which requires root)
and use a PF_PACKET socket with an appropriate filter to get hold of the
packet. See e.g. setup_packet_filters, open_socket and get_packet in
http://git.marples.name/?p=dhcpcd/.git;a=blob;f=socket.c (make sure you
read the #ifdef __linux__ version).
Alternatively, you could try setting Flags => 1, which asks for the
reply to be broadcast (for the sake of clients whose IP stacks can't
cope with confusingly-addressed packets), in which case an ordinary UDP
socket should be able to pick it up.
Ben
------------------------------
Date: Sun, 17 Feb 2008 20:55:27 -0800 (PST)
From: DJ Stunks <DJStunks@gmail.com>
Subject: Re: Linux, IO::Socket::INET and recv'ing broadcasted UDP
Message-Id: <c5e3b8d5-ace8-4dd8-a90f-bfb0faa281e0@e6g2000prf.googlegroups.com>
On Feb 17, 9:10 pm, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth DJ Stunks <DJStu...@gmail.com>:
>
>
>
> > Hey all, it's been a while since I hung out here but I still use Perl
> > from time to time (and miss using it!).
>
> > Anyway, I originally posted this question at comp.lang.perl.modules
> > but I'm not getting any responses and I'm not sure it's a modules
> > question anyway - maybe more a socket/Linux problem.
>
> > Original post here (includes code):
>
> >http://groups.google.com/group/comp.lang.perl.modules/msg/8ce530096fe...
>
> > In summary, I'm attempting to use Net::DHCP::Packet and
> > IO::Socket::INET to generate, transmit and receive DHCP messages
> > (discover, offer, request, ack). The problem is that I'm not able to
> > use the IO::Socket recv method to receive a broadcasted DHCP offer
> > packet. My script blocks indefinitely though I see the offer arrive
> > via Wireshark.
>
> In that message, you wrote:
> |
> | #open socket for packet tx & rx
> | my $socket = IO::Socket::INET->new( Proto => 'udp',
> | Broadcast => 1,
> | LocalAddr => '10.0.0.1',
> | LocalPort => 68,
> | PeerAddr => '255.255.255.255',
> | PeerPort => 67,
> | ) || die "Unable to create socket: $@\n";
> |
> | my $discover = Net::DHCP::Packet->new(
> | Xid => int rand(0xFFFFFFFF),
> | Chaddr => 00011aabbccd,
> | DHO_DHCP_MESSAGE_TYPE() => DHCPDISCOVER(),
> | DHO_VENDOR_CLASS_IDENTIFIER() => 'MyVendorClassID',
> | DHO_DHCP_PARAMETER_REQUEST_LIST() => '1 2 6 12 15 28 67',
> | );
>
> RFC 2131 says "If the broadcast bit is not set and 'giaddr' is zero and
> 'ciaddr' is zero, then the server unicasts DHCPOFFER and DHCPACK
> messages to the client's hardware address and 'yiaddr' address.". That
> applies here, so the packet will not be broadcast, it will be sent as a
> unicast Ethernet frame to your claimed hardware address
> (00:01:1a:ab:bc:cd) with an IP packet addressed to your claimed IP addr
> (0.0.0.0, since you didn't set yiaddr) inside.
>
> Even if this packet gets to you (are you using your real hardware
> address?) you can't read such a packet from an IP socket under Linux.
> You need to put the interface in promiscuous mode (which requires root)
> and use a PF_PACKET socket with an appropriate filter to get hold of the
> packet. See e.g. setup_packet_filters, open_socket and get_packet inhttp://git.marples.name/?p=dhcpcd/.git;a=blob;f=socket.c(make sure you
> read the #ifdef __linux__ version).
>
> Alternatively, you could try setting Flags => 1, which asks for the
> reply to be broadcast (for the sake of clients whose IP stacks can't
> cope with confusingly-addressed packets), in which case an ordinary UDP
> socket should be able to pick it up.
Hi Ben,
Thanks for the reply.
The DHCP Offer I'm receiving is definitely addressed to destination IP
255.255.255.255:68 (perhaps my DHCP server is non-compliant?). I did
try setting Flags => 1 as one of my tests and it didn't make a
difference but I'll repeat it to be sure.
The Linux stuff is interesting. I'm not using my true hardware
address because the goal of the test is to check the DHCP behavior for
various hardware classes. Perhaps that's the problem. I'll go over
what you suggested and give it a try in the morning.
I wasn't able to set eth0 to 0.0.0.0 using ifconfig but you're right,
yiaddr is 0.0.0.0 within the discover payload.
-jp
------------------------------
Date: Sun, 17 Feb 2008 06:39:10 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Net::Ping - problems with syn proto
Message-Id: <ed1l85-691.ln1@osiris.mauzo.dyndns.org>
Quoth nopohack <dubito.ergo.sum@gmail.com>:
>
> I am attempting to use Net::Ping as part of a script to validate
> entries in our automount maps. To speed the process of checking the
> mount points, I am using Net::Ping to contact the nfs server to make
> sure it is up. I know there are a few entries that reference NFS
> servers that have been decommissioned, which is causing me problems.
>
> When I try to do a $p->ack($host) and the hostname isn't registered in
> DNS Net::Ping dies. Is there a trick to get the ack method to not kill
> my script when the hostname lookup fails?
I can't see any reason that should happen. Can you post a (minimal)
complete script, together with expected and actual output?
In general, if a function is dieing when you don't want it to you avoid
this by wrapping the call in eval {}, but Net::Ping->ack shouldn't die
under normal circumstances.
Ben
------------------------------
Date: Sun, 17 Feb 2008 05:42:17 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sun Feb 17 2008
Message-Id: <JwDBuH.1y4n@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
AI-MaxEntropy-0.11
http://search.cpan.org/~laye/AI-MaxEntropy-0.11/
Perl extension for learning Maximum Entropy Models
----
Algorithm-LBFGS-0.16
http://search.cpan.org/~laye/Algorithm-LBFGS-0.16/
Perl extension for L-BFGS
----
CPAN-SQLite-0.195
http://search.cpan.org/~rkobes/CPAN-SQLite-0.195/
maintain and search a minimal CPAN database
----
Dir-Split-0.80
http://search.cpan.org/~schubiger/Dir-Split-0.80/
Split files of a directory to subdirectories
----
HTML-FillInForm-Lite-0.05
http://search.cpan.org/~gfuji/HTML-FillInForm-Lite-0.05/
Fills in HTML forms with data
----
I18N-Charset-1.387
http://search.cpan.org/~mthurn/I18N-Charset-1.387/
IANA Character Set Registry names and Unicode::MapUTF8 (et al.) conversion scheme names
----
JS-0.10
http://search.cpan.org/~ingy/JS-0.10/
JavaScript Modules on CPAN
----
JS-0.11
http://search.cpan.org/~ingy/JS-0.11/
JavaScript Modules on CPAN
----
JS-YAML-0.11
http://search.cpan.org/~ingy/JS-YAML-0.11/
----
JSON-2.07
http://search.cpan.org/~makamaka/JSON-2.07/
JSON (JavaScript Object Notation) encoder/decoder
----
Log-Handler-0.38_13
http://search.cpan.org/~bloonix/Log-Handler-0.38_13/
Log messages to one or more outputs.
----
Log-Handler-0.38_14
http://search.cpan.org/~bloonix/Log-Handler-0.38_14/
Log messages to one or more outputs.
----
Net-DownloadMirror-0.07
http://search.cpan.org/~knorr/Net-DownloadMirror-0.07/
Perl extension for mirroring a remote location via FTP to the local directory
----
Net-Frame-Dump-1.01
http://search.cpan.org/~gomor/Net-Frame-Dump-1.01/
tcpdump like implementation
----
Net-MirrorDir-0.10
http://search.cpan.org/~knorr/Net-MirrorDir-0.10/
Perl extension for compare local-directories and remote-directories with each other
----
Net-Twitter-1.07
http://search.cpan.org/~cthom/Net-Twitter-1.07/
Perl interface to twitter.com
----
POE-Component-IRC-5.64
http://search.cpan.org/~bingos/POE-Component-IRC-5.64/
a fully event-driven IRC client module.
----
POE-Component-Server-IRC-1.26
http://search.cpan.org/~bingos/POE-Component-Server-IRC-1.26/
A fully event-driven networkable IRC server daemon module.
----
POEIKC-0.00_02
http://search.cpan.org/~suzuki/POEIKC-0.00_02/
POE IKC daemon and client
----
Pod-HtmlEasy-1.000
http://search.cpan.org/~gleach/Pod-HtmlEasy-1.000/
Generate personalized HTML from PODs.
----
Pod-HtmlEasy-1.0000
http://search.cpan.org/~gleach/Pod-HtmlEasy-1.0000/
Generate personalized HTML from PODs.
----
SOAP-Lite-0.70_06
http://search.cpan.org/~mkutter/SOAP-Lite-0.70_06/
Perl's Web Services Toolkit
----
Socket6-0.20
http://search.cpan.org/~umemoto/Socket6-0.20/
IPv6 related part of the C socket.h defines and structure manipulators
----
Test-Continuous-0.0.1
http://search.cpan.org/~gugod/Test-Continuous-0.0.1/
Run your tests suit continusouly when developing .
----
Test-Continuous-0.0.2
http://search.cpan.org/~gugod/Test-Continuous-0.0.2/
Run your tests suite continusouly when developing.
----
Test-Exception-0.27
http://search.cpan.org/~adie/Test-Exception-0.27/
Test exception based code
----
YAML-Syck-1.02
http://search.cpan.org/~audreyt/YAML-Syck-1.02/
Fast, lightweight YAML loader and dumper
----
YAML-Syck-1.03
http://search.cpan.org/~audreyt/YAML-Syck-1.03/
Fast, lightweight YAML loader and dumper
----
YAML-Syck-1.04
http://search.cpan.org/~audreyt/YAML-Syck-1.04/
Fast, lightweight YAML loader and dumper
----
autobox-2.00
http://search.cpan.org/~chocolate/autobox-2.00/
use builtin data types as first-class objects
----
autobox-2.01
http://search.cpan.org/~chocolate/autobox-2.01/
use builtin data types as first-class objects
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Sun, 17 Feb 2008 22:04:33 -0600
From: MK <halfcountplus@intergate.com>
Subject: Re: Newbie: Non-interactive status displays - HOWTO?
Message-Id: <jMudnckp97hMniTanZ2dnUVZ_qDinZ2d@pghconnect.com>
On Tue, 05 Feb 2008 11:43:55 -0600, Chris wrote:
> I'm a perl Tk newbie trying to create a pgm to display the status of
> several servers by a green/red indicator light. After going over some
> howto's & examples, I'm still stumped.
>
> All of the examples I can find are geared towards dealing with some user
> interaction (clicking buttons, typing text, etc.), but I'm looking for a
> non-interactive update of status lights, say when a server goes down,
> stops listening on a port, etc.
>
> Basically I'd like to know how to update a widget color based on results
> from a monitoring subroutine - ie how to pass info back into the Tk
> window. I tried setting a text widget to a global variable that gets
> manipulated in a routine forked prior to MainLoop, but no luck.
>
> Sooooo....can anybody provide guidance as how to pass values back into a
> Tk window? Examples greatly appreciated..
>
> TIA
It may be easier to destroy and recreate a widget, eg. in a different
color, than to change the color of an existing widget, and it looks
exactly the same.
------------------------------
Date: Sat, 16 Feb 2008 21:21:48 -0800
From: fishfry <BLOCKSPAMfishfry@your-mailbox.com>
Subject: OS X Foundation.pm, PerlObjCBridge, and Wacom tablet issues
Message-Id: <BLOCKSPAMfishfry-D262B1.21214816022008@comcast.dca.giganews.com>
Foundation.pm is a Mac OS X package that lets Perl programs access the
Objective-C libraries. It's not part of CPAN, it just ships with the OS
X version of Perl.
I have a Wacom tablet. The latest installer for the driver runs a Perl
script called postflight, that invokes Foundation.pm.
Rather than using the default Perl installation that ships with OS X,
I've long ago downloaded, built, and installed Perl into /usr/bin/perl.
This works flawlessly, except that Perl can no longer find
Foundation.pm. I discovered this tonight when attempting to install the
latest Wacom tablet driver.
I fixed that problem up by adding the line
use lib '/System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level';
to the postflight script. That's where Foundation.pm lives. However I
now get the error message
dyld: lazy symbol binding failed: Symbol not found: _Perl_Gthr_key_ptr
Referenced from:
/System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level/auto/PerlObj
CBridge/PerlObjCBridge.bundle
Expected in: dynamic lookup
There are some Google hits for this error, some of them indicating
problems with libperl. However I'm not sure why I'm getting the error
and I'm not sure what to do.
Has anyone sorted through these issues? I really don't want to have to
reinstall Tiger just to be forced to use the default installation of
Perl just so I can update my Wacom driver. There must be an easier way!!
Any suggestions appreciated. I'm on 10.4.11.
------------------------------
Date: Sun, 17 Feb 2008 07:00:29 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: OS X Foundation.pm, PerlObjCBridge, and Wacom tablet issues
Message-Id: <dl2l85-9g1.ln1@osiris.mauzo.dyndns.org>
Quoth fishfry <BLOCKSPAMfishfry@your-mailbox.com>:
> Foundation.pm is a Mac OS X package that lets Perl programs access the
> Objective-C libraries. It's not part of CPAN, it just ships with the OS
> X version of Perl.
>
> I have a Wacom tablet. The latest installer for the driver runs a Perl
> script called postflight, that invokes Foundation.pm.
>
> Rather than using the default Perl installation that ships with OS X,
> I've long ago downloaded, built, and installed Perl into /usr/bin/perl.
Don't do that. Did you read the section in README.macosx where it says
that? Overwriting the perl that ships with a system is nearly always a
bad idea. You should have installed your own perl into /usr/local,
though it would also have been better if OSX had done as Solaris does
and kept the system perl in /opt where it is out of the way.
> This works flawlessly, except that Perl can no longer find
> Foundation.pm. I discovered this tonight when attempting to install the
> latest Wacom tablet driver.
>
> I fixed that problem up by adding the line
>
> use lib '/System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level';
>
> to the postflight script. That's where Foundation.pm lives. However I
> now get the error message
>
> dyld: lazy symbol binding failed: Symbol not found: _Perl_Gthr_key_ptr
> Referenced from:
> /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level/auto/PerlObj
> CBridge/PerlObjCBridge.bundle
> Expected in: dynamic lookup
Which version of perl have you installed? What Configure options did you
use (in particular, did you build with ithreads/multiplicity/2level
libs/a shared libperl)? Are these the same as the system version of perl
(unlikely, as I would expect Configure to have added that directory to
@INC itself if it was going to work)? In general you shouldn't 'use lib'
with an arch-specific directory like that: if it's the right arch lib.pm
will find it on its own.
> Has anyone sorted through these issues? I really don't want to have to
> reinstall Tiger just to be forced to use the default installation of
> Perl just so I can update my Wacom driver. There must be an easier way!!
If you can find the XS source for the Foundation module (I don't know
whether it's part of the open-source bit of OSX or not) you may be able
to recompile it for your current perl. Otherwise you'll need to revert
to the correct perl for your system, I'm afraid. If it does come to that
I would expect you can get the system installer to just reinstall perl,
without redoing the rest of the installation. It may be wise to follow
the instructions in README.macosx about nuking all perl-related stuff
first.
Ben
------------------------------
Date: Sun, 17 Feb 2008 18:26:41 -0800
From: fishfry <BLOCKSPAMfishfry@your-mailbox.com>
Subject: Re: OS X Foundation.pm, PerlObjCBridge, and Wacom tablet issues
Message-Id: <BLOCKSPAMfishfry-FC6937.18264117022008@comcast.dca.giganews.com>
In article <dl2l85-9g1.ln1@osiris.mauzo.dyndns.org>,
Ben Morrow <ben@morrow.me.uk> wrote:
> Quoth fishfry <BLOCKSPAMfishfry@your-mailbox.com>:
> > Foundation.pm is a Mac OS X package that lets Perl programs access the
> > Objective-C libraries. It's not part of CPAN, it just ships with the OS
> > X version of Perl.
> >
> > I have a Wacom tablet. The latest installer for the driver runs a Perl
> > script called postflight, that invokes Foundation.pm.
> >
> > Rather than using the default Perl installation that ships with OS X,
> > I've long ago downloaded, built, and installed Perl into /usr/bin/perl.
>
> Don't do that. Did you read the section in README.macosx where it says
> that? Overwriting the perl that ships with a system is nearly always a
> bad idea. You should have installed your own perl into /usr/local,
> though it would also have been better if OSX had done as Solaris does
> and kept the system perl in /opt where it is out of the way.
Thank you much for your detailed reply. I've never had a problem with my
custom Perl installation before. Now that I've had the chance to think
about these issues, I realized that re-installing Tiger is the only way
to go. Otherwise I'll probably have more trouble down the road. I did a
clean install of Tiger, and now the Wacom driver installs without
incident.
I was running Perl 5.8.7, while the Tiger version is 5.8.6. That
probably accounts for the linker problems I encountered when trying to
work around this situation.
Thanks again.
------------------------------
Date: Sun, 17 Feb 2008 18:42:03 -0800 (PST)
From: penny <kevin.penny@gmail.com>
Subject: Regular Expression to Replace UPPER Case Text with lower case text
Message-Id: <63c756af-1b1b-47b9-974a-3937ebfa2d13@v3g2000hsc.googlegroups.com>
Is there a way in Regular Expressions to convert a string that is all
in upper case - and replace it with it's lower case equivalent?
I can do something like ([A-Z][A-Z]+\x?) to match any given word and
reference it as \1, however without using programming language lcase
or LOWER functions on it - how can I use reg ex to convert the text to
it's lower case equivalent??
Thanks - (I use coldfusion but the regular expression syntax is
similar)
------------------------------
Date: Mon, 18 Feb 2008 04:11:49 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Regular Expression to Replace UPPER Case Text with lower case text
Message-Id: <61sb80F1sk6scU1@mid.individual.net>
penny wrote:
> Is there a way in Regular Expressions to convert a string that is all
> in upper case - and replace it with it's lower case equivalent?
>
> I can do something like ([A-Z][A-Z]+\x?) to match any given word and
> reference it as \1, however without using programming language lcase
> or LOWER functions on it - how can I use reg ex to convert the text to
> it's lower case equivalent??
You can't. Regular expressions match or don't match. To change the
contents of a string, you need functions or operators (such as the s///
operator).
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sun, 17 Feb 2008 02:31:52 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: Strange behaviour while string concatenation
Message-Id: <Ksadncg3v9OIkCXanZ2dnUVZ_oCvnZ2d@comcast.com>
Rajpreet wrote:
> $self->{"log"}->debug(
>" temp 4,data[11],ctr value s are : $temp-> [4], $data->[11],$ctr ");
> $self->{"log"}->debug(" temp 4 value is : $temp->[4] ");
It is difficult to see where one value ends and another starts
when formatted that way. A better way to see your mistake is:
$self->{"log"}->debug(
" temp[4]='$temp->[4]', data[11]='$data->[11]', ctr='$ctr' ";
...
$self->{"log"}->debug(" temp[4]='$temp->[4]' ");
Using explicit delimiters (like single quotes) around the value
makes it easier to detect when the string has unexpected
characters at the end.
-Joe
------------------------------
Date: Sun, 17 Feb 2008 21:48:36 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Why `for local $var (LIST) ...' not allowed?
Message-Id: <x7mypzs18r.fsf@mail.sysarch.com>
>>>>> "T" == Todd <xueweizhong@gmail.com> writes:
T> Why can't we explicit using local loop variable in the code snippet
T> below?
T> #! /bin/perl
T> for local $a (1..2) {
T> print $a;
T> }
T> __END__
T> syntax error at - line 3, near "for local"
T> Execution of - aborted due to compilation errors.
T> You see here `my'/`our' are allowed in the code snippet below, why not
T> `local'?
why would you want local? do you know the difference between local and
my? do you know you can localize an our variable? do you also know not
to use $a (even in examples) as it is special cased with strict? this is
important as you are playing with scoped variables but i don't see
strict enabled.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Architecture, Development, Training, Support, Code Review ------
----------- Search or Offer Perl Jobs ----- http://jobs.perl.org ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Sun, 17 Feb 2008 19:59:23 -0800 (PST)
From: Todd <xueweizhong@gmail.com>
Subject: Re: Why `for local $var (LIST) ...' not allowed?
Message-Id: <e82de881-c782-4fef-a490-b272d90b3504@i29g2000prf.googlegroups.com>
Uri Guttman wrote:
> why would you want local? do you know the difference between local and
> my? do you know you can localize an our variable? do you also know not
> to use $a (even in examples) as it is special cased with strict? this is
> important as you are playing with scoped variables but i don't see
> strict enabled.
It's only an example. BTW, you seems like showing yourself as `guru'
rather than answer the question. Or did you answer the question?
-Todd
------------------------------
Date: Sun, 17 Feb 2008 22:10:52 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Why `for local $var (LIST) ...' not allowed?
Message-Id: <slrnfri1ac.9q8.tadmc@tadmc30.sbcglobal.net>
Todd <xueweizhong@gmail.com> wrote:
>
> Uri Guttman wrote:
>> why would you want local? do you know the difference between local and
>> my? do you know you can localize an our variable? do you also know not
>> to use $a (even in examples) as it is special cased with strict? this is
>> important as you are playing with scoped variables but i don't see
>> strict enabled.
>
> It's only an example.
Don't use $a for anything other than sorting, even in examples.
> BTW,
You should have resisted the urge to get smartass.
Off to the killfile you go...
> you seems like showing yourself as `guru'
> rather than answer the question.
Do you want to learn from a guru or from another newbie?
> Or did you answer the question?
He did.
If you researched the answers to his 4 questions, you would have
learned how to localize foreach's loop control variable, along
with 3 other things that are important to understand if you
hope to do much programming in Perl.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Mon, 18 Feb 2008 04:46:50 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Why `for local $var (LIST) ...' not allowed?
Message-Id: <x7wsp2ooqs.fsf@mail.sysarch.com>
>>>>> "T" == Todd <xueweizhong@gmail.com> writes:
T> Uri Guttman wrote:
>> why would you want local? do you know the difference between local and
>> my? do you know you can localize an our variable? do you also know not
>> to use $a (even in examples) as it is special cased with strict? this is
>> important as you are playing with scoped variables but i don't see
>> strict enabled.
T> It's only an example. BTW, you seems like showing yourself as `guru'
T> rather than answer the question. Or did you answer the question?
do you like showing yourself off to be an idiot? i asked you a couple of
questions to see if you have any real basis for asking your
question. you obviously don't. perl doesn't support local that
way. it actually makes little sense do it as it is trivial to work
around. but you don't seem to know why local is bad in most cases
anyhow. if you did you wouldn't ask such a question and you would
quickly know how to get the same results. (hint: localize a var BEFORE
the loop).
there, i answered the question. will you answer mine? i doubt it.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Architecture, Development, Training, Support, Code Review ------
----------- Search or Offer Perl Jobs ----- http://jobs.perl.org ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
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 V11 Issue 1284
***************************************