Re: ***regular expression***

2003-11-17 Thread xweb
Thanks all but...
I don't explain well the problem!
So, i'm processing a very big text file ( from A DB ) in this format
number|field 1|field2| field 3| etc. Every line is a record.Every line
contains many url.
I'm interested about specific url and i don't consider the others.

while ( $line =~ s/href=\"([^"]+)\"//) {
 $url = $1; ###ALL URL#
if ($url =~ m/\/[^,]+,([^,]+),([^,]+),[^,]+\.html?$/) {
   ($var1,$var2)=($1,$2); ###INTERESTING URL AND VALUES
}
}
In this way i obtain two values that interested me! It's works!
Now i must substitute these url the_link  with
the_link and then i write to a new file with this
substitution on all the field of file!
Can you help me?



perlmagick on panther working

2003-11-17 Thread william ross
hello again.

I've got perlmagick working, at last.

it seems that panther has some linking quirk or other than can be  
avoided by manually specifying libraries in the LIBS line of  
Makefile.PL. I found this in a completely unrelated bug report about  
installing DBD::Pg  
(http://gborg.postgresql.org/project/dbdpg/bugs/bugupdate.php?619), and  
indeed it works in this case too. If you add this to the LIBS line:

-ljpeg -lpng -lTIFF -lBZ2 -lxml2

then nearly all the loader errors in make test go away. I have no idea  
why. Anyone?

The only errors that remain are to do with linking to XDPS, and I  
believe those will only come up if you are trying to use Apple's X11  
instead of the old fink one, which includes the necessary DPS  
libraries. I suppose it shouldn't come as a surprise that the Apple  
version does not.

But it seems a much better idea to use Apple's X, if possible, and you  
can get around the DPS problem either by installing the imagemagick-nox  
package instead (which gives you no X tools, but doesn't seem to mind  
when it can't find dps), or by editing imagemagick.info to remove the  
dependency on dps from its configuration.

Here's an amended version of Randal's recipe. I'm using the unstable  
branch, but I expect the same tweaks work for the stable version as it  
seems to be the same at the moment.

1) edit  
/sw/fink/10.3/(stable|unstable)/main/finkinfo/graphics/imagemagick.info  
so that
  the ConfigureParams line has --without-dps instead of --with-dps
2) "fink install imagemagick" (This will take a while)
3) "fink list imagemagick"
4) Note the version number (n.n.n-n) by the version you have installed.
5) "cd; mkdir Build; cd Build" (getting to a scratchdir)
6) "tar xvfz /sw/src/ImageMagick-n.n.n.tar.gz; cd Image*/PerlMagick/"
7) edit Makefile.PL so that
  INC begins with -I/sw/include
  LIBS begins with -L/sw/lib
  LIBS includes -ljpeg -lpng -lTIFF -lBZ2 -lxml2
  after the path definitions (and as well as whatever other  
specifications are there)
8) "perl Makefile.PL; make all install"
9) "cd; rm -rf Build"

it still fails a few tests, as always, but it loads ok and works fine,  
as far as I can see, with the mainstream formats.

I hope this helps someone out.

will



PS. In the course of these lengthy experiments I also selfupdated to  
fink 0.6.2, and for all I know that's what made the difference, making  
these instructions completely redundant :)



On 13 Nov 2003, at 15:37, william ross wrote:

has anyone had any success installing perlmagick on panther?

I'm using the fink-and-make method, which has always worked for me  
before and is succinctly described by Randal in  
http://nntp.x.perl.org/group/perl.macosx/3812

fink on 10.3 is in some flux at the moment and they don't recommend  
installing from source 'for the next few weeks', but that's what you  
have to do in order to get a version of perlmagick which matches the  
version of imagemagick you have just installed, so that's what i did,  
and it seems to have compiled and installed without any bother. the  
command-line tools work, and the libraries all appear to have ended up  
where they should.

i then go into the perlmagick subdirectory, amend the library and  
include locations as usual and try to make it. That appears to work  
too: there are no warnings or complaints from running either the  
makefile or make. however, on make test (or installing and trying to  
use the module), I get a flood of errors like this:

/sw/temp/ImageMagick-5.5.1/PerlMagick/blib/arch/auto/Image/Magick/ 
Magick.bundle undefined reference to _xmlSwitchEncoding expected to be  
defined in a dynamic image

which sounds like the old dyld in new clothes? Or maybe a compiler  
mismatch? curses. I'm using the system 5.8.1rc3 that ships with  
panther, and fink 0.6.1, both of which expect to use gcc3.3, I  
believe. fink is selfupdating again at the moment, but that will take  
a while (all i can get here is 28.8) so I thought I'd enquire. any  
advice would be most welcome.

thanks

will




Re: ***regular expression***

2003-11-17 Thread Conrad Schilbe
On 11/17/03 2:52 AM, "xweb" <[EMAIL PROTECTED]> wrote:

