[19516] in Perl-Users-Digest
Perl-Users Digest, Issue: 1711 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 7 14:10:34 2001
Date: Fri, 7 Sep 2001 11:10:11 -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: <999886210-v10-i1711@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 7 Sep 2001 Volume: 10 Number: 1711
Today's topics:
How do I use a / in a regular expression? <mmynsted@prodigy.net>
Re: How do I use a / in a regular expression? <Laocoon@eudoramail.com>
Re: How do I use a / in a regular expression? <mmynsted@prodigy.net>
Linking pages dynamically <edd@texscene.com>
Re: Linking pages dynamically (Chris Fedde)
my CGI don't want to terminate the execution... (lotfi)
Re: OT: Re: Recommendations for a PERL editor (Jonadab the Unsightly One)
Re: paginate search results with DBI (mbower)
Re: paginate search results with DBI <cpryce@pryce.net>
Re: PERL modules and GPL license <newspost@coppit.org>
Re: PERL modules and GPL license (Mark Jason Dominus)
Re: PERL modules and GPL license (Malcolm Dew-Jones)
Perl Version <demetros@vnet.ibm.com>
Re: Perl Version (Bernard El-Hagin)
Re: Perl Version (Rafael Garcia-Suarez)
Re: Problem with mail module <djberge@qwest.com>
Regexp substitution <filipe.henriques@novabase.pt>
Re: Regexp substitution (Rafael Garcia-Suarez)
Re: Regexp substitution (=?iso-8859-1?q?M=E5ns_Rullg=E5rd?=)
Shared Libraries (Smiley)
Re: Undef'ing multiple variables (Charles DeRykus)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 07 Sep 2001 16:41:11 GMT
From: Mark Mynsted <mmynsted@prodigy.net>
Subject: How do I use a / in a regular expression?
Message-Id: <m266avq7jv.fsf@mmynsted.corp.vha.com>
I want to remove all of the <font> and </font> type tags from many
files. Something like the following would work if possible...
perl -pi -e 's/\</?font.*?\>//ig' file
^
It will not because of the / char. The following also does not work.
perl -pi -e 's/\<\/?font.*?\>//ig' file
Any help would be great. This is my first attempt at any perl.
--
-MM
/"\
(No un-solicited email please.) \ / ASCII Ribbon Campaign
See following url, X Against HTML Mail
http://pages.prodigy.net/mmynsted/spamoff.htm / \
------------------------------
Date: Fri, 7 Sep 2001 18:47:49 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: How do I use a / in a regular expression?
Message-Id: <Xns9115C0970B637Laocooneudoramail@62.153.159.134>
You can use most of the non-alphanumeric characters as delimiters not only /
s"foo"camel"; #This is
s/foo/camel/; #the same
------------------------------
Date: Fri, 07 Sep 2001 16:57:14 GMT
From: Mark Mynsted <mmynsted@prodigy.net>
Subject: Re: How do I use a / in a regular expression?
Message-Id: <m21yljq6t4.fsf@mmynsted.corp.vha.com>
Laocoon <Laocoon@eudoramail.com> writes:
> You can use most of the non-alphanumeric characters as delimiters not only /
>
> s"foo"camel"; #This is
> s/foo/camel/; #the same
Great! Thank you.
The "s did not work for my re but !s did. Thanks again. :-)
--
-MM
/"\
(No un-solicited email please.) \ / ASCII Ribbon Campaign
See following url, X Against HTML Mail
http://pages.prodigy.net/mmynsted/spamoff.htm / \
------------------------------
Date: Fri, 7 Sep 2001 14:54:28 +0100
From: "Edd" <edd@texscene.com>
Subject: Linking pages dynamically
Message-Id: <3b98cfda@news-uk.onetel.net.uk>
How can you generate dynamic pages with more than one page linking with each
other. I have a list of items to list on my web site which runs to hundreds
so they should be listed in more than one page , each page having a
hyperlink conection displayed to the other pages.
I have been doing this by opening files and creating a file for each page
using PERL only. But now, I have to generate these dynamically. The list of
items are stored in a mysql data table.
I can list all the items on one dynamically generated page but not if I want
to put them on separate linked pages.
I thought of using forms with submit buttons for each page and each submit
button running another cgi program but, this can't be the right solution.
Edd.
------------------------------
Date: Fri, 07 Sep 2001 16:05:23 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Linking pages dynamically
Message-Id: <7f6m7.179$Owe.230868480@news.frii.net>
In article <3b98cfda@news-uk.onetel.net.uk>, Edd <edd@texscene.com> wrote:
>How can you generate dynamic pages with more than one page linking with each
>other. I have a list of items to list on my web site which runs to hundreds
>so they should be listed in more than one page , each page having a
>hyperlink conection displayed to the other pages.
>
>I have been doing this by opening files and creating a file for each page
>using PERL only. But now, I have to generate these dynamically. The list of
>items are stored in a mysql data table.
>
>I can list all the items on one dynamically generated page but not if I want
>to put them on separate linked pages.
>
>I thought of using forms with submit buttons for each page and each submit
>button running another cgi program but, this can't be the right solution.
>
This is an HTML authoring question and may be more appropriately answered
in a news group that has HTML or authoring in it's title.
But here is a hint that may be enough to get past your problem. The
href in an anchor tag can be a GET encoded URL that points to a CGI?
<a href="http://me.com/cgi-bin/page.pl?page=12"> page 12 </a>
Good luck!
--
This space intentionally left blank
------------------------------
Date: 7 Sep 2001 08:44:27 -0700
From: lotfixe@yahoo.fr (lotfi)
Subject: my CGI don't want to terminate the execution...
Message-Id: <c1f8a8d9.0109070744.4df45160@posting.google.com>
I have wrote a little CGI that search on a very big database, so my
CGI don't want to terminate the execution, and the browser showed me
that he can't download the result page
I think that this is because of the timing out of the server, or of
the browser, is this correct
please help me, I am lost since 3 weeks
lotfi
------------------------------
Date: Fri, 07 Sep 2001 14:46:51 GMT
From: jonadab@bright.net (Jonadab the Unsightly One)
Subject: Re: OT: Re: Recommendations for a PERL editor
Message-Id: <3b98dd67.85292245@news.bright.net>
tim@vegeta.ath.cx (Tim Hammerquist) wrote:
> > > Forget WINE.
> >
> > That's pretty much what I'm doing.
>
> Wine could only run two Win32 programs consistently (but not stably):
> Notepad and UltraEdit-32. Others seemed to rely too much on external
> DLLs that Wine apparently can't handle yet.
It's not *that* bad.
But it isn't really stable, either, and if I'm going to
accept instability I may as well use Windows.
- jonadab
------------------------------
Date: Fri, 07 Sep 2001 15:11:33 GMT
From: mbower@ibuk.bankgesellschaft.de (mbower)
Subject: Re: paginate search results with DBI
Message-Id: <3b98e36b.14402265@news>
>my $query = q[
> SELECT * FROM foo
> ORDER BY id
> LIMIT ?, ?
>];
>my $sth = $dbi->prepare( $query );
>$sth->execute( $start, $records_per_page );
which DB uses LIMIT ?
------------------------------
Date: Fri, 7 Sep 2001 12:08:16 -0500
From: "cp" <cpryce@pryce.net>
Subject: Re: paginate search results with DBI
Message-Id: <h77m7.20470$x84.5109288@ruti.visi.com>
"mbower" <mbower@ibuk.bankgesellschaft.de> wrote in message
news:3b98e36b.14402265@news...
> >my $query = q[
> > SELECT * FROM foo
> > ORDER BY id
> > LIMIT ?, ?
> >];
> >my $sth = $dbi->prepare( $query );
> >$sth->execute( $start, $records_per_page );
>
> which DB uses LIMIT ?
Both mSQL and MySQL support limit, as:
SELECT * FROM table LIMIT 10.
MySQL also supports:
SELECT * FROM table LIMIT 20, 10
to limit the selection the the 20 - 29th row.
DB2 and a couple of others support a
FETCH FIRST n ROWS ONLY
type of syntax.
------------------------------
Date: Fri, 07 Sep 2001 09:26:43 -0400
From: David Coppit <newspost@coppit.org>
Subject: Re: PERL modules and GPL license
Message-Id: <3B98CB13.9060704@coppit.org>
Mark Jason Dominus wrote:
> In article <30586a1d.0109060149.2fa2141a@posting.google.com>,
> Samppa <sami@xenetic.fi> wrote:
>
>>I am planning to use PERL modules which are publised under
>>GPL license. I am not changing the code of these modules just
>>using them.
>>
>>What is your opinion, how does these modules (under GPL)
>>affect to my code licensing and the availability
>>to my source code ?
>
> The GPL requires that your entire program be released under the terms
> of the GPL. The would mean that you are required to make the source
> code available.
>
> The modules may be available under an alterative license. (Perl
> modules are often available under the 'Artistic license'.)
>
> If a module is only available under the GPL, that means the author
> does not want to let you use it in non-free software. If you will not
> make your source code available, and you will not release your
> software under the GPL, then you may not use the module.
However, it may also mean that the author has rubber-stamped the GPL on
the software. I do this as a matter of course, but would be likely to
change the license to AL if asked. Don't give up on using a module
without asking the author about this first.
David
------------------------------
Date: Fri, 07 Sep 2001 14:43:19 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: PERL modules and GPL license
Message-Id: <3b98dd07.1cd1$1bb@news.op.net>
In article <3B98CB13.9060704@coppit.org>,
David Coppit <newspost@coppit.org> wrote:
>However, it may also mean that the author has rubber-stamped the GPL on
>the software. I do this as a matter of course, but would be likely to
>change the license to AL if asked. Don't give up on using a module
>without asking the author about this first.
Yes, because even if the author doesn't want to think about changing
the license that everyone else gets, the might be willing to give you
a one-time exemption. Especially if you offer to pay them.
All things are possible.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: 7 Sep 2001 08:11:48 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: PERL modules and GPL license
Message-Id: <3b98e3b4@news.victoria.tc.ca>
David Coppit (newspost@coppit.org) wrote:
: Mark Jason Dominus wrote:
: > In article <30586a1d.0109060149.2fa2141a@posting.google.com>,
: > Samppa <sami@xenetic.fi> wrote:
: >
: >>I am planning to use PERL modules which are publised under
: >>GPL license. I am not changing the code of these modules just
: >>using them.
: >>
: >>What is your opinion, how does these modules (under GPL)
: >>affect to my code licensing and the availability
: >>to my source code ?
: >
: > The GPL requires that your entire program be released under the terms
: > of the GPL. The would mean that you are required to make the source
: > code available.
: >
Not exactly. If you derive code from GPL code or link your code to GPL
code then that is true. (GPL-lib license allows dynamic linking, but I'll
ignore that for now as the module is probably not that GPL license, though
it would be a relevant issue if it were)
On the other hand, if you call a GPL program which is an independant unit
such as doing system("sort file") then the GPL on sort does not impact
your program.
But what if "sort" was actually a perl script and system() was part of a
perl program? It seems clear that the GPL still does not apply to your
code.
What if you had a shell script which ran a GPL shell script. Does
the GPL extend to the calling script (no (?)). What if the shell
script source'd the GPL'd script? (not so clear)
Since all perl modules are actually scripts which run when you use them,
at what point does running a perl script become "linking" in the code.
Note that loading a module is actually requesting perl to "run" it, and
the output of that run is a bunch of data structures that your program
uses, how is that different than running a program that creates a bunch of
data for your program to use?
Let's suppose the distributed program doesn't include the GPL module, and
could in theory use any module with the corrct interface. If it's the end
user that chooses to make a certain GPL module available to perl when they
run the program then does that mean the program is suddenly GPL'd as well?
...questions, not answers...
: > The modules may be available under an alterative license. (Perl
: > modules are often available under the 'Artistic license'.)
: >
: > If a module is only available under the GPL, that means the author
: > does not want to let you use it in non-free software. If you will not
: > make your source code available, and you will not release your
: > software under the GPL, then you may not use the module.
: However, it may also mean that the author has rubber-stamped the GPL on
: the software. I do this as a matter of course, but would be likely to
: change the license to AL if asked. Don't give up on using a module
: without asking the author about this first.
: David
--
Want to access the command line of your CGI account? Need to debug your
installed CGI scripts? Transfer and edit files right from your browser?
What you need is "ispy.cgi" - visit http://nisoftware.com/ispy.cgi
------------------------------
Date: Fri, 07 Sep 2001 09:29:37 -0400
From: "George C. Demetros" <demetros@vnet.ibm.com>
Subject: Perl Version
Message-Id: <3B98CBC1.F75FBDA5@vnet.ibm.com>
Hi.
Is there anyway to determine the version of perl without running the binary?
I know within a perl script you can look at the setting of $]. But I need to know
a fast way of determining this version without running perl. Is there any file
I can read that contains the version in it and is it dependably there across
versions?
Thanks.
------------------------------
Date: Fri, 7 Sep 2001 13:52:25 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Perl Version
Message-Id: <slrn9phjva.7re.bernard.el-hagin@gdndev32.lido-tech>
On Fri, 07 Sep 2001 09:29:37 -0400, George C. Demetros <demetros@vnet.ibm.com>
wrote:
>Hi.
>
>Is there anyway to determine the version of perl without running the binary?
>I know within a perl script you can look at the setting of $]. But I need to know
>a fast way of determining this version without running perl. Is there any file
>I can read that contains the version in it and is it dependably there across
>versions?
Yes, the README file in the distribution.
Cheers,
Bernard
--
perl -l54e's yyw q q tvmrx "h\ywx ersxliv zivp legoiv"qiy;y #a-zA-Z#d-gu-z#
chefghijklmnopqrstuvwxyzcJab-def-uPwxyzc;s j j s u u s t t s r r s
ppevalpereeteueje'
------------------------------
Date: 7 Sep 2001 14:05:47 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Perl Version
Message-Id: <slrn9phl25.jbp.rgarciasuarez@rafael.kazibao.net>
George C. Demetros wrote in comp.lang.perl.misc:
}
} Is there anyway to determine the version of perl without running the binary?
} I know within a perl script you can look at the setting of $].
Or $^V in recent perls.
} But I need to know
} a fast way of determining this version without running perl. Is there any file
} I can read that contains the version in it and is it dependably there across
} versions?
Depends on your installation, but perl may be also installed as a binary
"perl5.6.1" (for example, depends on your version). E.g. on my machine :
$ ls -i1 /usr/local/bin/perl*
202346 /usr/local/bin/perl
202346 /usr/local/bin/perl5.6.1
...
You'll notice that the inode numbers are equal. So you can look for
files matching 'perl*' with the same inode number as your perl binary
in the same directory. This is the fastest method I know but it's not
guaranteed to work everywhere.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Fri, 7 Sep 2001 08:27:49 -0500
From: "Mr. Sunblade" <djberge@qwest.com>
Subject: Re: Problem with mail module
Message-Id: <OS3m7.20$Wa4.60731@news.uswest.net>
<John@home.net> wrote in message news:3b9841bb.5077567@netnews.att.net...
> One thought, would there be an 'off-the-shelf' thing I could download
> and simply replace this part of the script with? Keep in mind, that
> all of this is because I am on an NT server and don't have sendmail.
> So any help would have to be related to this bit of script that sends
> via smtp this way.
Keep in mind that Sendmail and SMTP aren't the same thing. The former is a
program, the latter is a protocol. If your program depended on Sendmail I
don't think it would work at all (unless it's been ported to Win32 - I don't
know. I ain't no admin). Maybe you already know this, but I just wanted to
make sure.
As one of the other posters already mentioned, look at the Net::SMTP module
that comes with perl and/or any of the mail modules already out there on
CPAN.
from myself:
>Test your open (and close) for failure here.
>i.e. open MAIL, "|$config{'mailprog'}" or die "Unable to open mail
>handle:
>$!\n";
>close(MAIL) or die "Unable to close mail handle: $!\n";
Whenever you open a handle in Perl, you want to test for success. Why?
Because your program will go on its happy little way even if the 'open'
failed unless you tell it otherwise. For more on handles, see the Camel
book. Put it in there and see what happens.
For stuff that fails "sometimes", I highly recommend using a debugger. You
can use the command line debugger, though I much prefer the Perl/Tk
debugger. You can get it on CPAN. It's called 'Devel::ptkdb'.
Since you mentioned that you are a complete neophyte, go to your local
bookstore (or bestbookbuys.com if you can wait a few days) and immediately
order and read the following books:
1) Learning Perl, 3rd Edition (O'Reilly) - this will get you up and running
with Perl
2) Programming Perl - Ok, I don't expect you to read this cover to cover in
one sitting or anything, but you'll want it as a reference if nothing else
3) The Perl Cookbook - This book has many, many useful tips and tricks
Regards,
Mr. Sunblade
------------------------------
Date: Fri, 7 Sep 2001 17:01:28 +0100
From: "Filipe Henriques" <filipe.henriques@novabase.pt>
Subject: Regexp substitution
Message-Id: <tb6m7.58175$I_1.83383402@newsserver.ip.pt>
Hi everybody!
I need to make a Perl substitution of a letter (lets say "A") between two
numbers, into a zero:
<number1>A<number2> --> <number1>0<number2>
I've tried something like that:
$var =~ s/(\d)A(\d)/$10$2/g;
As you can see, that doesn't work because the compiler a see this as "$10"
and not as "$1" followed by "0".
I've already tried to put "$1\0", but "\0" is the null character, so it is
the same that "$1$2".
Any idea?
Thanks for the help.
Filipe
------------------------------
Date: 7 Sep 2001 16:06:43 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Regexp substitution
Message-Id: <slrn9phs4t.kbm.rgarciasuarez@rafael.kazibao.net>
Filipe Henriques wrote in comp.lang.perl.misc:
} $var =~ s/(\d)A(\d)/$10$2/g;
${1}
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 07 Sep 2001 18:04:41 +0200
From: mru@users.sf.net (=?iso-8859-1?q?M=E5ns_Rullg=E5rd?=)
Subject: Re: Regexp substitution
Message-Id: <yw1xd753vvfq.fsf@tatooine.e.kth.se>
"Filipe Henriques" <filipe.henriques@novabase.pt> writes:
> Hi everybody!
>
> I need to make a Perl substitution of a letter (lets say "A") between two
> numbers, into a zero:
> <number1>A<number2> --> <number1>0<number2>
>
> I've tried something like that:
> $var =~ s/(\d)A(\d)/$10$2/g;
>
> As you can see, that doesn't work because the compiler a see this as "$10"
> and not as "$1" followed by "0".
> I've already tried to put "$1\0", but "\0" is the null character, so it is
> the same that "$1$2".
>
> Any idea?
> Thanks for the help.
>
> Filipe
s/(\d)A(\d)/${1}0${2}/g;
--
Måns Rullgård
e99_mru@e.kth.se
------------------------------
Date: Fri, 07 Sep 2001 17:35:14 GMT
From: gurm@intrasof.com (Smiley)
Subject: Shared Libraries
Message-Id: <3b9903df.2678120@news1.on.sympatico.ca>
How do I compile Perl code into a shared library?
------------------------------
Date: Fri, 7 Sep 2001 14:46:21 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Undef'ing multiple variables
Message-Id: <GJArp9.n18@news.boeing.com>
In article <3b97cb0e@news.victoria.tc.ca>,
Malcolm Dew-Jones <yf110@vtn1.victoria.tc.ca> wrote:
>
> ...
>I liked Rafael Garcia-Suarez's suggestion best.
>
>Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
>> eval "undef $_" for qw/$s @a %h/;
>
>
>You could put it in a function if you like
>
> sub my_undef { eval "undef $_" foreach @_ }
>
>but you have to remember to call it with qw or such like
>
> my_undef(qw( $s @a %h )) ;
>
Perhaps slightly more efficient:
sub my_undef { my $eval;
$eval .= "undef $_;" for @_;
eval $eval; die $@ if $@;
}
(Assuming taint checking is a non-issue since unmentioned)
--
Charles DeRykus
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1711
***************************************