[6943] in Perl-Users-Digest
Perl-Users Digest, Issue: 568 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 4 11:12:02 1997
Date: Wed, 4 Jun 97 08:00:21 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 4 Jun 1997 Volume: 8 Number: 568
Today's topics:
Re: Array of hashes with use strict; (Brian Jepson)
Can you write about Perl? (Philip Pendleton)
Re: Cookies using the Perl CGI.pm module(s) (Jay Flaherty)
Re: data structure question (Tad McClellan)
Re: Decoding of the 'Zafir' language :) (Lack Mr G M)
EBCDIC and Perl <liquid@izzy.net>
Re: find out no.of lines in open file (OEyvind Saeter)
Help building a regexp (bug?) (Eric Roode)
Re: malformed header from script ??? <rootbeer@teleport.com>
Re: mount command in an suid script - howto ? (Helmut Jarausch)
Re: Newbie question <Elias.Martenson@sweden.sun.com>
newbie question2 <steven.depuydt@wkb.be>
Re: pack template that packs like 'a' but unpacks like <uwe@ptc.spbu.ru>
Re: printing a hash in order? <zenin@best.com>
Re: reading a file (html) from an other server (Clay Irving)
Re: reading and writing from/to the same file <zenin@best.com>
Re: Reading Comma delimited, Quoted String records (Bob Wilkinson)
Segmentation fault from multiple mkdirs in Perl script <bruno@prior.ftech.co.uk>
Re: Solaris 2.5 perl compile problem <clark@s3i.com>
tr problems with variables <dani@apb.es>
Re: uuidgen in perl? <liquid@izzy.net>
Re: why won't 'print <<end_print...end_print' work? (Charles DeRykus)
Re: why won't 'print <<end_print...end_print' work? <sextw@ils.unc.edu>
Win32::ODBC via NETSCAPE on NT <BirdzYa@snakebite.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 4 Jun 1997 12:01:04 GMT
From: bjepson@ids.net (Brian Jepson)
Subject: Re: Array of hashes with use strict;
Message-Id: <slrn5pam0e.ah.bjepson@Sol2-5.ids.net>
In article <5n20rt$gj4$1@hiekkalaatikko.cs.hut.fi>,
Joonas Timo Taavetti Kekoni wrote:
>
>i have $code[}{} structure. How can i define it using my with
>use strict; ?
>
I'm not completely sure what you mean by the above example; perhaps if
you included a line or three of code that is causing use strict to
complain...
>I have tried almoust anything and adding a # before use strict was the only
>working solution. I am not familiar with perl pointers.
>
>With commonn sense my( %@code ); would sound logical, but wont work.
>
Perhaps you are trying to do something like what I've shown below.
An array's just an array. Scope it with my, and then add whatever
you want to it; references, ordinary scalars, etc.:
#!/usr/bin/perl -w
use strict;
my @code; # An array's just an array
# construct a couple of hashes.
#
my %hash1 = ( hair => 'n/a',
tea => 'earl grey, hot',
job => 'captain' );
my %hash2 = ( hair => 'lots',
tea => 'yes, please',
job => 'guitarist/vocalist' );
# Add some elements to the array - these are
# references tot he hashes.
#
push @code, \%hash1;
push @code, \%hash2;
foreach (@code) {
# Dereference the array element to fetch the
# job and tea preferences from the hash.
#
my $job = $_->{job};
my $tea = $_->{tea};
print qq[How would the $job like his tea?\n];
print qq[Tea? $tea.\n\n];
}
Hope this helps,
--
Brian Jepson * (bjepson@ids.net) * http://www.ids.net/~bjepson
Int(ra|er)net Database Developer, Author, Crypto-Fluxologist
Non-Prophet Arts Technology Flux: http://www.ids.net/~as220
WWW/Database/NT,Java/Database: http://www.ids.net/~bjepson/books
------------------------------
Date: Tue, 03 Jun 97 17:51:42 GMT
From: philipp@saji.com (Philip Pendleton)
Subject: Can you write about Perl?
Message-Id: <5n1lk5$e67@news.bogo.co.uk>
Coded Magazine is a monthly online programming magazine that looks at all
aspects of computer programming including web development.
If you can write both interesting and informative articles aimed at the novice
and intermediate programmer, we'd love to hear from you.
Please email editor@coded.co.uk
------------------------------
Date: 4 Jun 1997 12:34:26 GMT
From: fty@hickory.engr.utk.edu (Jay Flaherty)
Subject: Re: Cookies using the Perl CGI.pm module(s)
Message-Id: <5n3nci$hd7$1@gaia.ns.utk.edu>
Did you ever look at the excellent documentation that Mr. Stein wrote about
his module? go to:
http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html
Jay
robrecht@neonsoft.com wrote:
: I have a requirement to pass 1 or more cookies between CGI scripts. How
: in the world do I do this using the CGI.pm modules?
--
**********************************************
Jay Flaherty fty@utk.edu
If software was free, who would pay "THE BILL"
**********************************************
------------------------------
Date: Tue, 3 Jun 1997 15:32:18 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: data structure question
Message-Id: <i0v1n5.skc.ln@localhost>
Chipmunk (Ronald.J.Kimball@dartmouth.edu) wrote:
: In article <5muqmu$l0b$1@paladin.american.edu>
: jn0729a@cage.cas.american.edu (Jon Nathan) writes:
: I'll just comment on your code...
I'll just comment on your code... ;-)
: > while ($quote=<QUOTES>){
: This will end prematurely if a line in the file evaluates to false
: (such as "0\n");
^^^^^^^^^^^^^
But that is not false.
False is 1) undef
2) empty string
3) 0 (a number)
4) "0" (a string)
"0\n" isn't any of those. "0\n" gets converted to 0 (a number) when
you use it as a number, but "evaluating truth" is not using it as
a number.
-------------------
#! /usr/bin/perl -w
while ($i = <DATA>) { # would not print "three" if "0\n" was false...
print $i;
}
__DATA__
one
0
three
-------------------
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Tue, 03 Jun 1997 17:48:56 BST
From: gml4410@ggr.co.uk (Lack Mr G M)
Subject: Re: Decoding of the 'Zafir' language :)
Message-Id: <1997Jun3.174856@ukwit01>
In article <5n1bks$p1j@hrotti.ifi.uio.no>, tina@htmlhelp.com (Tina Marie Holmboe) writes:
|>
|> As you can see, the language is a very simple one. This is his suggestion
|> for an algorithm, using the test-string
|>...
|> here, for comparison, is mine:
|>
|> $s = "Gnillor No eht Roolf Gnihgual Dna Gniracs Eht Tac" ;
|> $s =~ y/A-Z/a-z/ ; $s = ~s/(\S)(\s|$)/\u$1$2/ig ;
|> foreach $w (split(/ /,$s) ) {
|> foreach $c( reverse( split(//,$w) ) ) {
|> print $c ;
|> }
|> print" " ;
|> }
|> print "\n" ;
|>
|>
|> Comments ? As there is More Than One Way, I'd love to see some suggestions
|> for other implementations... >:) Any RegExperts willing to attempt a
|> oneliner ?
Not with regexps, but here is one:
$s = "Gnillor No eht Roolf Gnihgual Dna Gniracs Eht Tac" ;
$res = join(" ", map {ucfirst lc reverse $_} split(" ", $s));
print $res . "\n"
This will fail with any words containing hyphens, apostrophes etc.
--
----------- Gordon Lack ----------------- gml4410@ggr.co.uk ------------
The contents of this message *may* reflect my personal opinion. They are
*not* intended to reflect those of my employer, or anyone else.
------------------------------
Date: Wed, 04 Jun 1997 08:57:43 -0400
From: Daniel Honig <liquid@izzy.net>
Subject: EBCDIC and Perl
Message-Id: <33956647.11D5@izzy.net>
Has anyone seen or written a perl script to convert
between EBCDIC and ASCII?
Or if nothing else a reference page on the web for EBCDIC?
Thanks!
Daniel Honig
------------------------------
Date: Wed, 04 Jun 1997 13:35:55 GMT
From: oes@pVv.org (OEyvind Saeter)
Subject: Re: find out no.of lines in open file
Message-Id: <5n3r0o$c9n@news1.sol.no>
s11976@net2.hkbu.edu.hk (Pui Ming WONG) once wrote somethings like:
>I have a trivial question as i just get started on perl
>In my program i have opened a file,i.e.
>open(COUNT,"$myfilename")
one simple way is:
$NrOfLines = 0;
open(COUNT, "$myfilename");
while(<COUNT>) {$NrOfLines++;}
------------------------------
Date: Wed, 4 Jun 1997 11:16:42 GMT
From: sdn@mv.mv.com (Eric Roode)
Subject: Help building a regexp (bug?)
Message-Id: <EB90nu.Hp8@mv.mv.com>
I am trying to match lines of the form:
(junk) word (junk) word (junk)
where (junk) is irrelevant, and (word) is any one of a given
list of words. This list is used in several places in the
program, and is subject to change, so I want to define the
list at the top of the program, and build a regexp from it.
Presumably the best way to do this is by join'ing the words
with a pipe character.
One complication is that the names can contain special characters;
in fact, one of the names has a pipe character in it. So I have
to include \Q and \E in my join. No problem, I thought. However,
if you run the following fragment, you will see that it did not
work as I expected:
--------- BEGIN PROGRAM ---------
@names = qw/Eric Matt Jeff/;
$any = join ('|', @names);
$anyQ = '\Q' . join ('\E|\Q', @names) . '\E';
$anyQQ = '\\Q' . join ('\\E|\\Q', @names) . '\\E';
while (<>)
{
($one,$two) = /(\QEric\E|\QMatt\E|\QJeff\E).*(\QEric\E|\QMatt\E|\QJeff\E)/i;
print "Explicit pattern: $one, $two\n" if $one && $two;
($one,$two) = /($any).*($any)/oi;
print "Without quoting: $one, $two\n" if $one && $two;
($one,$two) = /($anyQ).*($anyQ)/oi;
print "With quoting: $one, $two\n" if $one && $two;
($one,$two) = /($anyQQ).*($anyQQ)/oi;
print "Double quoting: $one, $two\n" if $one && $two;
}
--------- END PROGRAM ---------
Input: Eric and Matt
Output: Explicit pattern: Eric, Matt
Without quoting: Eric, Matt
Input: QEricE and QMattE
Output: Explicit pattern: Eric, Matt
Without quoting: Eric, Matt
With quoting: Eric, Matt
I am using perl 5.003 on an SGI and on a Sequent. Obviously, I could
break the line up into words and parse them individually, but this
seems clumsy to me when a simple regexp should do it. Clues, anyone?
TIA,
Eric
--
"I feel my body weakened by the years
As people turn to gods of cruel design
Is it that they fear the pain of death
Or could it be they fear the joy of life?" -- Toad The Wet Sprocket
------------------------------
Date: Wed, 4 Jun 1997 07:17:59 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Yan Zhou <yzhou@mtu.edu>
Subject: Re: malformed header from script ???
Message-Id: <Pine.GSO.3.96.970604071659.25443B-100000@kelly.teleport.com>
On Tue, 3 Jun 1997, Yan Zhou wrote:
> I have written a perl program, which requires cgi-lib.pl, a perl
> routine.
You should really use CGI.pm for new development.
> But after I put "print &PrintHeader" at my perl code. I still have
> to put it into cgi-lib.pl, too. Otherwise I was notified as "500 Server
> Error: malformed header from script".
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to
solving such problems. It's available on the perl.com web pages. Hope
this helps!
http://www.perl.com/perl/
http://www.perl.com/perl/faq/
http://www.perl.com/perl/faq/idiots-guide.html
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: 4 Jun 1997 11:24:46 GMT
From: jarausch@numa1.igpm.rwth-aachen.de (Helmut Jarausch)
Subject: Re: mount command in an suid script - howto ?
Message-Id: <5n3j9u$srg$1@news.rwth-aachen.de>
In article <5n380g$n0l$1@news.rwth-aachen.de>, jarausch@numa1.igpm.rwth-aachen.de (Helmut Jarausch) writes:
|> Hi,
|> I tried to use
|> system('/bin/mount ...');
|> in a script that has been set root+suid (yes, I have suidperl)
|>
|> Still, I get the (system) error message
|> mount: only root can do that.
|>
|> Probably the read UID is not root when mount is invoked.
|> What did I miss?
|> (setting mount itself to root/suid is not a solution, since I only want users
|> to mount floppies)
|>
|
Sorry for replying to my on posting.
Meantime I found out, that I have to say
use POSIX qw(setuid);
setuid(0);
Is that what suidperl is assumed not to do ?
Helmut.
--
Helmut Jarausch
Lehrstuhl f. Numerische Mathematik
Institute of Technology
RWTH Aachen
D 52056 Aachen, Germany
------------------------------
Date: Wed, 04 Jun 1997 13:56:43 +0200
From: eliasm <Elias.Martenson@sweden.sun.com>
To: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Newbie question
Message-Id: <339557FA.36C7@sweden.sun.com>
Andrew Johnson wrote:
>
> ! Bill Thompson wrote:
> ! >
> ! > To get the number of characters in a string, I'm
> ! > using the following:
> ! >
> ! > sub ChkQID {
> ! > my ($QID) = @_;
> ! > my ($nchars, $i);
> ! >
> ! > $_ = $QID;
> ! > $nchars = tr/\000-~//; # get the number of characters
> ! >
> ! > Is there a better way?
> !
> ! How about:
> !
> ! $nchars = scalar(split(//, $_));
> !
> ! ;-)
> !
> ! Chipmunk
>
> hmm
> or even:
>
> $nchars=pos if /$/g;
> or
> $nchars=s/(.)/$1/g;
>
> or perhaps an ugly regex approximation of a map{} in
> void context:
>
> s/(.)/!$`?$nchars=1:$nchars++;$1/eg;
>
> :-0
>
> (it would be nicer? if we could assume $nchars
> was zero to start with: s/(.)/$nchars++;$1/eg; and
> even a bit funky with a better choice of delimiter
> s+(.)+$nchars\+\+;$1+eg;
>
> ;)
> andrew
Now, what is so wrong with the command "length"?
Regards / Elias
------------------------------
Date: Wed, 04 Jun 1997 15:05:39 -0700
From: steven depuydt <steven.depuydt@wkb.be>
Subject: newbie question2
Message-Id: <3395E6B3.68A0@wkb.be>
Is there a way to do this:
open (SM,"test.txt");
while(<SM>) {
if (/picture ([0-9]{1,8})\.wmf/) {
s/$1\.wmf/nice.gif/g;
}
}
This piece of code doesn't work.
I want to reuse the digits ([0-9]{1,8}) in my replecement rule.
Is there a way to do this?
Thanks for any help.
Steven.
------------------------------
Date: Wed, 4 Jun 1997 15:01:19 +0400
From: "Valeriy E. Ushakov" <uwe@ptc.spbu.ru>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: pack template that packs like 'a' but unpacks like 'A'
Message-Id: <%MSUlzQdaP@snark.ptc.spbu.ru>
On Tue, 3 Jun 1997, Tom Phoenix wrote:
> > If the very idea of this new format letter is deemed inapropriate and
> > in contradiction with perl spirit, I'd like to be enlightened why.
>
> I'd hesitate to go that far, but I would be reluctant to add letters to
> the options for pack/unpack. It's got a lot of options; some would say too
> many already!
So it's amusing, why none of them do the right thing for the case I'd
not call uncommon -- interfacing with other programms written in C
(read with OS).
'A' is ok for text only data. 'a' is just fine for grabbing binary
data. But text can be embedded in binary data and rules of C require
that it must be null terminated (null paddedd), but in perl I don't
care for this nulls.
> > At first glance, implementing it requires 3 (!) lines of C code in
> > pp.c: two case labels for this new letter in pp_pack and pp_unpack and
> > modifying one condition in pp_unpack to handle this new letter the way
> > 'A' is.
>
> Well, that sounds painless. But can you explain again why you can't just
> pack and unpack with 'a'? That seems to be correct, to my way of thinking,
> so I know that something must be wrong with it. :-)
The following is a little complaint script. It use reading wtmp as an
example (it's BSD style wtmp) but the similar problem will arise for
*ANY* printable string stored in fixed length field of a C struct.
Since string is printable, I want nulls to be stripped off when I
unpack the struct. But when I pack the struct, I want padding with
nulls since this is the way C wants it.
#!perl
$struct_utmp_A = "A8 A8 A16 L";
$struct_utmp_a = "a8 a8 a16 L";
$sizeof_utmp = 36;
$_PATH_WTMP = "/var/log/wtmp";
open WTMP, "$_PATH_WTMP" or die "$_PATH_TMP:$!\n";
read WTMP, $wtmp, $sizeof_utmp or die "read: $!\n";
@wtmp_A = unpack $struct_utmp_A, $wtmp;
@wtmp_a = unpack $struct_utmp_a, $wtmp;
# I don't want trailing nulls in user, line and host names!
# My login name is 'uwe', not 'uwe\0\0\0\0\0'
print "'a' doesn't strip nulls\n" if $wtmp_a[1] =~ /\0/;
# I can't pack with 'A' if C program is to read these record, for it
# expects null, not space. My login name is 'uwe' not 'uwe '
$wtmp_A_prim = pack $struct_utmp_A, @wtmp_A;
print "'A' is not reversible\n" if $wtmp_A ne $wtmp_A_prim;
__END__
Does it make sense?
So now I have two options:
o maintain two tempalates for packing and unpacking, which is
error prone
o unpack with 'a' and strip trailing nulls manually, which is even
worse
Now compare this to 3 lines of C code.
SY, Uwe
--
uwe@ptc.spbu.ru | Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/ | Ist zu Grunde gehen
------------------------------
Date: 4 Jun 1997 10:41:31 GMT
From: Zenin <zenin@best.com>
Subject: Re: printing a hash in order?
Message-Id: <5n3gor$brq$2@nntp2.ba.best.com>
Andrew Starr <atstarr@negia.net> wrote:
> Am I correct that it is basically impossible, just using a hash, to print
> it in order?
>snip<
> and, just as the Camel book says, the order is seemingly random.
> Yet if I use "sort keys %hashname", I get the sorted order, but this is
> NOT what I want; I want the order they are entered, not an alpha sort.
In the order you originaly set it, no you can't. -At least not without
some hackery.
> Thus what I did was to create an array of the variable names,
>snip<
Basicly, ya, that's what you'll need to do. -Or use multidementional
hashes, but that could get ugly.
> *when does one need to and not need to use \n's when printing?
When one does or does not want to add a newline (\n) when printing.
> Is it mandatory for every print?
Only if you want to add a newline to what you are printing. -If you
are printing a var, it may already have a newline in it. In that
case you would just get two newlines printed.
> What happens without it?
It doesn't print it. :)
print "this is a";
print "test\n";
-Prints: this is a test
print "this is a\n";
print "test\n";
-Prints: this is a
test
-Zenin
zenin@best.com
------------------------------
Date: 4 Jun 1997 09:50:57 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: reading a file (html) from an other server
Message-Id: <5n3rs1$hgd@panix.com>
In <3393D933.22C0@rzaix340.rz.uni-leipzig.de> Ekin Sokmen <mai96lgo@rzaix340.rz.uni-leipzig.de> writes:
>Hallo,
Howdy.
>How can I reach a html file on an other server with perl (cgi)?
With the LWP module -- Check CPAN or http://www.sn.no/libwww-perl/
--
Clay Irving See the happy moron,
clay@panix.com He doesn't give a damn,
http://www.panix.com/~clay I wish I were a moron,
My God! Perhaps I am!
------------------------------
Date: 4 Jun 1997 10:48:42 GMT
From: Zenin <zenin@best.com>
Subject: Re: reading and writing from/to the same file
Message-Id: <5n3h6a$brq$3@nntp2.ba.best.com>
thordur arnason <thordur@eunet.no> wrote:
> When I open a file with
> open(filehandle,"+>foo.dat")
> and then traverse the file with
> while (<filehandle>)
>snip<
You are destroying the file when you open it that way. -It gets
recreated containing 0 data. What you probably want is:
open (FILEHANDLE, "+<foo.dat") || die $!;
This is read + write, instead of write/create + read. This version
will fail if the file doesn't exist.
Are you sure you got any output at all using "+>foo.dat"...? You
should't have.
Also, take a look at the -i flag of perl. It might be of use here.
-Zenin
zenin@best.com
------------------------------
Date: Wed, 04 Jun 1997 14:38:23 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: Reading Comma delimited, Quoted String records
Message-Id: <b.wilkinson-0406971438230001@ip57-york.pindar.co.uk>
In article <01bc6fc2$4805a7c0$fc412b9f@seanhome>, "Sean M. McKee"
<mckee@misslink.net> wrote:
> Does anyone know of a way to read and parse comma delimited string quoted
> records with awk or perl?
>
> I know how to read a comma delimited file (awk -F:) but if a string field
> contains a comma (eg. ...,"McKee, Sean",...) then the field is surrounded
> in double quotes. Is there a way to deal with this?
>
>
> Sean McKee
> mckee@misslink.net
Hello,
The Perl FAQ part 4 recommends :
use Text::Parsewords;
@new = quotewords(",", 0, $text);
Assuming that $text contains the text you wish to parse.
Please read the FAQ - it is your friend.
Bob
--
I have become death, destroyer of the worlds.
------------------------------
Date: Wed, 04 Jun 1997 14:23:21 +0100
From: Bruno Prior <bruno@prior.ftech.co.uk>
Subject: Segmentation fault from multiple mkdirs in Perl script - Help!
Message-Id: <33956C49.5D71@prior.ftech.co.uk>
I have written a basic Perl(4) script to create around 250 new
sub-directories (one for each nation, using the ISO codes for the
coutries). It is a simple foreach loop that accesses the keys of a DBM
database, and performs a mkdir based on each of these keys.
When I run this script, it creates a few of these directories, then
collapses with a segmentation fault. The number it creates depends on
whether I run it as a CGI script or called directly (in which case it
gets a little further). I guess this indicates that it's some sort of
memory problem. Does anyone have any ideas?
I am running this on a P120, 32 Mb RAM, under Linux 1.3.45.
Thanks for any suggestions.
Cheers,
Bruno bruno@prior.ftech co.uk
------------------------------
Date: 04 Jun 1997 09:59:07 -0400
From: Clark Dorman <clark@s3i.com>
Subject: Re: Solaris 2.5 perl compile problem
Message-Id: <dsoyy79lg.fsf@s3i.com>
Paul Molenda <molenda@ibm.net> writes:
> I wonder if anyone could help me with this:
> I have problem building perl 5.001 on Solaris 2.5.1 with GCC 2.6.3 all
> default responses to
> Configure.
> I am getting Fcntl "Can't open PIC for reading" problem that I have
> seen mentioned in this
> newsgroup several times:
[snip]
> Miniperl builds and tests fine.
> What other options should I try?
Well, I'd say first off you should get the newer version of Perl
(we're up to 5.004 now) and the newer versions of gcc (up to 2.7.2.2
now). perl 5.001 and gcc 2.6.3 are both kind of old now.
Also, what sort of machine are you doing this on? It worked fine on a
Sun Sparcstation 20. In the config.sh, I have a line that says:
cccdlflags='-fpic'
The version of gcc you are using may or may not support pic
compilation on the machine you are using. Can you get configure to
get rid of the -fpic in th compilation? Or try -fPIC instead. From
the gcc info pages (under Code Gen Options):
`-fpic'
Generate position-independent code (PIC) suitable for use in a
shared library, if supported for the target machine. Such code
accesses all constant addresses through a global offset table
(GOT). If the GOT size for the linked executable exceeds a
machine-specific maximum size, you get an error message from the
linker indicating that `-fpic' does not work; in that case,
recompile with `-fPIC' instead. (These maximums are 16k on the
m88k, 8k on the Sparc, and 32k on the m68k and RS/6000. The 386
has no such limit.)
Position-independent code requires special support, and therefore
works only on certain machines. For the 386, GNU CC supports PIC
for System V but not for the Sun 386i. Code generated for the IBM
RS/6000 is always position-independent.
The GNU assembler does not fully support PIC. Currently, you must
use some other assembler in order for PIC to work. We would
welcome volunteers to upgrade GAS to handle this; the first part
of the job is to figure out what the assembler must do differently.
`-fPIC'
If supported for the target machine, emit position-independent
code, suitable for dynamic linking and avoiding any limit on the
size of the global offset table. This option makes a difference
on the m68k, m88k and the Sparc.
Position-independent code requires special support, and therefore
works only on certain machines.
--
Clark Dorman "Evolution is cleverer than you are."
http://cns-web.bu.edu/pub/dorman/D.html -Francis Crick
------------------------------
Date: Wed, 04 Jun 1997 13:27:39 +0200
From: Dani Macho Ortiz <dani@apb.es>
Subject: tr problems with variables
Message-Id: <3395512B.1462@apb.es>
Hello, Perl News group!
We are working under Solaris 2.5. Operating System
and programming some CGI for Web Pages with GNU Perl 5.3.
We've got a problem if we want to make a translation
of characters an if these ones are defined into variables:
$char1 = "x";
$char2 = "w";
$cad = "HelloxPerlxNewsx!";
$_ = $cad;
$changes = tr /$char1/$char2/;
print "CHANGES: $changes\n";
The previous code would print "CHANGES: 0"!!
Do you know why and how could we do what we intend to?
Thanks a lot.
--
-------------------------------------
(
( )
( )
/\ ( ) *
/ \| | * * *
/ \_|__ *
/ | *
| [ ] | *
| == |_______________________
|__| |____|
wwww wwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwww wwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwww wwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwww wwwwwwwwwwwwwwwwwwwwwwwww
Dani Macho Ortiz
Autoridad Portuaria de Barcelona
Email: <dani@apb.es>
http://www.apb.es
-----------------------------------
------------------------------
Date: Wed, 04 Jun 1997 08:55:15 -0400
From: Daniel Honig <liquid@izzy.net>
Subject: Re: uuidgen in perl?
Message-Id: <339565B3.35B8@izzy.net>
flint weiss wrote:
>
> is there some perl code out there that will generate UUID's?
>
> thanx in advance,
> flint weiss
Flint,
I could cook something up for ya if you don't find anything else....
I am the one who has adopted your machine here at Aetna....I could
probably take a minute and write a quick script for you...
Well anyways, I just thought it was interesting to catch your post on
USENET as you have left quite a reputation behind.....
Best Regards,
Daniel Honig
------------------------------
Date: Tue, 3 Jun 1997 21:13:48 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: why won't 'print <<end_print...end_print' work?
Message-Id: <EB7xn0.1yn@bcstec.ca.boeing.com>
In article <5n18ks$7n$1@fddinewz.oit.unc.edu>,
Will Sexton <sextw@ils.unc.edu> wrote:
> If I do the following:
>
> print <<"end_print";
> some text
> some text on the next line
> end_print
>
> my (multiple) sources tell me the program should print the text, without
> having to set the print command for each new line (said sources lacking
> further explanation). But when I try it, I get an error message ("Can't
> find string terminator "end_print" anywhere before EOF at <progname>
> line <line number>.") And can't find feature documented among usual
> suspects (camel, llama, etc.).
>
> Why won't it work?
This is a "here" document. See page 43 of the new Camel for
the "usual suspects" in "here" document failure, i.e,
any whitespace before or after the terminator.
HTH,
--
Charles DeRykus
ced@carios2.ca.boeing.com
------------------------------
Date: Wed, 04 Jun 1997 10:03:46 +0600
From: Will Sexton <sextw@ils.unc.edu>
Subject: Re: why won't 'print <<end_print...end_print' work?
Message-Id: <3394E922.2526@ils.unc.edu>
Will Sexton wrote:
>
> If I do the following:
>
> print <<"end_print";
> some text
> some text on the next line
> end_print
>
> my (multiple) sources tell me the program should print the text, without
> having to set the print command for each new line (said sources lacking
> further explanation). But when I try it, I get an error message...
I'd like to thank everyone for responding to my inquiry. I found the
answer (or at least, made it work) from another example I saw. The
second end_print must be flush left against the margin with no white
space, but none of the examples I had seen showed a semi-colon on the
next line down, also flush left. When I added that thus
end_print
;
it worked.
As for the quotation marks, that's no problem. If you enclose the first
EOF indicator in single- or double-quotes, perl treats the text up to
the closing EOF indicator as though it's enclosed in those quotes, with
all the usual implications for variable interpolation and escaping
special characters.
------------------------------
Date: Wed, 04 Jun 1997 15:30:49 +0200
From: -= BirzYa =- <BirdzYa@snakebite.com>
Subject: Win32::ODBC via NETSCAPE on NT
Message-Id: <33956E09.78AD0BE1@snakebite.com>
Well, yesterday i've written a stuff that works find
showing me that my ODBC connection works, my sql calls too.
But today this f@#$'5% soft says:
"Can't call method "Sql" without a package or object reference at
C:\InetPub\scripts\testodbc.pl line 8. <S:\perl\Ext\win32\odbc\ODBC.CPP"
dave give me script to show if i can my ODBC connecion works
and then it says:
"Could not connect to DSN. Error: [-1032] [] "[Microsoft][Pilote ODBC
Microsoft Access 97]"
u should say that's it , u can't connect ur database ...
hehe , when i use the command line with perl.exe , it works !!
damn thing !!!
The most impressive is that i change nothing in the script ...
when i put a # in front of my sql call , the error comes on fetchrow() (
the next line )
So is win32::ODBC still well configured ???:
here is my script:
************************************************************************************************************************************************
use Win32::ODBC;
push(@INC, "c:\inetpub\wwwroot\cgi-bin");
require("CGI-LIB.PL");
print "HTTP/1.0 200 OK\n";
print "Content-Type: text/html\n\n";
$db=new Win32::ODBC("profac");
$db->Sql("SELECT CONT_NOM FROM CONT ");
while ($db->FetchRow())
{
foreach $fd ($db->FieldNames())
{print qq(\n $fd: "), $db->Data($fd), qq("\n\n);
print "*********************************\n\n"
};
};
************************************************************************************************************************************************
The last error message is :
Could not connect to DSN. Error: [-1032] [] "[Microsoft][Pilote ODBC
Microsoft Access 97]
Le moteur de la base de donnies Microsoft Jet ne peut pas ouvrir le
fichier '(Inconnu)'. Il est dij` ouvert en mode exclusif par un autre
utilisateur, ou vous devez avoir l'autorisation de visualiser ses
donnies."
translation (ooh yeah !):
"Microsoft Jet databases' jet can't open the file 'unknown'
It's already open in exclusive mode by another user, or u must
have the rights to see its datas "
so what's hapenning ?? is there a bug inside ??
thanx ...
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 568
*************************************