> Thanks all but...
> I don't explain well the problem!
> So, i'm processing a very big text file ( from A DB ) in this format
> number|field 1|field2| field 3| etc. Every line is a record.Every line
> contains many url.
> I'm interested about specific url and i don't consider the others.
> 
> while ( $line =~ s/href=\"([^"]+)\"//) {
> $url = $1; ###ALL URL#
> if ($url =~ m/\/[^,]+,([^,]+),([^,]+),[^,]+\.html?$/) {
>  ($var1,$var2)=($1,$2); ###INTERESTING URL AND VALUES
> }
> }
> In this way i obtain two values that interested me! It's works!
> Now i must substitute these url the_link  with
> the_link and then i write to a new file with this
> substitution on all the field of file!
> Can you help me?
> 

The only thing you haven't captured is `the_link`.

 open (FH, "> path/to/new/file") || die "$!\n"; # open new file to write to

 while ( $line =~ /(.*?)<\/a>/) {
 $url = $1; ###ALL URL#
 $the_link = $2;
 if ($url =~ m/\/[^,]+,([^,]+),([^,]+),[^,]+\.html?$/) {
  ($var1,$var2)=($1,$2); ###INTERESTING URL AND VALUES
  print FH "$the_link"; # print to new file
 }
 }
 close(FH)



Re: Panther problems

2003-11-17 Thread John Labovitz
On Nov 16, 2003, at 6:45 PM, Vic Norton wrote:

I'm sorry about the confusion, Morbus. My ".bash_profile" contains the 
line
   MANPATH=/usr/share/man:/man:/usr/X11R6/man:~/man
The "set" command, with no parameters, reproduces this as
   MANPATH=/usr/share/man:/man:/usr/X11R6/man:/Users/vic/man
Regardless, I cannot see manuals in either
   /man  or  /usr/X11R6/man
and "manpath" still produces
   /usr/share/man:/Users/vic/man

My conclusion, in bash the value of the variable MANPATH has no effect
whatsoever on "man". Maybe bash doesn't need "setenv", but, so far, it
can't tell "man" where to look either.
Apparently we're not supposed to set $MANPATH anymore.  There's a 
"manpath" command that "man" calls to automatically figure out the 
paths (from "man manpath"):

 Manpath is used by man(1) to determine the search path, so users 
normally
 don't need to set the MANPATH environment variable directly.

If you *do* set $MANPATH, "manpath" just echoes that, without doing its 
searching.

There is an /etc/manpath.config file that lets you expand the default 
places that "manpath" searches.  On closer looking, and doing several 
searches across my whole system looking for manpages, I found that I 
needed to add the following lines:

OPTIONAL_MANPATH/opt/local/share/man
OPTIONAL_MANPATH/usr/local/share/man
The /opt/local reference is because I use Darwinports, which (like 
fink) puts all its installed files into its own directory.  (Note that 
I have actually changed /usr/bin/perl to point to /opt/bin/perl, which 
may mean that a lot of what I've written may not be true on your 
system. ;)

Oddly, manpath.config contains the following line:

	OPTIONAL_MANPATH/usr/local/lib/perl5/5.6.1/man

That doesn't seem right for a system running Perl 5.8.x...

(The "manpath" command seems, in my opinion, to be a decent solution -- 
but unfortunately doesn't seem to let a user add in their own paths 
without modifying the /etc file.  It would be nice to have a 
$MANPATH_MANPATH environment variable that would be appended to 
whatever magic "manpath" performed.)

--
John Labovitz photography
www.johnlabovitz.com
[EMAIL PROTECTED]
+1 503.873.6734


Re: Panther problems

2003-11-17 Thread John Labovitz
On Nov 16, 2003, at 6:32 PM, John Delacour wrote:

I reinstalled 5.8.1 from source twice and everything went fine until I 
upgraded certain modules.  In the end I installed 5.8.2 with the Apple 
way, ie. to replace 5.8.1, and since then everything has been fine.  
All my modules have been updated except for Filter::Simple, which cpan 
always reports as being one point behind in spite of updating.
It's because Filter::Simple is installed in two places, and the later 
install did not remove or overwrite the first one.

I've been tracking this down on my own system, and finally figured out 
what is happening.  It's *not* an OS X-specific problem; it happened on 
my Redhat system, too.

When there's a module installed with the initial Perl installation (I 
think this is called a "core" module), and you try to upgrade that 
module, the upgraded module gets installed in a different place than 
the original module, yet the @INC include path is such that the 
original module gets found first.

Say Filter::Simple is installed under /System/Library/Perl.  By either 
looking at its version number by hand, or using the CPAN "r" command, 
we see that it's 0.79.  We update it to 0.80.  The update is installed 
under /Library/Perl.  But our perl's @INC path says to look first in 
/System/Library, where it finds the 0.79 version.

I finally "solved" this on my system by tracking down which modules 
weren't being updated, and just deleting the older versions -- from 
/System/Library/Perl if necessary.

However, the right way to solve this is to use the UNINST=1 flag when 
you install Perl modules.  From the CPAN FAQ ("man CPAN"):

   1)  I installed a new version of module X but CPAN keeps saying, 
I have
   the old version installed

   Most probably you do have the old version installed. This 
can hap-
   pen if a module installs itself into a different directory 
in the
   @INC path than it was previously installed. This is not 
