|
|
Up |
|
|
  |
Author: fishfryfishfry
Date: Feb 16, 2008 21:21
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
|
| Show full article (1.47Kb) |
|
| |
2 Comments |
|
  |
Author: nopohacknopohack
Date: Feb 16, 2008 21:02
Hello,
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?
Currently I am thinking that I need to DNS lookups on each hostname to
verify that it resolves, but one would think that attempting to ping a
non-existant host would return undef.
TIA!
|
| |
|
| |
1 Comment |
|
  |
Author: RoseRose
Date: Feb 16, 2008 18:21
Thanks to Ben's and Michele's advice, I'm reconfirming the modeule
installation.
cpan[61]> install Imager
Imager is up to date (0.62).
Indeed the problem may arise because intially I did by:
install Bundle:Imager
following some web "instructions".
and later I also tried:
install GD
install PGPLOT
and so.
When I tried to uninstall them, I went to perl directory but could not find
the modules and therefore could not "delete" them. Now I guess maybe the
installation was not clean and makes the problem happen.
the author's codes are:
use Imager;
use Imager::Plot;
|
| Show full article (1.84Kb) |
|
no comments
|
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Feb 16, 2008 18:03
This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
4.3: Why isn't my octal data interpreted correctly?
(contributed by brian d foy)
You're probably trying to convert a string to a number, which Perl only
converts as a decimal number. When Perl converts a string to a number,
it ignores leading spaces and zeroes, then assumes the rest of the
digits are in base 10:
my $string = '0644';
print $string + 0; # prints 644
print $string + 44; # prints 688, certainly not octal!
This problem usually involves one of the Perl built-ins that has the
same name a unix command that uses octal numbers as arguments on the
command line. In this example, "chmod" on the command line knows that
its first argument is octal because that's what it does:
|
| Show full article (2.62Kb) |
|
no comments
|
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Feb 16, 2008 12:03
This is an excerpt from the latest version perlfaq3.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
3.23: Can I write useful Perl programs on the command line?
Yes. Read perlrun for more information. Some examples follow. (These
assume standard Unix shell quoting rules.)
# sum first and last fields
perl -lane 'print $F[0] + $F[-1]' *
# identify text files
perl -le 'for(@ARGV) {print if -f && -T _}' *
# remove (most) comments from C program
perl -0777 -pe 's{/\*.*?\*/}{}gs' foo.c
# make file a month younger than today, defeating reaper daemons
perl -e '$X=24*60*60; utime(time(),time() + 30 * $X,@ARGV)' *
# find first unused uid
perl -le '$i++ while getpwuid($i); print $i'
|
| Show full article (1.87Kb) |
|
no comments
|
|
  |
Author: RoseRose
Date: Feb 16, 2008 08:33
my string containing a number of alphabets is loaded by:
ss= fscanf(ssfid,'%%s',[1 inf]);
the xy coordinates are read by:
xy = fscanf(fid,'%%d %%g ',[2 inf]);
when I try to plot by:
plot ( xy(1,:), xy(2,:) );
set(gca, 'XTick',ss, 'XTickLabel',ss );
all the data clump together but
for ii = 1:size(xy(1,:))
text(xy(1,ii)+0.2,xy(2,ii),ss);
end
does not have the problem. How to solve that? I want to put the ss alphabets
as X tick labels.
|
| |
|
1 Comment |
|
  |
Author: RoseRose
Date: Feb 16, 2008 08:12
Instead of specifying in detail (e.g. d+d+...) in a regular expression, is
it possible to specify some fixed numbers for perl to extract information,
in this example, S, 95 from line 1; 'space',42 from line2 and 'T',156 from
line3 in the following 3 lines?
46 51 V S S- 0 0 95 -2,-0.9 -7,-0.2 -6,-0.2
2,-0.1 -0.899 75.7-167.1-103.3 112.1 10.3 5.4 11.8
47 52 E > - 0 0 42 -9,-2.9 3,-1.9 -2,-0.6
2,-0.2 -0.404 37.9 -78.0 -91.0 165.9 6.6 5.6 11.1
48 53 K T 3 S+ 0 0 156 1,-0.3 -1,-0.1
2,-0.2 -10,-0.0 -0.457 122.1 14.4 -66.2 127.7 4.9 5.9 7.7
|
| |
|
3 Comments |
|
  |
Author: ToddTodd
Date: Feb 16, 2008 07:30
Why can't we explicit using local loop variable in the code snippet
below?
#! /bin/perl
for local $a (1..2) {
print $a;
}
__END__
syntax error at - line 3, near "for local"
Execution of - aborted due to compilation errors.
You see here `my'/`our' are allowed in the code snippet below, why not
`local'?
#! /bin/perl
for my $a (1..2) {
print $a;
}
__END__
12
#! /bin/perl
|
| Show full article (0.54Kb) |
|
13 Comments |
|
  |
Author: RoseRose
Date: Feb 16, 2008 07:15
I'm testing the codes obtained from internet:
use Imager;
use Imager::Plot;
$plot = Imager::Plot->new(Width => 550,
Height => 350,
GlobalFont => 'ImUgly.ttf');
my @X = 0..100;
my @Y = map { sin($_/10) } @X;
my @Z = map { 1+cos($_/10) } @X;
$plot->AddDataSet(X => \@X, Y => \@Z);
$plot->AddDataSet(X => \@X, Y => \@Y,
style=>{marker=>{size => 2,
symbol => 'circle',
color => Imager::Color->new('red'),
},
});
$img = Imager->new(xsize=>600, ysize => 400);
$img->box(filled=>1, color=>'white');
|
| Show full article (1.71Kb) |
|
4 Comments |
|
  |
|
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Feb 16, 2008 06:03
This is an excerpt from the latest version perlfaq3.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
3.24: Why don't Perl one-liners work on my DOS/Mac/VMS system?
The problem is usually that the command interpreters on those systems
have rather different ideas about quoting than the Unix shells under
which the one-liners were created. On some systems, you may have to
change single-quotes to double ones, which you must *NOT* do on Unix or
Plan9 systems. You might also have to change a single %% to a %%%%.
For example:
# Unix (including Mac OS X)
perl -e 'print "Hello world\n"'
# DOS, etc.
perl -e "print \"Hello world\n\""
|
| Show full article (2.64Kb) |
|
no comments
|
|
|
|
|
|
|