[16090] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3502 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 28 14:10:30 2000

Date: Wed, 28 Jun 2000 11:10:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <962215817-v9-i3502@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 28 Jun 2000     Volume: 9 Number: 3502

Today's topics:
    Re: Image::Magick installation failed <lucas@cplhk.com>
        Joining lines (R.Roe)
    Re: Joining lines <pap@NOTHEREsotonians.org.uk>
    Re: Joining lines <bwalton@rochester.rr.com>
    Re: Joining lines <news@webneeds.com>
    Re: Perl/cgi newbie questions (Mark P.)
    Re: Permissions -is 750  full read write access? (Abigail)
        regex and hashes (Sean McAfee)
    Re: regex and hashes <chris@inta.net.uk>
    Re: regex and hashes <abe@ztreet.demon.nl>
    Re: regex for changing NON-absolute urls in a html file <news@webneeds.com>
        regexp to recognize .htm files preetham@mailcity.com
    Re: split regex <abe@ztreet.demon.nl>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 29 Jun 2000 00:27:52 +0800
From: "Lucas Tsoi" <lucas@cplhk.com>
Subject: Re: Image::Magick installation failed
Message-Id: <8jd925$fmf2@imsp212.netvigator.com>

Thanks for your helps!!

I have corrected some paths, but I cant still find a subdirectory that is
named Magick with .h files liked api.h, so returns the error message
"Magick.xs:78: magick/api.h: No such file or directory".

Could you give me some clues again?

Thanks very much!!



----- Original Message -----
From: "Randy Kobes" <randy@theoryx5.uwinnipeg.ca>
Newsgroups: comp.lang.perl.misc
Sent: Wednesday, June 28, 2000 10:04 PM
Subject: Re: Image::Magick installation failed


> In comp.lang.perl.misc, Lucas Tsoi <lucas@cplhk.com> wrote:
> > Hi all I am to install Image::Magick,
> > the error messages said:
> [ ... ]
> >  Magick.xs:78: magick/api.h: No such file or directory
> >  make: *** [Magick.o] Error 1
>
> > and the README document says that i have to LIBS and INC to include the
> > appropriate path information to the required libMagick library.
>
> In Makefile.PL, you'll see lines like
>      'LIBS' => ['-L/pathos/home/cristy/ImageMagick/bzlib ....'],
>      'INC' => '-I../ ....',
> For LIBS, make sure that one of the -L/blah/blah entries
> corresponds to a location where libMagick.* is located
> (as well, make sure that the path to your X libraries
> (eg, libX11.*) is also included as one of the -L entries).
> For INC, make sure that one of the -I/blah/blah entries
> corresponds to a directory that has in it a
> subdirectory "magick" that contains the .h files for
> ImageMagick (eg, api.h). Then run 'perl Makefile.PL'
> again. You may get some warnings  (suggested as
> 'probably harmless') about not finding certain libraries,
> but if it compiles OK in the end, then these warnings
> are really harmless.
>
> best regards,
> randy kobes

"Randy Kobes" <randy@theoryx5.uwinnipeg.ca> ¼¶¼g©ó¶l¥ó
news:8jd0kp$ip1$1@canopus.cc.umanitoba.ca...
> In comp.lang.perl.misc, Lucas Tsoi <lucas@cplhk.com> wrote:
> > Hi all I am to install Image::Magick,
> > the error messages said:
> [ ... ]
> >  Magick.xs:78: magick/api.h: No such file or directory
> >  make: *** [Magick.o] Error 1
>
> > and the README document says that i have to LIBS and INC to include the
> > appropriate path information to the required libMagick library.
>
> In Makefile.PL, you'll see lines like
>      'LIBS' => ['-L/pathos/home/cristy/ImageMagick/bzlib ....'],
>      'INC' => '-I../ ....',
> For LIBS, make sure that one of the -L/blah/blah entries
> corresponds to a location where libMagick.* is located
> (as well, make sure that the path to your X libraries
> (eg, libX11.*) is also included as one of the -L entries).
> For INC, make sure that one of the -I/blah/blah entries
> corresponds to a directory that has in it a
> subdirectory "magick" that contains the .h files for
> ImageMagick (eg, api.h). Then run 'perl Makefile.PL'
> again. You may get some warnings  (suggested as
> 'probably harmless') about not finding certain libraries,
> but if it compiles OK in the end, then these warnings
> are really harmless.
>
> best regards,
> randy kobes




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

