[15706] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3119 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 22 09:05:37 2000

Date: Mon, 22 May 2000 06:05:13 -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: <959000713-v9-i3119@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 22 May 2000     Volume: 9 Number: 3119

Today's topics:
        [Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
        about sending HTML email from perl <abc@def.com>
        Building a hash array jimmy_mcnamara@my-deja.com
        DBI and apostrophes <Nick@ucecom.com>
    Re: DBI and apostrophes <Nick@ucecom.com>
    Re: DBI and apostrophes <blah@nospam.com>
    Re: DBI and apostrophes <dave@dave.org.uk>
        Does Perl not support the MSG_WAITALL flag for recv? <lmh@xiphos.ca>
    Re: Does WARN have a reset?? (M.J.T. Guy)
    Re: ENV{'REMOTE_HOST'} doesnt work, solution? <reevesg@cableinet.co.ukx>
    Re: Global variables to apply to multiple Perl scripts <apietro@my-deja.com>
    Re: Global variables to apply to multiple Perl scripts <apietro@my-deja.com>
    Re: Help with 500 Internal Server Error <bill.kemp@wire2.com>
    Re: Help with Perl semantics <gellyfish@gellyfish.com>
        LWP Module and error 500 <f.lalane@no-spam.pra.org.uk>
        newbie problem with infinite for loop trevlix@yahoo.com
    Re: Pattern match ? (Bart Lateur)
    Re: Pattern match ? (Gabriel Kihlman)
        problem with split <root@irc.vsnl.com>
    Re: problem with split <f.lalane@no-spam.pra.org.uk>
        question about CGI <lslam9@ie.cuhk.edu.hk>
        Removing null character padding from the strings Effici <kraja@miel.mot.com>
    Re: Removing null character padding from the strings Ef <uackermann@orga.com>
    Re: Removing null character padding from the strings Ef (M.J.T. Guy)
    Re: Removing null character padding from the strings Ef <uackermann@orga.com>
        rotation of images td@lavalink.com.au
    Re: SETUID problem (maybe lame) (M.J.T. Guy)
    Re: the use of $_ <thunderbear@bigfoot.com>
        Upgrading Perl? (R1CH)
    Re: valid email address (Neil Kandalgaonkar)
        Where is Win32::Perms.pm ? <cingram-at-pjocs-dot-demon-dot-co-dot-uk>
    Re: Where is Win32::Perms.pm ? <f.lalane@no-spam.pra.org.uk>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 22 May 2000 10:22:33 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage958991041.8495@news.teleport.com>

Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 29 Apr 2000

[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last _major_ update of the Perl FAQ was in Summer
of 1998; of course, ongoing updates are made as needed. ]

For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).

    http://www.cpan.org/doc/FAQs/

Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.

For an alternative way to get answers, check out the Perlfaq website.

    http://www.perlfaq.com/

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.

    perldoc perlfaq
    man perlfaq

If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.

If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.

    http://www.cpan.org/
    http://www.perl.com/CPAN/
    http://www.cpan.org/doc/FAQs/FAQ/html/
    http://www.perl.com/CPAN/doc/FAQs/FAQ/html/

You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)

    California     ftp://ftp.cdrom.com/pub/perl/CPAN/
    Texas          ftp://ftp.metronet.com/pub/perl/
    South Africa   ftp://ftp.is.co.za/programming/perl/CPAN/
    Japan          ftp://ftp.dti.ad.jp/pub/lang/CPAN/
    Australia      ftp://cpan.topend.com.au/pub/CPAN/
    Netherlands    ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
    Switzerland    ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
    Chile          ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/

If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.

Have fun with Perl!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/


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

Date: Mon, 22 May 2000 20:12:46 +0800
From: "Nice" <abc@def.com>
Subject: about sending HTML email from perl
Message-Id: <8gbakv$n723@imsp212.netvigator.com>

hi all,
I am newbie to UNIX, I tried to write a Perl program for email sending, the
mailing program I am using is sendmail, my question is how can I send a HTML
format email by sendmail?? what is the param or instruction, thx





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

Date: Mon, 22 May 2000 12:18:13 GMT
From: jimmy_mcnamara@my-deja.com
Subject: Building a hash array
Message-Id: <8gb8hv$pat$1@nnrp1.deja.com>