really a
   CPAN.pm problem, you would have the same problem when 
installing
   the module manually. The easiest way to prevent this 
behaviour is
   to add the argument "UNINST=1" to the "make install" call, 
and that
   is why many people add this argument permanently by 
configuring

 o conf make_install_arg UNINST=1

   2)  So why is UNINST=1 not the default?

   Because there are people who have their precise expectations 
about
   who may install where in the @INC path and who uses which 
@INC
   array. In fine tuned environments "UNINST=1" can cause 
damage.

Personally, this causes me enough hassle that I really wish UNINST=1 
*was* the default.

--
John Labovitz photography
www.johnlabovitz.com
[EMAIL PROTECTED]
+1 503.873.6734


Re: Panther problems

2003-11-17 Thread John Delacour
At 11:36 am -0800 17/11/03, John Labovitz wrote:

> Personally, this causes me enough hassle that I really wish UNINST=1 *was* the 
> default.

Me too!  Thanks for the long explanation.  I'm now having problems installing Tk.  
I've force installed but get the same error (coundn/t connect to display ":0" at 
...ManinWIndow.pm) when I run scripts as I got when it failed all the tests.  All 
great fun !

JD



Problems installing Tk

2003-11-17 Thread John Delacour
When I install Tk I get the same error with all the tests.  If I force-install, then I 
get the same error im MainWindow.pm (though with a different path of course) when I 
try to run a script that calls Tk.

Any hints as to how to fix this?


DIED. FAILED tests 1-96
Failed 96/96 tests, 0.00% okay
t/JP.couldn't connect to display ":0" at 
/Users/jd/.cpan/build/Tk-804.025_beta6/blib/lib/Tk/MainWindow.pm line 55.

JD




Re: Problems installing Tk

2003-11-17 Thread Jerry LeVan
Are you running the X server? It pretty well compiled out the box for 
me.
Failed 5 or 6 tests.

There is another problem with Tk on Panther is the the standard file 
open/close
dialogs "bus error". I have not seen a fix to this problem.

--Jerry

On Nov 17, 2003, at 4:17 PM, John Delacour wrote:

When I install Tk I get the same error with all the tests.  If I 
force-install, then I get the same error im MainWindow.pm (though with 
a different path of course) when I try to run a script that calls Tk.

Any hints as to how to fix this?

DIED. FAILED tests 1-96
Failed 96/96 tests, 0.00% okay
t/JP.couldn't connect to display ":0" at 
/Users/jd/.cpan/build/Tk-804.025_beta6/blib/lib/Tk/MainWindow.pm line 
55.

JD





Re: Problems installing Tk

2003-11-17 Thread John Delacour
At 9:17 pm + 17/11/03, John Delacour wrote:
> When I install Tk I get the same error with all the tests.  If I force-install, then 
> I get the same error im MainWindow.pm (though with a different path of course) when 
> I try to run a script that calls Tk.
> 
> Any hints as to how to fix this?
> 
> 
> DIED. FAILED tests 1-96
> Failed 96/96 tests, 0.00% okay
> t/JP.couldn't connect to display ":0" at 
> /Users/jd/.cpan/build/Tk-804.025_beta6/blib/lib/Tk/MainWindow.pm line 55.


I now see in the README.darwin

___

For Tk804.025 to build properly on Mac OS X 10.2 (Jaguar) or 10.3
(Panther), Perl must be built dynamic, rather that the default of
static.  Use a Configure incantation similar to this:

sh Configure -des -Duseshrplib [-Dprefix=/path/to/your/private/perl]

S. Lidie, 2003/10/27
___


but that gives me

sh-2.05b# Configure -des -Duseshrplib
sh: Configure: command not found
sh-2.05b#

Any ideas?

JD




Re: Problems installing Tk

2003-11-17 Thread Jerry LeVan
Configure is generally found in the Perl source distribution. The 
version of Perl that
comes with Panther builds Tk ok.

Your probably need to do something like ./Configure  if the perl 
source directory
is not in your PATH.

--Jerry

On Nov 17, 2003, at 6:14 PM, John Delacour wrote:

At 9:17 pm + 17/11/03, John Delacour wrote:
When I install Tk I get the same error with all the tests.  If I 
force-install, then I get the same error im MainWindow.pm (though 
with a different path of course) when I try to run a script that 
calls Tk.

Any hints as to how to fix this?

DIED. FAILED tests 1-96
Failed 96/96 tests, 0.00% okay
t/JP.couldn't connect to display ":0" at 
/Users/jd/.cpan/build/Tk-804.025_beta6/blib/lib/Tk/MainWindow.pm line 
55.


I now see in the README.darwin

___

For Tk804.025 to build properly on Mac OS X 10.2 (Jaguar) or 10.3
(Panther), Perl must be built dynamic, rather that the default of
static.  Use a Configure incantation similar to this:
sh Configure -des -Duseshrplib [-Dprefix=/path/to/your/private/perl]

S. Lidie, 2003/10/27
___
but that gives me

sh-2.05b# Configure -des -Duseshrplib
sh: Configure: command not found
sh-2.05b#
Any ideas?

JD