Date: Wed, 28 Jun 2000 16:23:23 GMT
From: rroe@mail.com (R.Roe)
Subject: Joining lines
Message-Id: <8F617E505rroemailcom@64.34.205.9>

I would appreciate help with with the following:
I need to convert a text file containing several lines which have carriage 
returns at the end, into one long string by joining the lines. How do I write 
the perl code for this please?

Thanks in advance. 


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

Date: Wed, 28 Jun 2000 17:23:23 +0100
From: Paul Taylor <pap@NOTHEREsotonians.org.uk>
Subject: Re: Joining lines
Message-Id: <395A267B.FB3AC977@NOTHEREsotonians.org.uk>

"R.Roe" wrote:
> 
> I would appreciate help with with the following:
> I need to convert a text file containing several lines which have carriage
> returns at the end, into one long string by joining the lines. How do I write
> the perl code for this please?
> 
> Thanks in advance.

Honestly, if you want someone to code it for you, go hire a programmer.

Or read the fabulous manual page.  Or O'Reilly's books.

Pap.


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

Date: Wed, 28 Jun 2000 17:05:31 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Joining lines
Message-Id: <3981BC4A.DE2635A8@rochester.rr.com>

"R.Roe" wrote:
 ...
> I need to convert a text file containing several lines which have carriage
> returns at the end, into one long string by joining the lines. How do I write
> the perl code for this please?
 ...
$s=join '',<>;

I assume by "carriage returns" you mean new line indicators appropriate
for your operating system.
-- 
Bob Walton


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

Date: Wed, 28 Jun 2000 11:20:52 -0600
From: "Dan Manion" <news@webneeds.com>
Subject: Re: Joining lines
Message-Id: <xis65.132$%O.184145@news.uswest.net>

## First step ... open your file
open (FILE, "bigassfile") || die "open error: $!";
my @ALL = <FILE>;
close (FILE);
## SEE perldoc -f open

##2nd step ... use chomp.
chomp(@ALL);
## SEE perldoc -f chomp

##3rd Step ... use join.
my $str = join('',@ALL);
##perldoc -f join


There are tons of great books and online documentation on learning perl.
Might be worth your time to go find some good bathroom reading material and
start to tackle some of the basics.

Hope this helps!

"R.Roe" <rroe@mail.com> wrote in message
news:8F617E505rroemailcom@64.34.205.9...
> I would appreciate help with with the following:
> I need to convert a text file containing several lines which have carriage
> returns at the end, into one long string by joining the lines. How do I
write
> the perl code for this please?
>
> Thanks in advance.




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

Date: Wed, 28 Jun 2000 15:23:22 GMT
From: perl@imchat.com (Mark P.)
Subject: Re: Perl/cgi newbie questions
Message-Id: <395a1815.13156518@news.ionet.net>

On Wed, 28 Jun 2000 08:20:35 -0500, Tom Briles <sariq@texas.net>
wrote:

>"Mark P." wrote:
>> 
>> On Tue, 27 Jun 2000 11:44:33 -0600, rickh <rickh@burgoyne.com> wrote:
>> 

>>         Check the Perl version. Your're probably running an old
>> version that doesn't support HERE docs.
>
>That's ridiculous.  To what version of Perl would you be referring?
>
>Did you bother to test the posted code in *any* version?
>
	Sorry, realized my stupid error right after I posted. The code
was obviously bad. 


MP


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

Date: 28 Jun 2000 13:50:45 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Permissions -is 750  full read write access?
Message-Id: <slrn8lkfpd.ka1.abigail@alexandra.delanet.com>

