[13736] in Perl-Users-Digest
Perl-Users Digest, Issue: 1146 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 21 21:05:26 1999
Date: Thu, 21 Oct 1999 18:05:10 -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: <940554310-v9-i1146@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 21 Oct 1999 Volume: 9 Number: 1146
Today's topics:
Re: a tree of subdirectories in perl? (Martien Verbruggen)
Re: At the risk of making myself an idiot ...How to cre <jspangen@my-deja.com>
Re: At the risk of making myself an idiot ...How to cre (Craig Berry)
Converting String To Upper and Lower Case <brad.grove@hcn.com.au>
Re: Converting String To Upper and Lower Case <aldricht@onslowonline.net>
Re: Converting String To Upper and Lower Case <aldricht@onslowonline.net>
define global variables <aldricht@onslowonline.net>
Re: file upload <ab@cd.com>
help on substitute op (s) should be cancelled iami@my-deja.com
Re: HELP- WILL PAY!!! (Michel Dalle)
Re: How do you split a string into fixed sized pieces? (Martien Verbruggen)
Re: How do you substitute '/' ? <wizardofvobs@yahoo.com>
Re: How do you substitute '/' ? (Craig Berry)
Re: Ignore the idiots (Eric Bohlman)
Re: Is @INC lying to me? (Martien Verbruggen)
Mail::Send module doesn't work on NT <abdoulaye.fofana@compaq.com>
mv file routine in perl for NT & Unix? <jkit@jpmorgan.com>
Re: mv file routine in perl for NT & Unix? <abdoulaye.fofana@compaq.com>
Re: New short cut assignment operators? (Craig Berry)
Passing variables between two Perl/CGI scripts <khalilm@home.com>
perl compile question - Solaris <wizardofvobs@yahoo.com>
Re: Perl Programmer Wanted <martin@mert.globalnet.co.uk>
Re: problem with substitute op (s) <jspangen@my-deja.com>
Reference challenge (Sean McAfee)
Re: Regexp global match mystery? (Joe Petolino)
Re: stealing the news: how hard can it be? (Michel Dalle)
Unlink <sswaminathan@micron.com>
Re: Where is the c.l.p.m charter? (Randal L. Schwartz)
Re: win32::odbc question <aldricht@onslowonline.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 22 Oct 1999 00:27:04 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: a tree of subdirectories in perl?
Message-Id: <sbOP3.216$WM1.2874@nsw.nnrp.telstra.net>
On 21 Oct 1999 20:27:25 -0000,
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> On Wed, 20 Oct 1999 20:48:49 -0200 Joyce Ynoue wrote:
> > Does anybody know how to implement in perl something like described
> > below??
> >
> >>tree usr
> >
>
> Ah you must be in the same class as those other guys ...
Yeah. And I actually got a _personal_ email (the honour, oh, the
honour) from one of them, denying that this was some sort of
assignment.
As stated before, I really hope we don't have to becomes as adept at
identifying help-me-with-my-homework posts as they are on clc, but I
do hope people here will refrain from helping them.
Martien
--
Martien Verbruggen |
Interactive Media Division | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd. | make up 3/4 of the population.
NSW, Australia |
------------------------------
Date: Thu, 21 Oct 1999 23:05:32 GMT
From: Johannes <jspangen@my-deja.com>
Subject: Re: At the risk of making myself an idiot ...How to create files in Perl ?
Message-Id: <7uo67r$q7e$1@nnrp1.deja.com>
In article <940523094.476101@news.vbs.at>,
"paranoid" <genlabs@gmx.net> wrote:
> Hello geeks.
>
> Ì hope anyone of you can answer my question,
> and mildly ignore it's dumbness .
> I'm writing a subroutine that should do the following:
> 1) Check if a filename is available (not containing illegal chars
etc., not
> already existing in the write directory)
my $illegalchar = ' \t'; # whatever you decide as an illegal char
if ((! -e $filename) && ($filename !~ /$illegalchar/)) {...}
=> see also "man test"
> 2) Then Create the file
> The filename has to be variable (userdefined) , the extension stays
fixed .
my $filename = $user_input . $extension;
open FILE, ">$filename" or die "Can't create $filename: $!\n";
> Since the only Perl Book I ever read was "Perl for Dummies" - which
should
> explain why I'm posting here ;-),
If these simple questions are not answered by your book,
this won't help much unless you buy a useful book.
I suggest "Lerning Perl" -> "Programming Perl"
you can get both from O'Reilly
> and there is nothing to cover this topic, I thought it would be not
possible
> with Perl .
Do you now anything about perl?
> Can you create files from a Perl script ? If the answer is yes, what's
the
> command and syntax ?
>
> Please help me if you can .
>
> Ethan C. Castaneda
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 22 Oct 1999 00:14:02 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: At the risk of making myself an idiot ...How to create files in Perl ?
Message-Id: <s0vb2a37r0184@corp.supernews.com>
paranoid (genlabs@gmx.net) wrote:
: Craig Berry <cberry@cinenet.net> schrieb in im Newsbeitrag:
: s0uk275er0159@corp.supernews.com...
: > paranoid (genlabs@gmx.net) wrote:
: > : Ì hope anyone of you can answer my question,
: > : and mildly ignore it's dumbness .
: >
: > If and only if you pledge never to place an apostrophe in possessive
: > 'its', ever again, so long as you shall live.
:
: Excuse me ? Is this comp.lang.perl.misc ? I'm relieved , for a moment I
: thought it was
: alt.languages.english.grammar . Arrogancy could be taken for a lack of
: self-esteem...
Not arrogance, frustration. If English is not your first language, I
apologize. But this simple mistake is becoming infuriatingly common. I
did try to phrase my comment in an amusing way. Sorry it didn't come
across as intended.
: > So why haven't you fixed that? The Llama is the universally recommended
: > perl-for-beginners book, and the Camel is the essential reference for all
: > of us. You're doing yourself a grave disservice by trying to code using a
: > book which proudly proclaims that it considers you to be a dummy for
: > having bought it.
:
: Yeah, I admit that. I like Rich Tennant's sense of humor and I know about
: Camel. Hard to get in German.
Judging from your posts, your English is good enough to benefit from the
English-language editions.
: > : Can you create files from a Perl script ? If the answer is yes, what's
: > : the command and syntax ?
: >
: > perldoc -f open
:
: That's the syntax ? I think I'll better read the manual before I use that
: line in my script !
No, that's where to find a description of the syntax, which will be (a)
less error-prone than something I type or cut-and-paste here, and (b) lead
you to other similar resources currently on your hard drive.
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: Fri, 22 Oct 1999 09:47:33 +1000
From: "Brad Grove" <brad.grove@hcn.com.au>
Subject: Converting String To Upper and Lower Case
Message-Id: <MzNP3.3611$P3.4848@ozemail.com.au>
I don't do enough PERL scripting to remember how to do this. Could someone
please show me how to convert a string into upper and lower case at word
breaks and also just to convert the first character of a string to upper
case.
Thanyou in advance
Brad Grove
brad.grove@hcn.com.au
md@b130.aone.net.au
brad@md.com.au
------------------------------
Date: Thu, 21 Oct 1999 20:05:23 -0400
From: "Tim & Barbara Aldrich" <aldricht@onslowonline.net>
Subject: Re: Converting String To Upper and Lower Case
Message-Id: <s0vacie8r0113@corp.supernews.com>
$caps = uc($string);
Aldie
> I don't do enough PERL scripting to remember how to do this. Could someone
> please show me how to convert a string into upper and lower case at word
> breaks and also just to convert the first character of a string to upper
> case.
>
> Thanyou in advance
>
> Brad Grove
>
> brad.grove@hcn.com.au
> md@b130.aone.net.au
> brad@md.com.au
>
>
>
>
>
------------------------------
Date: Thu, 21 Oct 1999 20:13:01 -0400
From: "Tim & Barbara Aldrich" <aldricht@onslowonline.net>
Subject: Re: Converting String To Upper and Lower Case
Message-Id: <s0vaqsh2r0130@corp.supernews.com>
sorry the rest of it is :
$lower = lc($string);
$proper = ucfirst($string);
Tim & Barbara Aldrich <aldricht@onslowonline.net> wrote in message
news:s0vacie8r0113@corp.supernews.com...
> $caps = uc($string);
>
> Aldie
>
> > I don't do enough PERL scripting to remember how to do this. Could
someone
> > please show me how to convert a string into upper and lower case at word
> > breaks and also just to convert the first character of a string to upper
> > case.
> >
> > Thanyou in advance
> >
> > Brad Grove
> >
> > brad.grove@hcn.com.au
> > md@b130.aone.net.au
> > brad@md.com.au
> >
> >
> >
> >
> >
>
>
------------------------------
Date: Thu, 21 Oct 1999 19:52:38 -0400
From: "Tim & Barbara Aldrich" <aldricht@onslowonline.net>
Subject: define global variables
Message-Id: <s0v9klir0152@corp.supernews.com>
I am aware of my and local for defining local variables. If I don't use
either of these ... does that make it a global variable. Specifically if I
don't use either my or local inside a sub does that make a global variable
e.g..
$stuff = 83;
&load_um;
$still_more_stuff = ($more_stuff *2);
sub load_um
{
$more_stuff = ($stuff * 4);
}
TIA
aldie->Send();
------------------------------
Date: Thu, 21 Oct 1999 18:44:26 -0500
From: "Blair Heuer" <ab@cd.com>
Subject: Re: file upload
Message-Id: <7uo8k4$euc$1@fir.prod.itd.earthlink.net>
> You have to use binmode before you do any reading or writing to your
files.
>
> open INFILE, "<$myfile";
>
> binmode(INFILE);
Now do I only use this if it is a binary file then? Sounds dumb even as I
ask it, but i must know. This script is not only used for pictures... it is
used for all files, I had just noticed how it messed up the pictures.
Should i do a statement like:
if (-B $myfile) { binmode(INFILE); }
or will it work for both text and binary?
(yes, i know it needs the die in there, but i kept it out to keep down size,
but now while explaining it, I siad more that it would have take to just put
in :) )
-Blair Heuer
------------------------------
Date: Thu, 21 Oct 1999 23:35:54 GMT
From: iami@my-deja.com
Subject: help on substitute op (s) should be cancelled
Message-Id: <7uo80p$res$1@nnrp1.deja.com>
to group,
2 minutes after posting, i found the typo.
please ignore previous message concerning help with
s/// operator.
david johnson
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 21 Oct 1999 23:42:39 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: HELP- WILL PAY!!!
Message-Id: <7uo8d2$5v2$4@nickel.uunet.be>
In article <s0v3p3r6r0145@corp.supernews.com>, "Gary Kelley" <gary@cowboyfurniture.com> wrote:
>I need someone to write some perl (?) scripting for me, I am not coherent
>enough to do it myself. Here's what I need:
>I have a web site that I am showing an EXCEL (lotus) file on, I can upload
>the file, but I need to maintain the functionability of the program, ie. I
>need to make chagnes in certain cells, and have cooresponding cells make
>changes based on data input. sound crazy? heres the website;
>www.buyherefords.com/exfp.htm check it out and let me know, this is NOT a
>trick to get people to visit a site,this is a legitimate offer, reply to me
>at: gary@buyherefords.com
>Gary Kelley
>
In Excel, choose File/Save As... and select CSV (comma delimited) *.csv.
The rest obviously requires a Perl Hacker... :-)
Michel.
------------------------------
Date: Thu, 21 Oct 1999 23:47:53 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How do you split a string into fixed sized pieces?
Message-Id: <JCNP3.159$WM1.2538@nsw.nnrp.telstra.net>
On 21 Oct 1999 22:03:28 GMT,
Scott Frazer <scott.frazer@ericsson.com> wrote:
> OK, I'm new to Perl and can't figure out how to split a long string
> into fixed sized pieces. For example:
>
> input -> "0123456789abcdef"
> output -> an array of "0123", "4567", "89ab", "cdef"
substr or unpack seem to be logical candidates. A regexp also will do
it.
I will assume that you don't know the length of your string, but you
want 4 character chunks, and that you also want anything that's left
dangling at the end
Here's a few options:
#!/usr/local/bin/perl -w
use strict;
my $str = "abcdefghijklmnopqrstuvwxyz0123456789";
my $len = 5;
# substr
# Note that you can do the next one without using an offset, and with
# a replacement of ''. It'll just destroy the string you're working
# on.
# Note also that this becomes very ugly when you have to take care of
# everything
{
my @f;
my $offs = 0;
# Avoid 'substr outside of string' warning
# Realise that if your $len == 1,and you have a 0 in your
# string the loop will terminate
while ($offs < length($str) and
defined(my $ss = substr($str, $offs, $len)))
{
# Do this for no danglies
# last if length($ss) < $len;
push @f, $ss;
$offs += $len;
}
print join('-', @f), "\n";
}
# unpack
{
my $pat = "A$len";
# Do this for no danglies
# my $num = length($str)/$len;
# Do this for danglies
my $num = length($str)/$len + (length($str)%$len && 1);
my @f = unpack(${pat} x $num, $str);
print join('-', @f), "\n";
}
# Regexp
{
# Do this for no danglies
# my @f = $str =~ /.{$len}/g;
# Do this for danglies
my @f = $str =~ /.{1,$len}/g;
print join('-', @f), "\n";
}
OUTPUT
abcde-fghij-klmno-pqrst-uvwxy-z0123-45678-9
abcde-fghij-klmno-pqrst-uvwxy-z0123-45678-9
abcde-fghij-klmno-pqrst-uvwxy-z0123-45678-9
I'll leave the bencmarks and perl golf to others :)
Martien
--
Martien Verbruggen |
Interactive Media Division | Little girls, like butterflies, need
Commercial Dynamics Pty. Ltd. | no excuse - Lazarus Long
NSW, Australia |
------------------------------
Date: Thu, 21 Oct 1999 17:42:21 -0400
From: WoV <wizardofvobs@yahoo.com>
Subject: Re: How do you substitute '/' ?
Message-Id: <380F88BD.77D9B4D3@yahoo.com>
shylock wrote:
>
> Having trouble getting perl to susbstitute / (forward slash)
> using $line =~ s/\///;
>
> Any advice?
> Thanks
Disclaimer - not an expert
What I use is a different delimiter.. I believe that it may be
documented as such. For example, you can use ? as a delimiter,
or at least that is what I have used in the past.
Others in the group can show you better ways I am sure.
HTH,
Al
--
"A fool with a tool is still a fool"
Note: I don't check the posted email address often, if you want a
timely reply mail hazard@N-O~S'P&A`Meznet.net & remove N-O~S'P&A`M
------------------------------
Date: Fri, 22 Oct 1999 00:15:42 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How do you substitute '/' ?
Message-Id: <s0vb5e81r0143@corp.supernews.com>
shylock (junkNOjuSPAM@tfw.net.invalid) wrote:
: Having trouble getting perl to susbstitute / (forward slash)
: using $line =~ s/\///;
:
: Any advice?
See 'perlre'. But that expression you have above should eliminate the
first / encountered in $line as written. Is that not what you are trying
to do?
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: 22 Oct 1999 00:55:12 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Ignore the idiots
Message-Id: <7uoclg$jcn$1@nntp1.atl.mindspring.net>
Greg Snow (snow@statsci.com) wrote:
: I agree that using only 2 groups is an oversimplification, the question
: is: does the simplification aid the argument or harm it. I was arguing
: against splitting off an new group, (or a lot of groups for many different
: levels). Splitting groups is good if the posters will only post to the
: appropriate group, my point was that splitting off the experts group would
: only increase the total number of posts flying around, not improve either
: group (and I think that point is still valid).
To put it more succinctly, splitting a group only works when the group is
being overwhelmed with *signal*, not noise.
------------------------------
Date: Fri, 22 Oct 1999 00:30:12 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Is @INC lying to me?
Message-Id: <oeOP3.221$WM1.2874@nsw.nnrp.telstra.net>
On Thu, 21 Oct 1999 11:04:07 +0100,
Nick Condon <nick.condon@tamesis.com> wrote:
> I'm trying to build mod_perl for Apache, and I get this far:
>
> % make test
> perl -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests
> @ARGV;' t/*.t
> Can't locate loadable object for module Apache::Constants in @INC
> (@INC contains <..snip..> /usr/local/lib/perl5/5.005/sun4-solaris-thread
> <..snip>)
>
> % find /usr/local/lib/perl5 -name 'Constants*' -print
> /usr/local/lib/perl5/5.005/sun4-solaris-thread/Apache/Constants
> /usr/local/lib/perl5/5.005/sun4-solaris-thread/Apache/Constants.pm
>
> What's going on?
Are the permissions on the files and on all the directories leading to
there correct? i.e. Can the use account that runs the perl script
actually open those files for reading?
Martien
--
Martien Verbruggen |
Interactive Media Division | Failure is not an option. It comes
Commercial Dynamics Pty. Ltd. | bundled with your Microsoft product.
NSW, Australia |
------------------------------
Date: Thu, 21 Oct 1999 16:24:48 -0700
From: Abdoulaye Fofana <abdoulaye.fofana@compaq.com>
Subject: Mail::Send module doesn't work on NT
Message-Id: <380FA0C0.9320599C@compaq.com>
I've tried to use the "Mail::Send" module to send a mail message
programmatically in Perl on NT, but it gives an error
message from the Mailer.pm module : "No mailer type specified (and no
default available), thus can not find executable program."
Does anybody know any other mail module for Perl on NT or a way to
programmatically send a mail with Perl on NT.
Thanks in advance,
Here is a piece of my code:
if( my $mail = Mail::Send->new )
{
$mail->subject( $subj );
$mail->to( split(' ', $dist) );
$mail->cc( @cc );
my $mh = $mail->open;
print $mh $MAIL_MSG || die( "Cannot send mail msg" );
$mh->close || die( "Cannot close mail msg" );
}
else
{ die( "Cannot create mail msg" ); }
--
Abdoulaye Fofana
Compaq Computers
Email: abdoulaye.fofana@compaq.com
Tel: 408-285-2174
Fax: 408-285-6230
------------------------------
Date: Thu, 21 Oct 1999 19:10:19 -0400
From: John Kit <jkit@jpmorgan.com>
Subject: mv file routine in perl for NT & Unix?
Message-Id: <380F9D5B.7E132AA@jpmorgan.com>
Is there a move file, mv, routine in perl which would
work for NT & Unix?
Thanks
john
------------------------------
Date: Thu, 21 Oct 1999 16:38:44 -0700
From: Abdoulaye Fofana <abdoulaye.fofana@compaq.com>
Subject: Re: mv file routine in perl for NT & Unix?
Message-Id: <380FA404.27B2E397@compaq.com>
You can write a recursive subroutine for that whever if the file is a
directory or not., by using File::Copy module and later
on delete the source file.
Something like this:
use File::Copy;
&DIR_COPY ($source, $to);
&DIR_REMOVE($source);
#------------------------------------------------#-------------------#
sub DIR_COPY # D I R C O P Y #
{ #-------------------#
# Recursively copy the indicated file or directory from one location
# to another.
my (@List, $rec);
my ($file, $dest) = @_;
my $name = basename($file);
if ( -d $file)
{
mkdir ("$dest/$name", 0755);
opendir (DIR, $file);
while ( defined ( $rec= readdir (DIR ) ) )
{
next if ( $rec =~ m/^\./ );
chomp;
push (@List, "$file/$rec");
}
close (DIR);
foreach (@List)
{
&DIR_COPY($_, "$dest/$name");
}
}
else
{
copy ($file, "$dest/$name");
}
} #end DIR_COPY
#------------------------------------#---------------------------------#
sub DIR_REMOVE # D I R R E M O V E #
{ #---------------------------------#
# Recursively remove the package of directory, sub-directories & files.
# Returns 1 if successful, 0 otherwise.
my $file = shift;
if( -d $file )
{ # D I R E C T O R Y
my @lower;
opendir( DIR, $file ) || return( 0 ); # Failed to open
while( defined ($_ = readdir( DIR )) )
{
next if( m!^\.\.?$! ); # Skip '.' & '..'
chomp;
push( @lower, "$file/$_" ); # Collect lower files
} #end while
closedir( DIR ) || return( 0 ); # Failed to close
foreach( @lower )
{ return( 0 ) unless &DIR_REMOVE( $_ ); }
return( rmdir( $file ) ); # Kill the directory
}
else # F I L E
{ return( unlink $file ); } # Kill the file
} #end DIR_REMOVE
John Kit wrote:
> Is there a move file, mv, routine in perl which would
> work for NT & Unix?
>
> Thanks
>
> john
--
Abdoulaye Fofana
Compaq Computers
Email: abdoulaye.fofana@compaq.com
Tel: 408-285-2174
Fax: 408-285-6230
------------------------------
Date: Thu, 21 Oct 1999 23:12:03 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: New short cut assignment operators?
Message-Id: <s0v7e3lcr018@corp.supernews.com>
Email55555 (email55555@aol.com) wrote:
[snip]
: For example :
: We have $a -= $b; which is like $a = $a - $b;
: And for $a = $b - $a; why not $a =- $b;
C actually used this form as the only op= form, way back when the world
was young. The problem is that it leads to ambiguities. If I write
$a=-7;
do I mean "Set $a to the value -7" or "Subtract 7 from $a"? (The
maximum-munch rule would argue the latter, but this is awfully thin
syntactic ice to make programmers traverse).
Once the Gods of C noticed this problem, they shifted to the modern op=
rather than =op forms.
By the way, in C the old style could lead to some really migraine-inducing
behavior. For example,
a=*b;
should mean "multiply a by b and assign the result back to a" by
maximum-munch. But a whitespace-hostile programmer could very easily have
meant "assign to a what b is pointing to". Try debugging that one at
3am... :)
: Another example :
: $a .= $b; ( it's like $a = $a . $b; )
: Why not $a =. $b; (it's like $a = $b . $a; )
I've yearned for that one, sometimes. But again, what do you do with
$a=.7;
Is that an assignment of 0.7 to $a-as-a-number, or prepending '7' to
$a-as-a-string? The lexer knows, but do you? Even at 3am?
: The space (or newline) between operator and operant is important to avoid
: ambiguity,
But it's already firmly established by more than two decades of C and Perl
practice that (most) whitespace in expressions is optional. Far, far too
late to change that now, even if we wanted to.
: We already have this situation in Perl for operator x= .
: e.g.: $ax=4; is not the same as $a x=4;
Here's a nice example of where maximum-munch lexing matters and allows you
to predict the interpretation.
: If we accept operator =- , that means $a=-3; ( same as $a = -3;) is not same as
: $a =- 3;
: ( I hope there are not very many programmers who use this kind of style :-) )
: ( Note: you can't write $a =. 3; ==> compilation error. )
Why not? You can currently write '$a .= 3'; the rhs automagically
stringizes. Seems wrong-in-the-perl-sense to allow one and disallow the
other.
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: Fri, 22 Oct 1999 00:11:35 GMT
From: "Khalil Mohammed" <khalilm@home.com>
Subject: Passing variables between two Perl/CGI scripts
Message-Id: <XYNP3.1301$MX.278363@news1.rdc2.on.home.com>
Hi,
I have spent the better part of two days trying to solve this
problem and I hope someone can help. I have an HTML form that posts its data
to my Perl 5 cgi script. Within there, I use the CGI.pm to decode and
manipulate the data.
From here I need to repost (or resend for lack of a better word) to
another script located on someone elses secure server. I was told about the
LWP module but could not get this to work with the secure server (althougth
I did see mention of HTTPS in the perl doc but was unsure how to code this).
After doing more reading I ran into Net::SSLeay but from my understanding
this is currently "only available in the US". My provider does have OpenSSL
which I thought had Net::SLLeay but my Perl interpreter cannot find the
module. So I guess my question is how can I take the information passed to
my cgi script and resend it to another cgi script on a secure server?
Thanks in advance,
(The rapidly greying) Khalil
------------------------------
Date: Thu, 21 Oct 1999 13:11:15 -0400
From: WoV <wizardofvobs@yahoo.com>
Subject: perl compile question - Solaris
Message-Id: <380F4933.213E063D@yahoo.com>
I got the following error when I ran the "make" step installing the
latest version of perl. Below is a portion of the output containing
theerror: (I apologize the following lines may not come out in proper
wrapping format)
===== begin cut and paste snippet ==============================
`sh cflags libperl.a perlio.o` perlio.c
CCCMD = /apps/sparcworks_5.1/SUNWspro/bin/cc -DPERL_CORE -c
-D_REENTRANT -O
rm -f libperl.a
/etc/ar rcu libperl.a perl.o malloc.o gv.o toke.o perly.o op.o regcomp.o
dump.o util.o mg.o byterun.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o
pp_ctl.o pp_sys.o doop.o doio.o regexec.o taint.o deb.o universal.o
globals.o perlio.o
mksh: Fatal error: Cannot load command `/etc/ar': Permission denied
Current working directory /home/aneill/wrkspc/perl/perl5.005_03
*** Error code 1
make: Fatal error: Command failed for target `libperl.a'
====== end cut and paste snippet ==============================
I did some research in the install documentation and on deja, and
found that ar is needed, and it is in /usr/ccs/bin. The directory
/usr/ccs/bin is on my path (that is the "make" I am using)
The file it is complaining about is in /etc. The directory /etc is
_not_ on my path however, nor is it contained in any of my environment
variables. I am assuming though that somehow the make is confused
and is trying to execute the ar in /etc as if it were the one in
/usr/ccs/bin.
I retried the make after moving the offending file aside (shutting
down the AR system first), the make still failed with the same problem,
so I did a make distclean and started again with the Configure.
The make then appeared to work, as did the make test and make install.
My question is, did I do the right thing on this, or will this cause
problems later when I move the file back to /etc/ar
(the file in question - /etc/ar - is used by the remedy AR change
tracking tool which is installed on the system)
Thanks,
Al
--
"A fool with a tool is still a fool"
Note: I don't check the posted email address often, if you want a
timely reply mail hazard@N-O~S'P&A`Meznet.net & remove N-O~S'P&A`M
------------------------------
Date: Fri, 22 Oct 1999 00:45:45 +0100
From: "Martin Elliott" <martin@mert.globalnet.co.uk>
Subject: Re: Perl Programmer Wanted
Message-Id: <7uo96c$4km$1@gxsn.com>
I've had a look at those perldocs, and seem to be going in the right
direction. I'm just trying to sort out how to, having sorted out the order,
re-write the database minus the order that has just gone through.
Thanks for the help.
Martin
------------------------------
Date: Thu, 21 Oct 1999 23:28:58 GMT
From: Johannes <jspangen@my-deja.com>
Subject: Re: problem with substitute op (s)
Message-Id: <7uo7jn$r37$1@nnrp1.deja.com>
In article <7uo5g4$po4$1@nnrp1.deja.com>,
iami@my-deja.com wrote:
> hello.
> i will be brief.
> (please excuse any sperious wrap-arounds. i am posting this
> from deja.com.)
> perl -v
> This is perl, version 5.005_02 built for sun4-sunos
>
> code:
>
> #!/usr/local/bin/perl
> $_ = "-rw-rw-r-- 1 root ftp 148 Jun 5 22:01
> uuencode.README\n";
> print;
> s/^.+[0-2][0-4]:[0-6][0-9]\040+//;
> print;
>
> $_ = "-rw-rw-r-- 1 root ftp 230 Jul 22 16:36
> tiff.README\n";
> print;
> s/^.+[0-2][0-4]:[0-6][0-9]\040+//;
> print;
>
> output:
>
> -rw-rw-r-- 1 root ftp 148 Jun 5 22:01 uuencode.README
> uuencode.README
> -rw-rw-r-- 1 root ftp 230 Jul 22 16:36 tiff.README
> -rw-rw-r-- 1 root ftp 230 Jul 22 16:36 tiff.README
>
> the first string substitutes as expected.
> the second case does not.
> there are no non-printable characters in the second string.
> ???
Your regex matches the time wrong
s/^.+[0-2][0-4]:[0-6][0-9]\040+//;
^-- this allows only 0-4 on the second digit
This will work for your example:
s/^.+([01]?[0-9]|2[0-3]):[0-5][0-9]\s+//;
but it won't work for files that are older then one year.
In that case the time looks like "Sep 17 1998 README".
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 22 Oct 1999 00:13:16 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Reference challenge
Message-Id: <w_NP3.230$4G.62541@news.itd.umich.edu>
The challenge:
Write a 100% Perl, 100% portable, 100% bulletproof subroutine that will
determine whether its single argument is a reference, and if so, what type
of reference it is.
Conditions:
1) You may not call any functions which are not themselves 100% Perl, except
those described in the perlfunc man page. This includes UNIVERSAL::isa().
2) You may not use any implementation details of your particular version
of Perl. If the manual states only that a given function returns FALSE
under certain circumstances, then you may not distinguish its return value
between the values undef, "", 0, and "0".
3) If the reference passed is a coderef, you may not execute it to establish
this fact. (The subroutine may take a long time, crash the interpreter,
or do other undesirable things, after all.)
This challenge comes from my investigations into the issues raised by the
thread entitled "Underlying data structure behind blessed reference". I
don't believe a solution to this challenge exists, though I'm not
completely certain.
If condition 3 is relaxed, I've been able to come up only a single, highly
klugey solution.
--
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: 21 Oct 1999 23:29:22 GMT
From: petolino@joe.Eng.Sun.COM (Joe Petolino)
Subject: Re: Regexp global match mystery?
Message-Id: <7uo7ki$6bu$1@engnews2.Eng.Sun.COM>
In article <380F93BD.69C1A86F@webmagic.n.se>,
WebMaster <webmaster@webmagic.n.se> wrote:
>The code where the global match is evaluated is shown below
>
>if ($method eq "match") {
> print "Metoden är match",br;
> if ($mod=~ /g/) {
> print "Metoden är global match",br;
> $count=0;
> if ($result=~ /($regexp)/go) {
> ($m1,$m2,$m3,$m4,$m5,$m6,$m7,$m8,$m9,$m10) = ($result=~
>/$regexp/go);
> @globalresult = ($m1,$m2,$m3,$m4,$m5,$m6,$m7,$m8,$m9,$m10);
> while (@globalresult[$count] && $count <10 ){
> print hr,"<CENTER>Matched parantheses number$count or matched
>string$count if no parantheses in Regexp
>is</CENTER>",br,$globalresult[$count],br;
>
>
>The file I use as input looks like this
>
>Rad 1 RAD 1
>Rad 2 RAD2
>Rad 3 RAD 3
>Rad 4 RAD 4
>Rad 5 RAD 5
>Rad 6 RAD 6
>Rad 7 RAD 7
>Rad 8 RAD 8
>Rad 9 RAD 9
>Rad 10 RAD10
>
>Using the regexp /Rad\s\d+/ return the results I expect except that the
>first expected match (i.e Rad 1) isn't returned in $globalresult[0], Rad
>2 is???
>
>Am I doing a perl programming mistake or misinterpretation of how the
>regexp should work?
You haven't shown us the value of $result, so I'm just guessing here, but I
think your problem is that you do two //g matches on $result:
> if ($result=~ /($regexp)/go) {
> ($m1,$m2,$m3,$m4,$m5,$m6,$m7,$m8,$m9,$m10) = ($result=~ /$regexp/go);
The first match is in a scalar context, so it moves the pos($result) pointer
past the first matching string. The second one, in a list context, starts
looking at $result at pos($result), i.e. after the first matching substring,
not at the beginning of $result. This code might work better:
if (@globalresult = ($result =~ /$regexp/g)) {
while (@globalresult[$count] && $count <10 ){
[ etc. ]
You don't want the 'o' modifier on the match if this code gets executed
more than once with different values of $regexp.
Read 'perldoc perlre', and 'perldoc perlfunc' for pos(), if any of this is
still confusing.
-Joe
------------------------------
Date: Thu, 21 Oct 1999 23:49:31 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: stealing the news: how hard can it be?
Message-Id: <7uo8pu$5v2$5@nickel.uunet.be>
In article <7uo0ai$lvj$1@nnrp1.deja.com>, dsparling <dsparling@my-deja.com> wrote:
>I'm curious of the legal ramifications if I want to do this on a
>commercial site...I've written a Perl CGI script to pull weather info
>from rainorshine.com that I'd like to use on one of my projects.
>
Have you checked with the original site to see what their copyright policy
is ?
I would imagine that they would be quite unhappy if you simply rip
off everything and do as if YOU provided that service.
But a limited extract with a pointer to the originating site may make
them happy...
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Now why would I want to buy Deja.com ?
Michel.
------------------------------
Date: Thu, 21 Oct 1999 16:51:59 -0700
From: Shuba Swaminathan <sswaminathan@micron.com>
Subject: Unlink
Message-Id: <380FA71E.203197C0@micron.com>
Folks,
Have you had any experience with "unlink" being
unreliable? I understand unlink will not work with
wildcards but is there a restriction for the
concatenation operator? My code line looks like:
unlink("LOCK.$num") or eval {print ERROR "022
Could not delete lock file\n"; exit 1;};;
where $num is a variable I have initialized. I
want it to delete files with names like lock.001,
lock.002 etc. This seems to work most of the time
but bombs out on me occassionally. If the problem
is with my code, I dont understand why this works
most of the time.
I am interfacing this code with another system,
which I am starting to think, is where the problem
lies. The folks there are pointing to my script.
Please help! Your input is much appreciated.
TIA,
Shuba.
------------------------------
Date: 21 Oct 1999 16:20:15 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Where is the c.l.p.m charter?
Message-Id: <m1r9iob8sw.fsf@halfdome.holdit.com>
>>>>> "Mike" == Mike Salter <msalter@bestweb.net> writes:
Mike> <2 cents>
Mike> Rather than continue the "Ignore the idiots" thread, I thought I might
Mike> start with the above question. I searched for the charter, but couldn't
Mike> locate it. Perhaps someone could post it here, and from there continue a
Mike> discussion based that.
Mike> Since this is an unmoderated group, it might help if guidelines for this
Mike> group, as well as url's to FAQs and other sites were posted once a month
Mike> for users new to this group.
Mike> </2 cents>
You mean, besides the FAQ that gets posted EVERY THREE DAYS by gnat?
And sent to every new user besides?
And the Perl Mini-FAQ that gets posted *weekly* to comp.lang.perl.announce?
You want to reduce that from EVERY THREE DAYS down to a month? Why?
:-)
--
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: Thu, 21 Oct 1999 20:00:58 -0400
From: "Tim & Barbara Aldrich" <aldricht@onslowonline.net>
Subject: Re: win32::odbc question
Message-Id: <s0va4996r0135@corp.supernews.com>
try pulling the count through a sql statment:
SELECT COUNT(*) AS my_count FROM BLAH
$db->FetchRow();
$Count = $db->Data("my_count");
aldie
> hi,
>
> I 'm using win32::odbc to connect to an rdb database and I need to know
> if there is a way to query the module in such a way that it tells me the
>
> number of rows retrieved from a select.
> I used $db->RowCount() but it returns -1.
>
> Is it possible to instruct FetchRow to start at a specified index istead
>
> of having to run through all the record set?
>
> any help appreciated
>
> tia
>
> joao sil
> joao.f.sil@telecom.pt
>
>
>
------------------------------
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 1146
**************************************