[7544] in Perl-Users-Digest
Perl-Users Digest, Issue: 1170 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 13 18:07:16 1997
Date: Mon, 13 Oct 97 15:00:23 -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 Mon, 13 Oct 1997 Volume: 8 Number: 1170
Today's topics:
Accessing Oracle DB using Perl - What do I need? (Matthew Rapaport)
Re: Accessing Oracle DB using Perl - What do I need? (Jeremy D. Zawodny)
Re: Can someone look at this and tell me why it doesn't (Bart Lateur)
Check if a URL existe ? With an independant code ? <ccadic@cadic.com.REMOVE.THIS.NOSPAM>
Re: Checking for a file <merlyn@stonehenge.com>
Re: choosing a recipent to send to via form. (Jeremy D. Zawodny)
Date to integer <ccadic@cadic.com.REMOVE.THIS.NOSPAM>
Re: Date to integer <browntr@engr.orst.edu>
Re: E-mail header and REGEXP <usenet-tag@qz.little-neck.ny.us>
ever stick a scalar into windows clipboard? <htaylor@nospam.mit.edu>
Re: fflush... <russ@mail.org.uk>
Re: help the new user <russ@mail.org.uk>
Re: howto: implement a mailing list? <shytov@MIT.EDU>
Re: Need help in searching a string (Bart Lateur)
Re: newbie: counting patterns (Faust Gertz)
online discussion script <hqe9838@is.nyu.edu>
Passing a filehandle as an argument? Gerben_Wierda@RnA.nl
Perl for Forms? <gregq@saol.com>
Re: Perl for Forms? (Faust Gertz)
Re: perl mailing list <merlyn@stonehenge.com>
Re: Protecting Perl source code against copyright...how <ccadic@cadic.com.REMOVE.THIS.NOSPAM>
Re: Replacing anything not matching with s/? (Bart Lateur)
Re: s/ / /g or tr/ / / what is the difference? (Faust Gertz)
Re: statics or const in perl ? (Jeremy D. Zawodny)
the first file in a folder... <bbrace@get.wired.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 Oct 1997 12:37:17 -0700
From: mjr@crl.crl.com (Matthew Rapaport)
Subject: Accessing Oracle DB using Perl - What do I need?
Message-Id: <61tt9d$j77@crl.crl.com>
Keywords: Oracle Perl SQL
I am looking for a way to access an Oracle 7.x DB using Perl. I have a
sample script that uses something called oraperl, but I'm wondering if
I can do this with my /usr/bin/perl 5.x implementation by acquiring some
include files and other such things. I'm hoping someone out there will
tell me what I need to get in order to do this. My application calls for
a connect to the DB, then various SQL-based extracts (selects), inserts,
and updates. If I *must* use oraperl, can someone tell me what exactly
it is and where to get it?
Thank you. Please email, or post answers here, I'll monitor...
--
matthew rapaport The difference between theory and practice KD6KVH
is that in theory there is no difference,
mjr@crl.com but in practice, there is. quine@dfw.net
------------------------------
Date: Mon, 13 Oct 1997 20:19:06 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Accessing Oracle DB using Perl - What do I need?
Message-Id: <34428222.9362652@igate.hst.moc.com>
[cc'd automagically to original author]
On 13 Oct 1997 12:37:17 -0700, mjr@crl.crl.com (Matthew Rapaport)
wrote:
>I am looking for a way to access an Oracle 7.x DB using Perl. I have a
>sample script that uses something called oraperl, but I'm wondering if
>I can do this with my /usr/bin/perl 5.x implementation by acquiring some
>include files and other such things. I'm hoping someone out there will
>tell me what I need to get in order to do this. My application calls for
>a connect to the DB, then various SQL-based extracts (selects), inserts,
>and updates. If I *must* use oraperl, can someone tell me what exactly
>it is and where to get it?
Ah ha. You seek the DBI::* modules on CPAN.
Go forth and program...
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Mon, 13 Oct 1997 21:14:46 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Can someone look at this and tell me why it doesn't work!!
Message-Id: <34488eb3.7909145@news.tornado.be>
ckc@dmi.min.dk (Casper K. Clausen) wrote:
>Ummm.... How about:
>
>if ($variable =~ /[\d\.]+/) {
> print "It's a number!";
>} else {
> print "It's a string!";
>};
Make that
/^[\d\.]+$/
but you should also check if there is at most one dot.
if ($variable=~/^[\d\.]+$/ and $variable=~tr/.//<=1) {
print "It's a number!\n";
}
HTH,
Bart.
------------------------------
Date: Mon, 13 Oct 1997 14:12:18 -0700
From: "Philippe CADIC" <ccadic@cadic.com.REMOVE.THIS.NOSPAM>
Subject: Check if a URL existe ? With an independant code ?
Message-Id: <01bcd81b$0f59ef00$0101a8c0@sexytop>
I'm trying to find a lonely code that is able to detect if a URL is ok.
I know LZW but I'm looking for an independant code.
Help .
------------------------------
Date: 13 Oct 1997 12:48:43 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: John Grimm <jgrimm@wireedm.com>
Subject: Re: Checking for a file
Message-Id: <8cen5pigv8.fsf@gadget.cscaper.com>
>>>>> "John" == John Grimm <jgrimm@wireedm.com> writes:
John> How can I check to see if a file is there or not?
Try to remove it with unlink. If the result is 0, it wasn't there.
If the result is 1, it's not there now.
:-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 322 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Mon, 13 Oct 1997 19:19:07 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: choosing a recipent to send to via form.
Message-Id: <344273ed.5725883@igate.hst.moc.com>
[cc'd automagically to original author]
On Mon, 13 Oct 1997 14:26:50 -0300, mattb <mattb@netrex.com> wrote:
>I am using perl with a form that sends out an email to managers of
>different department in my company. The user selects the department to
>be billed in the form. I want to take the users entry, from a pull down
>menu, which they use to select the department, I then want the perl
>script to reassign the $recipient, to be from the selection from that
>pull down menu.
I'd grab the CGI.pm module and use it's ability to easily access the
data which is posted to the web server when the user submits the form.
Or is your question more specific than that?
BTW, tell Jay Aho I said Hi. :-)
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Mon, 13 Oct 1997 14:04:24 -0700
From: "Philippe CADIC" <ccadic@cadic.com.REMOVE.THIS.NOSPAM>
Subject: Date to integer
Message-Id: <01bcd819$94abcb80$0101a8c0@sexytop>
I'm programming an AppZ under Linuxthat will handle dates.
The thing I would like to do is to is to convert the date to an integer.
Ex:
Mon Oct 13 22/58:13 MET DST 1997
would be converted into:
19971310
Has any one already programmed this & ?
Yours
------------------------------
Date: Mon, 13 Oct 1997 14:41:30 -0700
From: Tracy Hornschuch <browntr@engr.orst.edu>
Subject: Re: Date to integer
Message-Id: <Pine.SUN.3.96.971013143644.7177A-100000@flop.ENGR.ORST.EDU>
On Mon, 13 Oct 1997, Philippe CADIC wrote:
> I'm programming an AppZ under Linuxthat will handle dates.
> The thing I would like to do is to is to convert the date to an integer.
>
> Ex: Mon Oct 13 22/58:13 MET DST 1997
>
> would be converted into:
>
> 19971310
split your date:
($junk1, $mon, $dat, $junk2, $junk3, $junk4, $year) = split(' ', $today);
where $today contains the date string.
$mon s/b Oct
$dat s/b 13
$year s/b 1997
I do this daily for log reports...
But you will want to convert the month, so just write some if statements
testing for the month to determine the value of $mon....
Then,
$catDate = $year$dat$mon;
Tracy
browntr@engr.orst.edu | tracyh@teleport.COM
http://www.engr.orst.edu/~browntr/ | http://www.teleport.com/~tracyh/
I would like to find a man who wants | Have you told your children
to be married and a father for life. | you love them today?
"The only safe computer is a dead computer"
"Honesty is the best policy, but insanity is a better defense"
------------------------------
Date: 13 Oct 1997 19:41:04 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: E-mail header and REGEXP
Message-Id: <eli$9710131443@qz.little-neck.ny.us>
Keywords: REGEXP,mail,header
Posted and mailed.
In article <61qted$1dhb4$1@urano.inet.it>, Adm <hoo@wms.it> wrote:
> I'm trying to write a Web interface for a POP3 server to let users see and
> delete E-mail without have to buy/use/configure a mail program.
> Now I'm fighting whith the extreme diversity of the mail headers.
There is an underlying order they all should have, but I don't know
if mailers are good about following RFCs.
> The 'Date' line seems like:
> 1) Date: xxx, dd mmm yyyy ..................
> 2) Date: xxx, dd mmm yy .................
> 3) Date: dd mmm yyyy ..............
> 4) Date: dd mmm yy ................
> 'xxx' is the day:Mon,Tue..
> 'mmm' is the month:Oct,Dec....
> 'dd' is the day:1,2,3...
> 'yy' or 'yyyy' is the year:97 or 1997
/ # begin RE
^ # anchor to start of line
Date\s* # date header
\s* # spaces are allowed between field name and the
: # colon, even if they are very rare. "Be generous..."
\s* # spaces are common, but not required here
(?: # don't capture (#1)
(?: # don't capture (#2)
Sun # various days
|Mon
|Tue
|Wed
|Thu
|Fri
|Sat
) # end #2
,\s* # after the day, a comma and some spaces
) # end #1
? # #1 is optional
( # capture ($1)
\d+ # some digits
) # end $1
\s* # spaces
( # capture ($2)
Jan # various months
|Feb
|Mar
|Apr
|May
|Jun
|Jul
|Aug
|Sep
|Oct
|Nov
|Dec
) # end $2
\s* # spaces
( # capture ($3)
\d\d # two digits
|\d\d\d\d # or four digits
) # end $3
\b # force a word boundary
# end RE
/mix # /m -> make sure the ^ works in multiline strings
# /i -> headers are case insensitive, so we need be
# /x -> eXtended format
# Fix up things; if $3 is defined, so will be $1 and $2
if (defined($3)) {
$newdate = sprintf( "%02d %s %4d", # zero pad day of month, if needed
$1, # day of month
"\L\u$2", # month with caps fixed
($3 > 999) ? $3 # rest easy
: ($3 > 50) ? # guess 20th or 21st century
(1900 + $3) # ugly
: (2000 + $3) # ''
);
} else {
warn "Argh! Date couldn't be processed!\n";
}
HTH.
Elijah
------
of course, there almost certainly is a module for strptime :^)
------------------------------
Date: Mon, 13 Oct 1997 15:37:17 -0400
From: "Hank" <htaylor@nospam.mit.edu>
Subject: ever stick a scalar into windows clipboard?
Message-Id: <61tt8e$s1p@senator-bedfellow.MIT.EDU>
has anyone ever tried to stick a scalar ($foo) into the windows clipboard?
is this possible in perl? if you know how, please email me at
htaylor@mit.edu, i'd love to know.
thanks,
hank taylor
------------------------------
Date: Sat, 11 Oct 1997 20:30:36 +0100
From: Russell Odom <russ@mail.org.uk>
To: Chris Gerber <gerberc@cs.uregina.ca>
Subject: Re: fflush...
Message-Id: <343FD3DC.99F9F2AD@mail.org.uk>
Chris Gerber wrote:
>
> Hi, I was wondering if anyone knows a way to flush a file buffer from
> within perl.
In 'perldoc perlvar', look for '$|'.
HTH,
Russ
---------------------------------------------------------------------
--[ R u s s e l l O d o m ]---[ *NEW:* mailto:russ@mail.org.uk ]--
--[ University of York, UK ]---[ http://www.york.ac.uk/~rjo100/ ]--
---------------------------------------------------------------------
--[ FAQ maintainer, news:comp.os.ms-windows.win95.moderated ]--
---------------------------------------------------------------------
------------------------------
Date: Sat, 11 Oct 1997 20:29:01 +0100
From: Russell Odom <russ@mail.org.uk>
Subject: Re: help the new user
Message-Id: <343FD37D.388B35BE@mail.org.uk>
Kenneth Cheng wrote:
>
> I think my server is running Perl 4.0, since I have the following
> message from "perl -v".
> ---------------------------------
>
> This is perl, version 4.0
> [...]
> Can anyone tell me how to figure out what version of perl
> my server is running.
Ah, you have the version of perl which tells lies, it's really version
925.390 beta 79.
</sarcasm>
HTH,
Russ
PS Are you for real?
PPS Version 5 is the latest version
---------------------------------------------------------------------
--[ R u s s e l l O d o m ]---[ *NEW:* mailto:russ@mail.org.uk ]--
--[ University of York, UK ]---[ http://www.york.ac.uk/~rjo100/ ]--
---------------------------------------------------------------------
--[ FAQ maintainer, news:comp.os.ms-windows.win95.moderated ]--
---------------------------------------------------------------------
------------------------------
Date: Mon, 13 Oct 1997 15:43:31 -0400
From: Andrey V Shytov <shytov@MIT.EDU>
Subject: Re: howto: implement a mailing list?
Message-Id: <344279E3.167E@MIT.EDU>
Lam_Sai_Tung wrote:
>
> can u explain how .forward work? which program read the .forward file?
>
.forward works pretty simple. sendmail reads it and decides how
to deliver the message (man sendmail should help).
For example, this .forward delivers the message to one address
and also redirects it to program:
shytov@cmt10.mit.edu
|"/users/shytov/mymailer"
> besides,
> Is there other method to implement a mailing list? how?
Yes, see 'man sendmail', 'man newaliases' (may be 'man aliases ?')
(Hint: system-wide aliases database).
Sincerely,
Andrey.
------------------------------
Date: Mon, 13 Oct 1997 20:59:55 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Need help in searching a string
Message-Id: <3444869a.5836000@news.tornado.be>
masroor <masroor@bga.com> wrote:
>service:: catering
> food type: southwestern
> guests # : 123
> food type: american
> guests #: 200
> childrens #: 35
> food type : mexican
> guests #: 56
>service:: ticketing
> destination: Acapulco
> tourist #: 67
> type of transportation : Air
> destination : Bahamas
> tourists #: 90
> children #:20
>==========================================================
>
>Basically I can search for the string "service:: catering:, now once I
>find the search string, then I need to find the string "food type:". If
>you notice the string "food type:" is in relation to the 1st string search
>of "service:: catering". My question How do I tell the perl program to
>move the file pointer from the 1st string search.
What I do in such cases, is keep an identifier of the section, while
reading the following lines from the file. When you encounter the food
line, you can check if it's in the correct service record.
It's useful to be able to distinguish between section lines
("service::...") and subsection lines (" food:..."). Two clues: a
subsection starts with blanks (or a tab?), and a section has double
colons in it, instead of one for the subsection.
Now, let's exploit that.
while(<>) {
chomp;
if (/^\w/ {
($sectionkey, $sectionvalue)=split /:+\s*/;
} elsif (s/^\s+//) {
($subsectionkey, $subsectionvalue)=split /:\s*/;
#now, we have both a section and a subsection
if ($sectionkey eq 'service' and $sectionvalue
eq 'catering' and $subsectionkey eq 'food type') {
#got it!
local($\)="\n";
print $subsectionvalue;
}
} else {
#nothing really
}
}
HTH,
Bart.
------------------------------
Date: Mon, 13 Oct 1997 20:30:58 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: newbie: counting patterns
Message-Id: <34428034.2566260@news.wwa.com>
On 13 Oct 1997 15:49:04 GMT, batista@fas.harvard.edu (Sandra Batista)
wrote:
>hi, can anyone please tell me how to count the number of patterns on a
>line in a file? particularly, i am trying to count the number of tabs per
>line?
Well, you can try looking in the FAQ under 'How can I count the number
of occurrences of a substring within a string?'
(ftp://ftp.digital.com/pub/plan/perl/CPAN/doc/FAQs/FAQ/PerlFAQ.html#How_can_I_count_the_number_of_oc)
for good advice, or you can try the following bad advice. :-)
:my $string = "\tAnd in the end\t\n\tThe love you take\t\n\tIs equal to the love you make\t\n\t\t\n";
:my $pattern = "\t";
:my @array = split /$pattern/, $string;
:my $occurances = $#array;
:print "The number of occarances of the pattern in\n$string\nis $occurances.\n";
Can anyone see where this would fail? :-)
Streben nach Wahrheit
Faust Gertz
Philosopher at Large
------------------------------
Date: Mon, 13 Oct 1997 01:44:21 +0000
From: Howard Eisenberg <hqe9838@is.nyu.edu>
Subject: online discussion script
Message-Id: <34417CF5.3E3F@is.nyu.edu>
Looking for a script written to gather and process
input from online discussion through web browser. 3
processes involved. Take form input and print it to an
html file, say, the "detailed veiw." Take only certain
data from same form and print it to html file, say,
abbreviated view (which is actually a list of links to
all submitted messages.) Send html file to browser
regarding status of submision.
Looking to adapt anything written for an online
discussion forum like the one described above.
--
Howard M. Eisenberg
Master's Candidate
Educ. Comm. & Tech.
New York University
http://pages.nyu.edu/~hqe9838/
------------------------------
Date: Mon, 13 Oct 1997 19:48:29 GMT
From: Gerben_Wierda@RnA.nl
Subject: Passing a filehandle as an argument?
Message-Id: <EI09ot.6M2@RnA.NL>
When using strict refs I get:
Can't use string ("STDIN") as a symbol ref while "strict refs" in use at
./gord.pl line 69.
On that line it says:
while (<$::input>) {
Where $::input holds the value "STDIN" which was passed as an argument to the
function.
This works fine with no strict refs.
So, how do I do
&some_func( "STDIN");
&some_func( "SOME_OTHER_FH");
when using struct refs?
Thanks,
--
Gerben_Wierda@RnA.nl (Gerben Wierda)
"If you don't know where you're going, any road will take you there"
Paraphrased in Alice in Wonderland, originally from the Talmud.
Renee: "Met veel koper maakt men hoempa." (After hearing Brahms'
Festouverture)
------------------------------
Date: 13 Oct 1997 20:11:34 GMT
From: "DJ Ceiling Fan" <gregq@saol.com>
Subject: Perl for Forms?
Message-Id: <01bcd814$a5677e60$3c6219c4@horace>
Hi,
Could anyone give the source code for a form reader that puts it into email
format and then
sends it to a specified address.
How does one do a cgi-counter with a downloaded font?
Thanks
Greg
gregq@saol.com
------------------------------
Date: Mon, 13 Oct 1997 20:51:51 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Perl for Forms?
Message-Id: <3443887a.4682740@news.wwa.com>
On 13 Oct 1997 20:11:34 GMT, "DJ Ceiling Fan" <gregq@saol.com> wrote:
>Could anyone give the source code for a form reader that puts it into email
>format and then sends it to a specified address.
I didn't see the word 'perl' in your message, but I will use "the
principle of charity" and assume that you could not be asking a purely
CGI question in a perl newsgroup.
If you are new to perl? If so, I suggest learning perl before trying
to use perl to do CGI scripting. If you haven't already, I suggest
you purchase _Learning Perl_ by Randal Schwartz and Tom Christiansen.
There is plenty of information in the *last* chapter of the book on
the CGI.pm module. If you are looking for a less unix-centric book,
you can try Eric Johnson's _Cross-Platform Perl_, which also has a
*later* chapter on the CGI.pm module. If you have the money, perhaps
you should get both. :-) I did. If you are not new to perl and only
new to CGI scripting, you can ignore this fine advice.
A pretty secure script which uses Lincoln Stein's CGI modules and does
something similar to what you desire, is Robert Seymour's simple,
safe, and generic CGI back end mail script named 'rjsemail.cgi' at
ftp://uiarchive.uiuc.edu/pub/lang/perl/CPAN/scripts/infoserv/WWW/rjsemail.cgi
You should also look at the FAQ
(http://language.perl.com/faq/index.html), _CGI Programming
Techniques in Perl_
(http://www.eff.org/%7Eerict/Scripts/Book/Mis/appendix_a.html), Nick
Kew's 'CGI Programming FAQ'
(http://www.webthing.com/page.cgi/cgifaq), and 'CGI.pm - a Perl5 CGI
Library'
(http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html).
other CPAN modules which have already done the work for you
(http://www.perl.com/CPAN-local/CPAN.html), and Randal Schwartz's _Web
Techniques_ (http://www.stonehenge.com/merlyn/WebTechniques/) and
_Unix Review_ (http://www.stonehenge.com/merlyn/UnixReview/) articles.
>How does one do a cgi-counter with a downloaded font?
You don't need a counter. If you still want one, you can pay me a
hundred dollars an hour and I can research the subject for you. :-)
Streben nach Wahrheit
Faust Gertz
Philosopher at Large
"You cannot solve the problem with the same kind of thinking that has
created the problem." - Albert Einstein
------------------------------
Date: 13 Oct 1997 12:46:34 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: ericm@iol.ie (Eric Mosley)
Subject: Re: perl mailing list
Message-Id: <8chgaligyt.fsf@gadget.cscaper.com>
>>>>> "Eric" == Eric Mosley <ericm@iol.ie> writes:
Eric> Can someone forward me information on the most popular perl mailing list
Eric> and how to subscribe?
Uh, there's no mailing list with the worldwide distribution and
resposne of comp.lang.perl.misc. And since you're already here,
welcome aboard!
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 322 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Mon, 13 Oct 1997 14:10:58 -0700
From: "Philippe CADIC" <ccadic@cadic.com.REMOVE.THIS.NOSPAM>
Subject: Re: Protecting Perl source code against copyright...how?
Message-Id: <01bcd81a$e00c8f00$0101a8c0@sexytop>
Bob Freeman <freeman@exti.com> a icrit dans l'article
<343E5005.3506A20C@exti.com>...
> Does anyone know of a way to protect perl source code that is embedded
> in a software
> pruduct that one wishes to sell to someone else?
>
Prayers are the only ways.
It is impossible to protect your code from violation.
The best you can do is to place a copyright notice.
You can do something else: Make your perl hosted by your own CGI-BIN
directory and sell only access authorizatiopn to it.
Yours
------------------------------
Date: Mon, 13 Oct 1997 21:10:00 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Replacing anything not matching with s/?
Message-Id: <34478e04.7734373@news.tornado.be>
"Mattias Lvnnqvist" <mattias.lonnqvist@-NO-SPAM-.uidesign.se> wrote:
>I am trying to replace anything not matching a-z, A-Z, blank/space with
>nothing, eg
>getting a resulting string with only these chars.
tr/a-zA-Z //d;
HTH,
Bart.
------------------------------
Date: Mon, 13 Oct 1997 19:16:29 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: s/ / /g or tr/ / / what is the difference?
Message-Id: <34436d18.2100222@news.wwa.com>
On Mon, 13 Oct 1997 08:35:50 -0400, Bob Wilcox <bwilcox@shianet.org>
wrote:
>Could someone explain the difference between s/// and tr/// and when you
>use one or the other?
You will usually use s///. Times I might use tr/// would be to
remove certain types of white space from a string.
$value =~ tr/\015\012 //d;
or to take care of the problem folks sometimes have with wanting to
remove line breaks from a string, while keeping some white space.
(Actually this will also reduce the number of consecutive spaces in
the string to one too. Is probably isn't a solution most would use,
but it gives you an idea of the power of tr).
$value =~ tr/\015\012 / /s;
Otherwise, I use s/// for most substitutions.
$value=~ s/\n/<BR>/g;
Look at the manpages and at the FAQ for more examples and explanations
which will tell you about each function's return value, etc. . .
The following questions from the Data: Strings section of the FAQ
(ftp://ftp.digital.com/pub/plan/perl/CPAN/doc/FAQs/FAQ/PerlFAQ.html)
has examples of both s/// and tr///.
How do I unescape a string?
How do I remove consecutive pairs of characters?
How do I expand tabs in a string?
How can I access/change the first N letters of a string?
How can I count the number of occurrences of a substring within a
string?
How do I capitalize all the words on one line?
How do I strip blank space from the beginning/end of a string?
How can I expand variables in text strings?
HTH
Faust Gertz
Philosopher at Large
------------------------------
Date: Mon, 13 Oct 1997 19:21:10 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: statics or const in perl ?
Message-Id: <34437446.5814671@igate.hst.moc.com>
[cc'd automagically to original author]
On Mon, 13 Oct 1997 11:04:46 -0700, Saviz Artang - MPG ~
<sartang@pcocd2.intel.com> wrote:
>Is there a way to make a variable in perl a const. As in
>once it is set or when it is passed to a certain subroutine
>the variable can't be modified. I'm looking at something like
>this.
>
>@array = ( "a", "b" ) ;
>
>&mysub ( \@array ) ;
>
>sub mysub {
> my ( $arrayref ) = @_ ;
> @$array[0] = "z" ;
>}
>
>
>as you can see I can change the value of array[0] but how
>can i make it so arrayref is passed but read only and protected ?
>So I can't make changes to it.
>One way is ofcourse to copy it when passed but is there any
>command I can use to restrict changes to a variable ?
In general terms you can use references to create "constraints" in
perl. Something like the following:
*PI = \3.14159.
That method should be adaptable in your circumstance, but without
knowing the constraints you're working in, I'm hard pressed to say
that this is the way you *ought* do be doing it.
As you said, you can always copy the data. (Or just make your sub
smart enough not to mess with it. :-)
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Mon, 13 Oct 1997 12:07:18 -0700
From: { brad brace } <bbrace@get.wired.com>
To: macperl@iis.ee.ethz.ch
Subject: the first file in a folder...
Message-Id: <Pine.BSI.3.95.971013115318.8920e-100000@get.wired.com>
I'm trying to write a script that will:
1) every 12 hours: select the first file in a folder (Mac 68K OS
ideally)... I have Mac-Cron installed... and...
2) dialup my ISP and upload the file to several FTP sites (I have
Microphone-comm-software scripts that can dialup -- I can't seem to
make them select a specific file though...) (I have MacPerl installed.)
3) then, either delete or move this first file from the folder, so that
the next numerically-named file will become the next 'first-one'
4) and so on...
Any suggestions appreciated!!!
--
------------------------------
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 1170
**************************************