Bill Evans (wgevans@voyager.co.nz) wrote on MMCDXCIII September MCMXCIII
in <URL:news:395bce7d.6234928@news.voyager.co.nz>:
:: I have three questions related to a script I am
:: using  that allows the user to upload files via a webpage form to a
:: directory on the server. The script runs perfectly on one server where
:: permissions for the directory are set to 711
:: and the for the file are set to 755 
:: drwx--x--x -
:: rwxr-xr-x 
:: 
:: First question :  Is there any point having the file set to 755 when
:: the directory is set to 711 ?

That depends on what you want to do and allow, but what does that have
to do with Perl?

:: Second question: 
:: On another server where I am not allowed to set permissions it does
:: not run.  This server is running Velocigen.  I have tried running the
:: script with Velocigen both disabled and enabled. I am told by the
:: technical support that it is unlikely to be a permissions problem
:: because all files have full read write access as standard. Permissions
:: on this server are set to 750 for all files
:: drwxr-x--- 
:: -rwxr-x---
::  Is  this indeed full read write access? 

No. But what does that have to do with Perl?

:: Is there anything in these permission settings that could prevent the
:: script running?

Yes, but what that is is 1) totally off topic for this group, and
2) there isn't enough information to answer the question.

:: Third question:
:: Incidentally this second firm "does not have error logs for individual
:: accounts". 
:: So I cannot set permissions and I cannot see an error log.
:: Why would they structure things in this way?  

Just to annoy the heck out of you! It's a big scam! They rather see you
go as a customer!

But, once again, what does this have to do with Perl?


That's three strikes, you are out.


Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))


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

Date: Wed, 28 Jun 2000 17:20:59 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: regex and hashes
Message-Id: <%tq65.449$VK3.7383@news.itd.umich.edu>

In article <8jd3e1$1sqr$1@news2.vas-net.net>,
Chris Denman <chris@inta.net.uk> wrote:
>I have a hash array as follows:

>$hash{'john'}='1';
>$hash{'John'}='2';
>$hash{'JOHN'}='3';

>and I want to somehow do a case insensitive lookup for 'john' to bring back
>3 values without going through all of the keys.

>Is there a way?
>i.e.
>print $hash{/john/i};

A tied hash would work:

----------------------------------------------------------------------
tie %hash, 'CaseInsensitiveHash';

$hash{'john'} = 1;
$hash{'John'} = 2;
$hash{'JOHN'} = 3

print "@{ $foo{'john'} }";

BEGIN {
    package CaseInsensitiveHash;
    use Tie::Hash;
    @ISA = 'Tie::StdHash';

    sub STORE {
        my ($self, $key, $value) = @_;
        $self->{lc $key}{$key} = $value;
    }

    sub FETCH {
        my ($self, $key) = @_;
        [ values %{ $self->{lc $key} } ];
    }

    sub EXISTS {
        my ($self, $key) = @_;
        exists $self->{lc $key};
    }

    sub DELETE {
        my ($self, $key) = @_;
        delete $self->{lc $key}{$key} if exists $self->{lc $key};
    }

}
----------------------------------------------------------------------

Any code that used this tied hash would have to be aware that all of its
apparent "values" are array references, but that's really the only way to
get multiple values from a hash lookup.  Alternately, you could include an
additional method in the CaseInsensitivePackage class above, say:

sub all_values {
    my ($self, $key) = @_;
    values %{ $self->{lc $key} };
}

Then you could get all of the values associated with a particular key as an
ordinary list like this:

@list = (tied %hash)->all_values;

Anyway, good luck.

-- 
Sean McAfee                                                mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!


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

Date: Wed, 28 Jun 2000 16:21:19 +0100
From: "Chris Denman" <chris@inta.net.uk>
Subject: Re: regex and hashes
Message-Id: <8jd55s$1tj6$1@news2.vas-net.net>

The words have to be stored 'as is' unfortunately.

The real problem is that I have a massive dictionary hash of every unique
word that exists in a database.  I am writing an indexing system so that I
can get to the data very quickly.  Seems to have backfired!