Hi Folks,

I'm reading arguments from the command line using a perl script. One
of the arguments say $ARGV[5] will be of the form jim~jack~jill. This is
probably a very trivial question but can I make a hash array of that
data so I can access it using something similar to the following
construct:



foreach (@$AccountAliasList)
    {
        # $_ read each line of array on each pass
        if($_ eq $AccountAlias)
        {

Where the elements of the hash array would comprise of jim, jack and
jill


Any help will be greatly appreciated.

Jimmy


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


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

Date: Mon, 22 May 2000 12:03:20 +0100
From: "Nick Liebmann" <Nick@ucecom.com>
Subject: DBI and apostrophes
Message-Id: <lA8W4.4702$1W6.89257@news2-win.server.ntlworld.com>

I have done a bodge fix on the a mysql call using the DBI module

if($artistname =~ /\'/){$artistname =~ s/\'/\\'/;}

eg $artistname =  "Gary O'Dea"

after ---- $artistname =  "Gary O\'Dea"


this puts an escape character before the apostrophe.

on some of the entries the artistname has an apostrophy which when called
without the above change, fails to finish the statement correctly.

$tabledata = $dbh->prepare("SELECT * FROM gig_guide WHERE
artist='$artistname'");
   $tabledata->execute || die "Unable to execute query: $dbh->errstr";

There must be a better way of doing this....any ideas?

--
Nick Liebmann
nick@ucecom.com
http://www.ucecom.com
www.webomatic.co.uk






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

Date: Mon, 22 May 2000 12:09:06 +0100
From: "Nick Liebmann" <Nick@ucecom.com>
Subject: Re: DBI and apostrophes
Message-Id: <KF8W4.4705$1W6.89058@news2-win.server.ntlworld.com>


Nick Liebmann <Nick@ucecom.com> wrote in message
news:lA8W4.4702$1W6.89257@news2-win.server.ntlworld.com...
> I have done a bodge fix on the a mysql call using the DBI module
>
> if($artistname =~ /\'/){$artistname =~ s/\'/\\'/;}
>
> eg $artistname =  "Gary O'Dea"
>
> after ---- $artistname =  "Gary O\'Dea"
>
>
> this puts an escape character before the apostrophe.
>
> on some of the entries the artistname has an apostrophy which when called
> without the above change, fails to finish the statement correctly.
>
> $tabledata = $dbh->prepare("SELECT * FROM gig_guide WHERE
> artist='$artistname'");
>    $tabledata->execute || die "Unable to execute query: $dbh->errstr";
>
> There must be a better way of doing the escape character
>
> --
> Nick Liebmann
> nick@ucecom.com
> http://www.ucecom.com
> www.webomatic.co.uk
>
>
>
>




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

Date: Mon, 22 May 2000 13:28:06 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: DBI and apostrophes
Message-Id: <392919C6.B004D6BD@nospam.com>

Nick,

Nick Liebmann wrote:
> I have done a bodge fix on the a mysql call using the DBI module
> if($artistname =~ /\'/){$artistname =~ s/\'/\\'/;}
> eg $artistname =  "Gary O'Dea"
> after ---- $artistname =  "Gary O\'Dea"
> this puts an escape character before the apostrophe.

  Muble... Have you considered the quotemeta sub?

	$ perldoc -f quotemeta


	Best regards,
		Marco


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

Date: Mon, 22 May 2000 12:43:53 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: DBI and apostrophes
Message-Id: <0b7iis8vmhduqumq0od3qkljqkt0dk06gu@4ax.com>

On Mon, 22 May 2000 12:03:20 +0100, "Nick Liebmann" <Nick@ucecom.com>
wrote:

>I have done a bodge fix on the a mysql call using the DBI module
>
>if($artistname =~ /\'/){$artistname =~ s/\'/\\'/;}
>
>eg $artistname =  "Gary O'Dea"
>
>after ---- $artistname =  "Gary O\'Dea"
>
>
>this puts an escape character before the apostrophe.
>
>on some of the entries the artistname has an apostrophy which when called
>without the above change, fails to finish the statement correctly.
>
>$tabledata = $dbh->prepare("SELECT * FROM gig_guide WHERE
>artist='$artistname'");
>   $tabledata->execute || die "Unable to execute query: $dbh->errstr";
>
>There must be a better way of doing this....any ideas?

From the DBI documentation:

quote

       $sql = $dbh->quote($value);
       $sql = $dbh->quote($value, $data_type);

     Quote a string literal for use as a literal value in an SQL
statement by escaping any special characters (such as quotation marks)
contained within the string and adding the required type of outer
quotation marks.

hth,

Dave...

-- 
<http://www.dave.org.uk>  SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>

"There ain't half been some clever bastards" - Ian Dury [RIP]


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

Date: Fri, 19 May 2000 11:09:58 -0400
From: "Lorin Hochstein" <lmh@xiphos.ca>
Subject: Does Perl not support the MSG_WAITALL flag for recv?
Message-Id: <UG9W4.27324$HG1.591070@nnrp1.uunet.ca>

Hi,

I tried to use a recv call with a flag of MSG_WAITALL, and I got an error of
"Your vendor has not defined Socket macro MSG_WAITALL" (both on Windows NT
and on Linux, same error). Does Perl not support this flag?

Lorin Hochstein




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

Date: 22 May 2000 11:10:30 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Does WARN have a reset??
Message-Id: <8gb4j6$bja$1@pegasus.csx.cam.ac.uk>

Tom Turton  <tturton@ntx.waymark.net> wrote:
>In a subroutine, I have an if block, and in one branch, I use warn to
>print a warning (warn "WARNING:: Outside of allowable limits.\n";)
>
>The first time through this branch, I get the warning, but subsequent
>passes fail to display the warning.  Yet I follow the 'warn' with a
>debug print statment, and I see that each time, so I know I'm exercising
>the branch of the if block.
>
>Does 'warn' have a flag I need to clear or reset?

Let me guess  -  you're using "use diagnostics" ?

There's a little known (and even less documented) feature that it
suppresses repeats of the same warning message.    It should probably
only do this for messages from Perl itself, but ...

I tend to generate my error messages with

       print STDERR "Some message here\n";

but that of course has its own disadvantages.


Mike Guy


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

Date: Mon, 22 May 2000 10:40:27 GMT
From: "red [2]" <reevesg@cableinet.co.ukx>
Subject: Re: ENV{'REMOTE_HOST'} doesnt work, solution?
Message-Id: <v88W4.8033$PZ6.969001@news3.cableinet.net>

thanks, that worked perfectly :)

--

Graham "red" Reeves

uk's Q3 news & features - - www.quadmonkey.co.uk
domains for sale - - http://www.quadmonkey.co.uk/files/forsale.html
the stupid - - http://www.thestupid.com
member of clan [2] - - http://www.clan2.com

"Penpal International" <ppi@searchy.net> wrote in message
news:39282A95.621AC4D5@searchy.net...
> Use this script:
>
> $new_user_dns = $temp_ip = $ENV{'REMOTE_ADDR'};
> $temp_ip =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/;
> $address = pack('C4', $1, $2, $3, $4);
> $user_dns = (gethostbyaddr($address, 2))[0];
> if ($user_dns) { $new_user_dns = "lc $user_dns"; }
>
> It gets the Hostname for the remote_addr From your ISP's nameserver.
>
> "red [2]" wrote:
> >
> > im making a log stats program, and i can get a whole bunch of
information,
> > but for some reason REMOTE_HOST doesnt work :/
> >
> > i can gett he visitors ip with REMOTE_ADDR but HOST returns nothing..
> >
> > i know its not the server the user is coming from, so is there an easy
and
> > quick way to reverse DNS the ip? or a reason why it might not work...
> >
> > --
> >
> > Graham "red" Reeves
> >
> > uk's Q3 news & features - - www.quadmonkey.co.uk
> > domains for sale - - http://www.quadmonkey.co.uk/files/forsale.html
> > the stupid - - http://www.thestupid.com
> > member of clan [2] - - http://www.clan2.com
>
> --
> Penpal International
> http://ppi.searchy.net/
> ppi@searchy.net




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

Date: Mon, 22 May 2000 12:05:24 +0100
From: "A Pietro" <apietro@my-deja.com>
Subject: Re: Global variables to apply to multiple Perl scripts
Message-Id: <8gb49r$ndt$1@sshuraac-i-1.production.compuserve.com>

Christian,

I have *nearly* got your script working -- it falls over at the "rename"
stage after creating the first .new file.

Here are the changes I made:

>>
---------configureit.pl------------
#!/usr/bin/perl

my $answer;

## change
my @scripts = ("s1.pl","s2.pl","s3.pl");


# such a block for every option:
print "Please enter path for blabla: ";
unless ( $answer ) {
  $answer = <STDIN>;
}

foreach( @scripts ) {
  open( IN, "<$_" ) or die $!;

# change
  open( OUT, ">$_.new" ) or die $!;
  while( <IN> ) {
    if( /\$BLABLA_DIR/ ) {

# change
      print OUT  "\$BLABLA_DIR = "'$answer'"; "\n";
    } else {
      print OUT $_;
    }
  }
  close OUT;
  close IN;

#change
  rename ("$_.new", "$_ ") or die $!;
}
# end of script
>>

As I said, the rename line flags up as an error....any ideas?

Thanks
AP




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

Date: Mon, 22 May 2000 14:01:37 +0100
From: "A Pietro" <apietro@my-deja.com>
Subject: Re: Global variables to apply to multiple Perl scripts
Message-Id: <8gbb3p$5kj$1@sshuraac-i-1.production.compuserve.com>

I have got it to work using:

foreach $i

then:

rename ("$i.new", "$i") or die $!;

It was failing on the $_ rename for some reason.

Any pointers to where I can get info. on incorporating this script or
similar in a "proper" install package which will install the Perl scripts in
the correct Apache directories ( my home linux machine uses
/home/httpd/cgi-bin/  and /home/httpd/html/ but my ISPs server uses
/home/user_name/cgi-bin and /home/user_name/www/ .
What I want to do: user unzips, then types install, enters the required
install directory, then files are copied to correct locations, *along with
correct permissions (important)*
Maybe I can just extend this existing script...after all, I don't need a
full-blown "make install" type install script as I am just slotting in a few
Perl scripts -- its finding where to slot them that is the difficult part.

Thanks
AP





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

Date: Mon, 22 May 2000 11:07:28 +0100
From: "W Kemp" <bill.kemp@wire2.com>
Subject: Re: Help with 500 Internal Server Error
Message-Id: <958990139.27344.0.nnrp-01.c3ad6973@news.demon.co.uk>


Ray Waters wrote in message ...
>Hello,
>
>This shouldn't be a problem, but arrgh, it is. I'm cutting my teeth on
>CGI-Perl and so, for learning purposes, I'm trying the simplest exercise
>first. I chose to use the venerable cgi-lib.pl in order to exercise
>calling subroutines via 'require'. Easy, huh? That's what I thought, but
>I've hit a snag - the "500 Internal Server Error" problem.


Probably not what you want to hear, but I would have thought this was a
question of getting the right building blocks in place first.  Debugging
CGI-perl is harder than debugging command line perl, and if its exercises in
basic perl, you are better off on the command line, unless you really have
to be on a server for the tests to make sense.

>4. I don't have the ability to exercise my scripts on a local system.


sorry, odd. I would have expected it to be always better to play about on
the local system, rather than potentially messing up someone elses server.
Surely you can get std perl for running from the command line on your local
machine? Or haven't you even got access to a PC that you can do your own
installs on?





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

Date: Mon, 22 May 2000 10:49:19 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help with Perl semantics
Message-Id: <Pg8W4.535$6T1.89789@news.dircon.co.uk>

On Mon, 22 May 2000 01:04:33 GMT, Jim Stout Wrote:
> Greetings,
> 
> It seems the more I learn about Perl the less I know. This one has
> already invoked two bottles of Tylenol and I still have a headache. In
> trying to learn PMs I've be looking through the standard PMs (and the
> docs). However painful I'm actually catching on.<g> There is on
> construct which is giving me grief, which is (extracted from CGI.pm):
> 
> 'compare' => <<'END_OF_FUNC',
> sub compare {
>     my $self = shift;
>     my $value = shift;
>     return "$self" cmp $value;
> }
> END_OF_FUNC
> 

You probably dont want to be looking at CGI.pm for examples of how to 
start out writing modules as it uses some medium-weight magic to speed
up its loading ;-}

/J\


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

Date: Mon, 22 May 2000 11:48:32 +0100
From: "Franck Lalane" <f.lalane@no-spam.pra.org.uk>
Subject: LWP Module and error 500
Message-Id: <958992514.8189.0.nnrp-09.9e9872de@news.demon.co.uk>

Hello,

I made a search engine for an Intranet and I had a problem accessing files
not on the same server as the one which run the script (I can't use a simple
OPEN).

After a post on that newsgroup, I have been adviced to use the LWP module.

I tried it and it works fine on my Personal Webserver: I can access files
from the Intranet, and files from the Personal Webserver itself.
When I run it on the Intranet, I can access files from the PW, but I have
the code 500 for each file on the Intranet (meaning Internal Server Error I
think).

I really don't understand why!

Here is what I use (very simple really!):

use LWP::Simple;
$doc = get 'http://www.mysite.com/myfile.htm';

Thanks for any help.

Franck




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

Date: Mon, 22 May 2000 12:51:22 GMT
From: trevlix@yahoo.com
Subject: newbie problem with infinite for loop
Message-Id: <8gbag7$qg7$1@nnrp1.deja.com>

hello,

  i've been following the perl tutorial at
http://agora.scs.leeds.ac.uk/Perl/start.html.  One of the exercises
(http://agora.scs.leeds.ac.uk/Perl/split.html#exercise) is to split up a
text file into a concordance.  The link to the exercise can explain it
better.
  Anyhow, I have written the perl program and have come across something
weird.  When I run the script and it contains a certain split line in
the for loop, it goes into an infinite loop.  If I take the line out, it
works fine (ie does infinitely loop).  If I replace the for loop with a
while loop, it works fine too.  Can anyone let me know whats going on?
Here's the code:

#!/usr/local/perl
# This will take one argument at the command line which is the string to
# search for.

open(ELEC,"electric.txt") || die "Can\'t open: $!\n";

@lines=<ELEC>;
$lines="@lines";
@word=split(/$ARGV[0]/,$lines);  # split up the lines into an array

for ($i=0;$i <= $#word;$i++)
{
  if (length($word[$i]) < 20) { $word[$i] = " "x20 . $word[$i]; }  # pad
word if necessary
  $word[$i] =~ s/\n//g;         # remove any newlines in string
  print substr($word[$i],-20,20);
  print $ARGV[0];

  $word[$i+1] =~ s/\n//g;  # remove any newlines in string - this is the
offending line
  print substr($word[$i+1],0,20) if ($i+1 <= $#word);   # print if still
in array range
  print "\n";
}

thanks!

tyler
trevlix@yahoo.com


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


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

Date: Mon, 22 May 2000 10:08:01 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Pattern match ?
Message-Id: <392b0586.6480271@news.skynet.be>

The WebDragon wrote:

>damn. I've scouted around but haven't found anything stating the current level 
>of readiness of a more recent port of perl to the Mac than 5.004 .. anyone know 
>anything ?

They're working on it right now.

If you want to listen in on the current state of affairs with the
developers, take a look at the MacPerl Porters mailing list archives:

	http://bumppo.net/lists/macperl-porters/

See for example:

http://bumppo.net/lists/macperl-porters/2000/05/msg00018.html

	"On with the show; Volunteers Wanted!" (date: May 5)

-- 
	Bart.


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

Date: 22 May 2000 11:15:12 GMT
From: m10723@atle.abc.se (Gabriel Kihlman)
Subject: Re: Pattern match ?
Message-Id: <8gb4s0$4um$1@oden.abc.se>

In article <8ga7pp$cm7$1@news2.kornet.net>, Lee wrote:
>Hi,
>
>If there are alphabetic and numeric characters in a word like
>"a34r34thy643d2",
>how to delete all of alphabetic characters in that world.

One way would be s/\D//g

-- 
----------
Lame signature



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

Date: Mon, 22 May 2000 16:32:48 +0530
From: system PRIVILEGED account <root@irc.vsnl.com>
Subject: problem with split
Message-Id: <Pine.OSF.3.95.1000522162848.8358A-100000@irc.vsnl.com>


I am facing problem in splitting an ascii line. 
The fields are delimited by "|" (pipe) . 
I m using following command: 

@array=split("|", $line) . The command is not working
properly.

When i changes the delimiter to ":" and gives a similar
command, it works fine. 

Any suggestions are welcome??






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

Date: Mon, 22 May 2000 12:11:51 +0100
From: "Franck Lalane" <f.lalane@no-spam.pra.org.uk>
Subject: Re: problem with split
Message-Id: <958993904.9042.0.nnrp-09.9e9872de@news.demon.co.uk>

> I am facing problem in splitting an ascii line.
> The fields are delimited by "|" (pipe) .
> I m using following command:
>
> @array=split("|", $line) . The command is not working
> properly.
>
> When i changes the delimiter to ":" and gives a similar
> command, it works fine.
>
> Any suggestions are welcome??

Have you try this?

@array=split("\|", $line)

Franck




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

Date: Mon, 22 May 2000 18:38:32 +0800
From: Felix <lslam9@ie.cuhk.edu.hk>
Subject: question about CGI
Message-Id: <39290E28.E915E9A4@ie.cuhk.edu.hk>

My case is as follows:
     I would like to make a password checking cgi which can check the
username and password and then execute another cgi(called forum.cgi) in
another a browser window if the password is valid. The questions are
    1. How to use cgi to call a new URL into another browser window
which already exits.
    2. How to pass the username to another cgi?
    3. How to make the forum.cgi only executable when it's called by the
password checking cgi, so that others can't just type
"http://...../forum.cgi" to open the cgi?

    Thx a lot!



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

Date: Mon, 22 May 2000 17:28:47 +0530
From: Rajasankar K <kraja@miel.mot.com>
Subject: Removing null character padding from the strings Efficiently
Message-Id: <392920F7.6999AF97@miel.mot.com>


Hi,

How do I remove null ( 0 ) characters from the null padded string efficiently?

I have something like this that works, but looks ugly.


sub chomp_nulls
{
     my ($str) = @_;
     my $len = length ($str);
     my (@chrs) = split //,$str;

     my $i;
     for ($i = 0 ; $i < $len; $i++)
    {
          last if (ord($chrs[$i]) == 0);
    }

    $str = substr ($str, 0, $i);
    return $str;
}


Can anybody suggest better ways of doing it?

Please note:
1. You can get null padded strings by  { $str  = pack ("a10", "hai"); }  # 7
nulls will be padded in this case
2. {$str = unpack ("a*", $str);  }  doesn't remove the null padding while { $str
= unpack ("A*", $str); } removes space padding.

Thanks,
Raja.



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

Date: Mon, 22 May 2000 14:30:11 +0200
From: Ulrich Ackermann <uackermann@orga.com>
Subject: Re: Removing null character padding from the strings Efficiently
Message-Id: <39292853.C5F1B626@orga.com>

Rajasankar K wrote:
> 
> Hi,
> 
> How do I remove null ( 0 ) characters from the null padded string efficiently?
> 
> I have something like this that works, but looks ugly.
> 
> sub chomp_nulls
> {
>      my ($str) = @_;
>      my $len = length ($str);
>      my (@chrs) = split //,$str;
> 
>      my $i;
>      for ($i = 0 ; $i < $len; $i++)
>     {
>           last if (ord($chrs[$i]) == 0);
>     }
> 
>     $str = substr ($str, 0, $i);
>     return $str;
> }
> 
> Can anybody suggest better ways of doing it?
> 
> Please note:
> 1. You can get null padded strings by  { $str  = pack ("a10", "hai"); }  # 7
> nulls will be padded in this case
> 2. {$str = unpack ("a*", $str);  }  doesn't remove the null padding while { $str
> = unpack ("A*", $str); } removes space padding.
> 
> Thanks,
> Raja.

my $str =~ s/0*$//;

-- 
Ulrich Ackermann
ORGA Kartensysteme GmbH (SY-PEAT-STA)
Tel.:+49.5254.991-925 
mailto:uackermann@orga.com


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

Date: 22 May 2000 12:43:56 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Removing null character padding from the strings Efficiently
Message-Id: <8gba2c$hs6$1@pegasus.csx.cam.ac.uk>

Ulrich Ackermann  <uackermann@orga.com> wrote:
>
>my $str =~ s/0*$//;

I think you mean

  my $str =~ s/\0+$//;


Mike Guy


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

Date: Mon, 22 May 2000 14:49:17 +0200
From: Ulrich Ackermann <uackermann@orga.com>
Subject: Re: Removing null character padding from the strings Efficiently
Message-Id: <39292CCD.54C45E24@orga.com>

"M.J.T. Guy" wrote:
> 
> Ulrich Ackermann  <uackermann@orga.com> wrote:
> >
> >my $str =~ s/0*$//;
> 
> I think you mean
> 
>   my $str =~ s/\0+$//;
> 
> Mike Guy

Yes.
-- 
Ulrich Ackermann
ORGA Kartensysteme GmbH (SY-PEAT-STA)
Tel.:+49.5254.991-925 
mailto:uackermann@orga.com


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

Date: 22 May 2000 10:40:04 GMT
From: td@lavalink.com.au
Subject: rotation of images
Message-Id: <958992005.212862@krakatua>

I was wondering if anyone knows if GD.pm can
rotate and existing image. Looking through the
docs it seems that it can only be done to text,
but thats about it, (as far as I can tell anyway). 

If not, does anyone know of a module or a simple
way to rotate a list of images?

Cheers
Tony D.


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

Date: 22 May 2000 12:16:54 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: SETUID problem (maybe lame)
Message-Id: <8gb8fm$fp1$1@pegasus.csx.cam.ac.uk>

Maciej Mastalarczuk  <maciek@treko.net.au> wrote:
>Non-root user has to perform root-only action. The owner of the script
>is root:root and the mode is:
>-rwsr-x--x (4751). Whenever the user invokes the script he gets the
>message:
>
>Insecure $ENV{PATH} while running setuid at ./test line (something).

If you get an error message from Perl which you don't understand,
or even if you think you do understand it, look it up in "perldoc perldiag".

In this case, you would get

     Insecure $ENV{%s} while running %s
         (F) You can't use system(), exec(), or a piped open in a
         setuid or setgid script if any of `$ENV{PATH}',
         `$ENV{IFS}', `$ENV{CDPATH}', `$ENV{ENV}' or
         `$ENV{BASH_ENV}' are derived from data supplied (or
         potentially supplied) by the user.  The script must set
         the path to a known value, using trustworthy data.  See
         the perlsec manpage.


Mike Guy


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

Date: Mon, 22 May 2000 12:39:42 +0200
From: =?iso-8859-1?Q?Thorbj=F8rn?= Ravn Andersen <thunderbear@bigfoot.com>
Subject: Re: the use of $_
Message-Id: <39290E6E.3105818C@bigfoot.com>

"Godzilla!" wrote:

> Both Roberta and Robby work from dictionaries, thesauruses,
> bibliographies, astronomical data bases and, work with
> something I am very proud of, which no other has accomplished
> with Perl, an English Grammar Rule Book, hand coded in
> my favorite, Perl 4. This aspect, grammar rules, is absolutely
> impossible under Perl 5 with it lacking a 'human' quality
> and touch. It is too automated to handle complex programs.
> It is too 'strict' to handle imaginative programs which
> require bending, if not breaking some rules. If you wrote
> some of my programs in Perl 5, they would crash, never run.
> Perl 5 would gag and die.

Interesting.

What will you do the day you need to upgrade to a platform where Perl4
doesn't work?

-- 
  Thorbjørn Ravn Andersen          "... plus .. Tubular Bells!"
  http://www.mip.sdu.dk/~ravn/


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

Date: Thu, 18 May 2000 16:14:42 GMT
From: r1ch@n0sp4m.r1ch.net (R1CH)
Subject: Upgrading Perl?
Message-Id: <392416ae.54904929@news.screaming.net>

Hi,
I have a linux mandrake box with perl 5.003 running and I wanted to
upgrade to 5.6 or whatever this new one is... so I downloaded it and
make'd it, but many modules are now complaining about libraries being
incompatible. How would I go about removing the old version of Perl?

Thanks,
r1ch


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

Date: 22 May 2000 11:00:16 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: valid email address
Message-Id: <8gb400$ie9$1@newsflash.concordia.ca>

In article <3928E6A3.4897649A@momsathome.on.ca>,
Jennifer  <webmaster@momsathome.on.ca> wrote:

>Neil Kandalgaonkar wrote:
>
>> my $domain = qr/([a-z0-9-]+\.)*[a-z]+/i;  # must be fully qualified
>
>OK I just want to understand the regexp.  That would allow a
>sinlge letter to be valid, right?

You're right, I screwed up a bit.


>Assuming that a valid domain must have at _least_ one
>letter|number|dash followed by a dot followed by at least 2
>letters (Please correct me if you know that asumption to be
>wrong.), would the following work?  

A safe assumption for most addresses...

But I did a quick poll, for fun. These machines
are accessible simply with the country code:

Anguilla AI -> 209.88.68.34
Christmas Island CX -> 195.224.98.195
Denmark DK -> 194.192.186.150
Dominican Republic DO -> 206.105.233.72
Ghana GH -> 196.3.64.1
Cayman Islands KY -> 209.26.120.2
Moldova MD -> 209.26.120.2
Norfolk Island NF -> 203.12.249.101
Philippines PH -> 203.176.3.199
Syria SY -> 195.22.198.6
Tajikistan TJ -> 209.77.250.4
Taiwan TW -> 192.83.166.11 

In principle webmaster@ai is deliverable -- try it... 
just 'telnet ai 25' and type 'VRFY webmaster'. 

Some even have websites... http://cx/ for instance.

Aside from being pedantically correct, I guess you 
will never see such an address. Even the ai mail server
suggests webmaster@online.offshore.com.ai.


>if ($domain =~ /([a-z0-9-]+\.)+[a-z]{2,}$/i) {
>	print "could be valid";
>}
>else {print "not valid"}

The address could also deliver to a numeric dotted quad, like 
joe@194.192.186.150. The regex I posted handled that situation. 


>I know the domain part is not perl related, but my real concern
>is getting the regexp right. Is there a spec for domain names?

As far as I know the above regex is basically on target. If you 
want the original spec, I think it's RFC 1034:
 
<http://www.faqs.org/rfcs/rfc1034.html>

There is a slight difference in how it defined domain names,
(names starting with a number, like 3M.com, used to be illegal).
This changed at some point -- sorry, I don't know when.

Anyway, hope this helped, and that I am not tormenting you with 
needless detail.


-- 
Neil Kandalgaonkar
neil@brevity.org


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

Date: Mon, 22 May 2000 11:42:52 +0100
From: "Clyde Ingram" <cingram-at-pjocs-dot-demon-dot-co-dot-uk>
Subject: Where is Win32::Perms.pm ?
Message-Id: <958992426.7638.0.nnrp-13.9e98e5bc@news.demon.co.uk>

Can anyone tell me where I can get Perms.pm?

I believe this module provides functions for handling Win32 NTFS file
permissions and access control lists.

I cannot find it in ActiveState Perl 613, the March release of Perl 5.6.0.

Thanks in advance,
Clyde




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

Date: Mon, 22 May 2000 11:58:07 +0100
From: "Franck Lalane" <f.lalane@no-spam.pra.org.uk>
Subject: Re: Where is Win32::Perms.pm ?
Message-Id: <958993080.8517.0.nnrp-09.9e9872de@news.demon.co.uk>


> Can anyone tell me where I can get Perms.pm?
>
> I believe this module provides functions for handling Win32 NTFS file
> permissions and access control lists.
>
> I cannot find it in ActiveState Perl 613, the March release of Perl 5.6.0.
>
> Thanks in advance,
> Clyde

You can try this URL for activestate modules.
http://www.sura.ru/ftp/PROGRAMMING/Perl/Win32/ActivePerl/Packages/




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

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 3119
**************************************


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