i.e.

$words{'abacus'}='1,2,3';
$words{'apple'}='4,5,6'
$words{'Apple'}='5,6,7';


which means that the word 'abacus' appears in record numbers 1,2,3,5,6,8,10
and so on....

and I would like to look for /apple/i to bring back 4,5,6,7 and 'apple' to
bring back 4,5,6 and so on

Back to the drawing board I think!

Cheers,

Chris

>More directly, I don't think there's any way you can avoid
>linearity here, you'll have to iterate and canonicalise
>the keys into either upper or lower case before comparing
>them (you presumably want an exact match so avoid regexps,
>just use string compare).
 ............





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

Date: Wed, 28 Jun 2000 18:44:00 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: regex and hashes
Message-Id: <fiaklss35m2mt8oeejfdagvfkml0182qmu@4ax.com>

On Wed, 28 Jun 2000 15:51:33 +0100, "Chris Denman" <chris@inta.net.uk>
wrote:

> I have a hash array as follows:
> 
> $hash{'john'}='1';
> $hash{'John'}='2';
> $hash{'JOHN'}='3';
> 
> and I want to somehow do a case insensitive lookup for 'john' to bring back
> 3 values without going through all of the keys.
> 

	print "@hash{ grep /^john$/i=>keys %hash }\n";

-- 
Good luck,
Abe


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

Date: Wed, 28 Jun 2000 11:40:58 -0600
From: "Dan Manion" <news@webneeds.com>
Subject: Re: regex for changing NON-absolute urls in a html file.
Message-Id: <nBs65.142$%O.190102@news.uswest.net>

Go look at HTML::Parser.  Grab a copy from CPAN if its not already
installed.  It should help you out.


"Jan Bessels" <jbessels@planet.nl> wrote in message
news:395A1930.993CB59B@planet.nl...
> I've retrieved using LWP: a html file from a web-server. Before being
> usefull the contents has to be changed/parsed. I've experience with
> regexes but now I'm baffled. Have tried quite a few things.
>
> Basicaly, the following has to be done. If an url is relative
> (pics/menu.gif or relative to the root eg /content/pics/menu.gif) it has
> to be changed into http://www.mysite.com/pics/menu.gif  and
> http://www.mysite.com/content/pics/menu.gif. In the latter case simply
> concatenating http://www.mysite.com and /content/pics/menu.gif isn't
> good because .com//content/ isn't valid html. Problem is that absolute
> urls like "http://www.somehting.com/.....gif" have to be left alone.
> The urls are used when using src= and href=. Of course src=url,
> src="url" and src='url' and src  =  url are valid html which can be
> found in the retrieved files.
>
> I'm confident the solution is elegant and simple but I currently don't
> see the solution.
> Any help is very much appreciated.
>
> JB.
>
>
>
>
>
>
>




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

Date: Wed, 28 Jun 2000 17:34:08 GMT
From: preetham@mailcity.com
Subject: regexp to recognize .htm files
Message-Id: <8jdcue$k5q$1@nnrp1.deja.com>

 hi,

I want to write a reg exp to recognize
*.htm
*.html
or
site address like www.yahoo.com,deja.com
or mysite.com/a/b/c/
       from a url.

i.e., all urls whose response may be html.

someone please help me here


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 28 Jun 2000 17:48:51 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: split regex
Message-Id: <5b7kls45s9v1q7e1n3v3iqa65kme7eh50r@4ax.com>

On Tue, 27 Jun 2000 19:58:55 -0400, "Todd W" <trw@uakron.edu> wrote:

> I am trying to figure out how to split on only the last two underscores in
> my string. Any1 mind helping? Thanks in advance.
> 
	my $str = 'here_is one_and anther_one_last one';

	my @parts = reverse map $_ = reverse($_) => 
		split /_/, reverse($str), 3;

	print map "\t$_\n"=>@parts;

-- 
Good luck,
Abe


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 3502
**************************************


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