[13694] in Perl-Users-Digest
Perl-Users Digest, Issue: 1104 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 18 00:05:28 1999
Date: Sun, 17 Oct 1999 21:05:07 -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: <940219506-v9-i1104@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 17 Oct 1999 Volume: 9 Number: 1104
Today's topics:
Re: "Protecting" Perl source code (Craig Berry)
Re: *MY* answer... (Henry Penninkilampi)
Re: [Q] Object-Relational DBs in Perl (Postgres, Inform (Brett W. McCoy)
Re: Connecting SQL Server from Perl <allaires@mninter.net>
copying directories <louise@oe-pages.com>
file xfer via modem <alister2NOalSPAM@csc.co.nz.invalid>
Re: file xfer via modem (Abigail)
Re: file xfer via modem <alister2NOalSPAM@csc.co.nz.invalid>
Makefile.pl modification question info@cresthotel.bc.ca
Re: Makefile.pl modification question <info@cresthotel.bc.ca>
newbie - error on "my" variable. <r42317@email.sps.mot.com>
Re: newbie - error on "my" variable. <dtbaker_@busprod.com>
Re: newbie - error on "my" variable. <jeffp@crusoe.net>
Re: newbie - error on "my" variable. <jeff@vpservices.com>
Re: Perlscript/DBI/ASP Internal Error <Bucky@Kaufman.Net>
Re: Q: Sorting anonymous array (Randal L. Schwartz)
Q: Truncate string length? emlyn_a@my-deja.com
Re: Q: Truncate string length? (Michael Budash)
Re: Q: Truncate string length? <jeff@vpservices.com>
Re: THANKS FOR ALL THE HELP (Craig Berry)
Re: Uses of # (Abigail)
Re: Uses of # (Randal L. Schwartz)
Re: Uses of # (Damian Conway)
Re: Uses of # <uri@sysarch.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 18 Oct 1999 03:40:01 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: "Protecting" Perl source code
Message-Id: <s0l5kha0r0143@corp.supernews.com>
Jonathan Stowe (gellyfish@gellyfish.com) wrote:
: In comp.lang.perl.misc Craig Vincent <webmaster@webdream.com> wrote:
: >
: > the underworld webmaster market
:
: I get this picture of evil webmasters smacking their ho^H^Hprogrammers
: and sending them back out on the street ...
What, it's different where you work?
--
| 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: Mon, 18 Oct 1999 12:39:45 +0930
From: spamfree@metropolis.net.au (Henry Penninkilampi)
Subject: Re: *MY* answer...
Message-Id: <spamfree-1810991239460001@d7.metropolis.net.au>
In article <7udpdp$jsc$1@nnrp1.deja.com>, emlyn_a@my-deja.com wrote:
> I've encountered no other problems, although limiting the field length
> to 400 characters is something I'm working
Is there some sort of issue with 400 characters?
Henry.
------------------------------
Date: Mon, 18 Oct 1999 01:00:56 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: [Q] Object-Relational DBs in Perl (Postgres, Informix, etc.)
Message-Id: <slrn80ksii.91v.bmccoy@moebius.foiservices.com>
Also Sprach Jonathan Stowe <gellyfish@gellyfish.com>:
Uh, Pg.pm -- the PostgreSQL module -- certainly fits the bill. I think
DBI also supports PostgreSQL. Both are available via CPAN, and Pg.pm
comes with the PostgreSQL source distribution.
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: Sun, 17 Oct 1999 20:41:08 -0500
From: Scott Allaire <allaires@mninter.net>
Subject: Re: Connecting SQL Server from Perl
Message-Id: <380A7AB4.BF9CE433@mninter.net>
Make sure that your default database in SQL Server for the login you are using
is the database containing 'members'. SQL Server may be looking for the table
'members' in the 'master' database instead of your database.
Scott
Latha Sudharshan wrote:
> Hi,
>
> I do have the table named "members" in my database.
> I am not sure why it is not recognizing it. There is already
> a System DSN name set on my machine which I am using
> now. Do I have to create another DSN for my database for
> this specific application? I tried giving both sql and Sql in the
> query. But it didn't help. I have modified the script below but
> the output is the same. Any input is appreciated.
>
> Thanks,
> Latha
>
> ec wrote in message <3806E56E.FDEAA9DD@post3.tele.dk>...
> >Hi
> >The second qustion,: remember that this is case sensitive use sql instead
> of
> >SQL.
> >The first qustin indicates that there is no table named members
> >
> >mvh
> >EC
> >
> >Latha Sudharshan wrote:
>
> >> I am faced with the problem of inserting the HTMLform data into the SQL
> >> database. I am using MS ODBC SQLServer driver ( which is already
> installed
> >> on my Windows NT 4.0 machine ). I am using Microsoft SQL Server 6.5 and
> Perl
> >> version 5.005_03 built from ActiveState.com. I am trying to insert the
> data
> >> using CGI script with Perl on the server side. I even tried installing
> >> Win32::ODBC module. I guess I get the connection to the ODBC driver. I
> get
> >> the error as :
> >>
> >> C:\PERL>perl test.pl
> >> Connection number returned is:1
> >>
> >> Excecuting connection 1
> >> sql statement: "SELECT * FROM members"
> >>"208[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object
> >> name 'members'.10"
> >> --------------------
> >>
> >> I have a snippet of my perl script as:
> >>
> ***************************************************************************
> >> #!/perl
> >>
> >> use Win32::ODBC;
> >>
> >> $DSN = dsnname";
> >> if(!($db = new Win32::ODBC("dsn=$DSN;UID=****;PWD=****")))
> >> {
> >> print "Error connecting to $DSN since handle returned is:$db\n";
> >> print Win32::ODBC::Error();
> >> exit;
> >> }
> >> $connectnum = $db->Connection;
> >> print( "Connection number returned is:$connectnum\n" );
> >> print LOG qq(Current connection: "), $db->GetDSN, qq("\n);
> >> if( $db->Sql("SELECT * FROM members" ))
> >> {
> >> print( $db->Error() );
> >> $db->Close();
> >> exit(1);
> >> }
> >> $db->Close;
--
Scott Allaire
allaires@mninter.net
------------------------------
Date: Mon, 18 Oct 1999 04:02:59 GMT
From: "Louise O" <louise@oe-pages.com>
Subject: copying directories
Message-Id: <01bf191e$27f2cc80$491c1ad8@mpolmo>
What is the simplest way to copy one directory to another when the
destination
directory is a symbolic link? I tried rename.... of course that doesn't
work. File::Copy
appears to only copy files. I'm trying to avoid using system("cp dir1
dir2"). Doesn't
seem reliable.
------------------------------
Date: Sun, 17 Oct 1999 20:22:10 +1700
From: Aaron Lister <alister2NOalSPAM@csc.co.nz.invalid>
Subject: file xfer via modem
Message-Id: <11f733ec.d647037a@usw-ex0106-041.remarq.com>
I need to be able to transfer a file via a modem. I want this to be
automated. Does anyone know if a module exists that may allow me to do
this. If not, any suggestions?
Thanks
Aaron
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: 17 Oct 1999 22:42:22 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: file xfer via modem
Message-Id: <slrn80l5o7.q8s.abigail@alexandra.delanet.com>
Aaron Lister (alister2NOalSPAM@csc.co.nz.invalid) wrote on MMCCXXXVIII
September MCMXCIII in <URL:news:11f733ec.d647037a@usw-ex0106-041.remarq.com>:
`` I need to be able to transfer a file via a modem. I want this to be
`` automated. Does anyone know if a module exists that may allow me to do
`` this. If not, any suggestions?
That's what UUCP does, doesn't it?
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sun, 17 Oct 1999 20:36:14 +1700
From: Aaron Lister <alister2NOalSPAM@csc.co.nz.invalid>
Subject: Re: file xfer via modem
Message-Id: <0a0133f8.d9f2b558@usw-ex0106-041.remarq.com>
Sorry, I forgot to mention that this is on a Win32 system
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Mon, 18 Oct 1999 01:11:59 GMT
From: info@cresthotel.bc.ca
Subject: Makefile.pl modification question
Message-Id: <7uds4q$ljm$1@nnrp1.deja.com>
I'm trying to build and install a 3rd party Perl module but I don't
have rights to "make install" in the standard directories. I have my
own personal /lib folder that I want to install into. How do I modify
Makefile.pl to make this happen? Or do I modify the Makefile directly?
Your time is greatly appreciated.
Cheers!
Aaron Dalton
Crest Hotel
http://www.cresthotel.bc.ca
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 18 Oct 1999 03:00:06 GMT
From: The Crest Hotel <info@cresthotel.bc.ca>
Subject: Re: Makefile.pl modification question
Message-Id: <7ue2fi$paa$1@nnrp1.deja.com>
Sorry, I'm running on a UNIX platform, btw =)
In article <7uds4q$ljm$1@nnrp1.deja.com>,
info@cresthotel.bc.ca wrote:
> I'm trying to build and install a 3rd party Perl module but I don't
> have rights to "make install" in the standard directories. I have my
> own personal /lib folder that I want to install into. How do I modify
> Makefile.pl to make this happen? Or do I modify the Makefile directly?
> Your time is greatly appreciated.
>
> Cheers!
> Aaron Dalton
> Crest Hotel
> http://www.cresthotel.bc.ca
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
--
--
The Crest Hotel
http://www.cresthotel.bc.ca
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 18 Oct 1999 09:53:35 +0800
From: Noira Hadi <r42317@email.sps.mot.com>
Subject: newbie - error on "my" variable.
Message-Id: <380A7D9F.3C98DE46@email.sps.mot.com>
I was running a Perl script and encountered the message below. Need help
to know the cause.
"my" variable @data2 masks earlier declaration in same scope at ./test
line 58.
Regards,
hadi
------------------------------
Date: Sun, 17 Oct 1999 21:54:41 -0500
From: Dan Baker <dtbaker_@busprod.com>
Subject: Re: newbie - error on "my" variable.
Message-Id: <380A8BF1.FC5EBCFA@busprod.com>
Noira Hadi wrote:
>
> I was running a Perl script and encountered the message below. Need help
> to know the cause.
>
> "my" variable @data2 masks earlier declaration in same scope at ./test
> line 58.
----------
I would say that is one of the most clear error messages you will ever
get... somewhere prior to line 58 you have declared or used @data2. look
at your source!
Dan
------------------------------
Date: Sun, 17 Oct 1999 22:53:24 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: newbie - error on "my" variable.
Message-Id: <Pine.GSO.4.10.9910172251280.14462-100000@crusoe.crusoe.net>
[posted & mailed]
On Oct 18, Noira Hadi blah blah blah:
> "my" variable @data2 masks earlier declaration in same scope at ./test
> line 58.
This means you've done something not unlike this:
my @data2 = ("jeff", "pinyan");
# later on in the same scope
my @data2 = ("noira", "hadi");
You can't my() a variable and my() it again in the same level of scope.
--
MIDN 4/C PINYAN, USNR, NROTCURPI
jeff pinyan japhy@pobox.com
perl stuff japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN
------------------------------
Date: 18 Oct 1999 03:14:41 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: newbie - error on "my" variable.
Message-Id: <380A9081.8168768C@vpservices.com>
Noira Hadi wrote:
>
> I was running a Perl script and encountered the message below. Need help
> to know the cause.
>
> "my" variable @data2 masks earlier declaration in same scope at ./test
> line 58.
Fish: You have two differnt lines starting "my @data2" in your script
and Perl is warning you that it will only honor the second such
statement but wonders if maybe you put it in by mistake and meant to
only declare it once. You can *assign* @data2 as many times as you
want(@data2 =), but within a given scope (a part of your program), you
should only *declare* it (i.e. use the word "my" with it) once.
How to fish: If you add the line "use dianostics" as the 2nd line of
your script Perl will tell you what I just did instead of the one line
error message you got. "use diagnostics" takes up some resources so you
probably only want it while you are debugging your code, then take it
out of the script. Also, warning and error messages are almost all
explained with "perldoc perldiag" or by consulting the listing of
diagnostic messages in the back of the camel.
--
Jeff
------------------------------
Date: Sun, 17 Oct 1999 22:46:42 -0500
From: "Sanders Kaufman" <Bucky@Kaufman.Net>
Subject: Re: Perlscript/DBI/ASP Internal Error
Message-Id: <#pkvjxRG$GA.284@cppssbbsa02.microsoft.com>
On a similar note...
Do I need to use the same "use DBI;" and "use CGI;" even though thars
no PERL modules on my workstation. I don't wanna use ODBC cause my web
server don't use no ODBC.
My web server is running on a remote UNIX box somewhar. My workstation
is a Win98 workstation running ActiveState PERL and ASP.
Ben Anderson <ben.anderson@ventura-uk.com> wrote in message
news:7tv9r1$n0p$1@newsreader3.core.theplanet.net...
> I know it's not the answer you're looking for, but couldn't
> you use a system ODBC? Create a System DSN using the MS
> Oracle ODBC driver, then use ADO to connect.
>
> Ben
>
> Technical Services - UK Link <fx77@dial.pipex.com> wrote in message
> news:37FB593C.37A8C1F6@dial.pipex.com...
> > Greetings.
> >
> > I have installed the ActivePerl (www.activestate.com)
> > application on our IIS4 Server but seem to experience a very
> > curious problem with the Perl DBI module. I attempt to
> > access remote data from an Oracle 7.3 database (HP-UX) and
> > this does work, retrieving data via an SQL query.
> > However, this works only _ONCE_, i.e. the script displays
> > the resultset but when it is executed again, the entire
> > script is sent to the browser page with a message:
> >
> > ---
> > {...entire script is displayed here...}
> > error '80004005'
> >
> > Internal Error
> >
> > ?
> > ---
> >
> > When I reboot the server and try the page again, it seems to
> > work, _ONCE_ only before the errors begin to appear again.
> >
> > Would anybody be able to offer me some advice about how to
> > get around this problem?
> >
> > Cheers,
> > Mamood.
> >
> > P.S. The code is as follows:
> >
> >
> > <%@Language=PerlScript%><%
> >
> > use DBI;
> > use CGI qw(:standard :html3);
> > use CGI::Carp qw(fatalsToBrowser);
> >
> > my $cgi = new CGI('');
> >
> > $Response->write($cgi->start_html(-"title"=>"A",
> > -"bgcolor"=>"#ffffff",
> > -"link"=>"#0080ff",
> > -"vlink"=>"#0080ff"));
> >
> > my $host = "ABC";
> > my $sid = "DEF";
> >
> > #This works once-only!
> > my $dbh = DBI->connect( 'dbi:Oracle:',
> >
>
"auser/apass\@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$host)(PORT=1521))(C
> ONNECT_DATA=(SID=$sid)))");
> >
> > $Response->write("<table>");
> >
> > # Display all query field names.
> > while (@row_ary = $sth->fetchrow_array) {
> > $Response->write(Tr( map { td({-"bgcolor"=>"blue"}, $_)} @row_ary ));
> > }
> >
> > $Response->write("</table>");
> >
> > $sth->finish;
> > $dbh->disconnect;
> >
> > $Response->write($cgi->end_html);
> > %>
> >
> >
>
>
------------------------------
Date: 17 Oct 1999 18:47:54 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Q: Sorting anonymous array
Message-Id: <m1d7udwib9.fsf@halfdome.holdit.com>
>>>>> "Tony" == Tony B <tony@unheardmusic.com> writes:
Tony> I'm having trouble sorting a hash with an anonymous array. The following
Tony> hash is sorted by "ID" field:
Tony> %hash = (ID => 2, 5, 18, 27, 40],
Tony> Type => E, D, A, C, B],
Tony> Update => yes, yes, no, yes, no],
Tony> Name => Joe, Mary, Bob, Jane, Tim]);
Tony> But I want to sort by the "Type" field and have the other fields and array
Tony> items follow suit:
Tony> %hash = (ID => 18, 40, 27, 5, 2],
Tony> Type => A, B, C, D, E],
Tony> Update => no, no, yes, yes, yes],
Tony> Name => Bob, Tim, Jane, Mary, Joe]);
Tony> I've tried sorting it: @array = sort $mysort @{hash{$field}}
Tony> but that only sorts one array and the others remain the same. I also tried
Tony> @{hash{$field}} = sort $mysort @{hash{$field}}, which doesn't work at all.
Yeah, your data is kind of ... sideways ... to sort easily. Probably
the easiest way is to first figure out what order each list needs to
be remapped:
my @order = sort { $hash{Type}[$a] cmp $hash{Type}[$b] } 0..$#{$hash{Type}};
This generates the indicies from 0 to 4 of how an ordered Type array
would be. In this case, for the original data, that'd be (2, 4, 3, 1, 0).
Now we take this array and do an array slice for each of the hash's
elements and remap them:
my %newhash = map { $_ => [@{$hash{$_}}[@order]] } keys %hash;
That's essentially making:
$newhash{ID} = [ @{$hash{ID}}[@order] ];
$newhash{Type} = [ @{$hash{Type}}[@order] ];
$newhash{Update} = [ @{$hash{Update}}[@order] ];
$newhash{Name} = [ @{$hash{Name}}[@order] ];
without all the extra typing. Of course, Type will be sorted right,
but the others will merely be shuffled according to Type's new
ordering.
How's that for a little shuffle?
print "Just another Perl hacker,"
--
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: Mon, 18 Oct 1999 01:12:14 GMT
From: emlyn_a@my-deja.com
Subject: Q: Truncate string length?
Message-Id: <7uds59$ljn$1@nnrp1.deja.com>
I understand truncating files, but how does one truncate a string? To
limit the length of a field to, say, 500 characters?
I started with;
if (length($TheField) > 500){
length($TheField) = what goes here?
}
But length($TheField) just is a number like 538 - but what can I do with
that?
Do I need to count from 0 to 500 the number of characters in the string
and throw out the rest, or is there a way to just slice off anything
occurring past 500 without counting each one, like:
substr($TheField, 0, 500) don't know what goes next
Thanks in advance.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 17 Oct 1999 19:20:27 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Q: Truncate string length?
Message-Id: <mbudash-1710991920270001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>
In article <7uds59$ljn$1@nnrp1.deja.com>, emlyn_a@my-deja.com wrote:
>I understand truncating files, but how does one truncate a string? To
>limit the length of a field to, say, 500 characters?
>
>I started with;
>
>if (length($TheField) > 500){
>length($TheField) = what goes here?
>}
>
>But length($TheField) just is a number like 538 - but what can I do with
>that?
>
>Do I need to count from 0 to 500 the number of characters in the string
>and throw out the rest, or is there a way to just slice off anything
>occurring past 500 without counting each one, like:
>
>substr($TheField, 0, 500) don't know what goes next
>
how'd you get s close and not get it? don't you have The Book?
$TheField = substr($TheField, 0, 500);
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: 18 Oct 1999 02:51:09 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Q: Truncate string length?
Message-Id: <380A8AFA.6DA0FBD3@vpservices.com>
emlyn_a@my-deja.com wrote:
>
> I understand truncating files, but how does one truncate a string? To
> limit the length of a field to, say, 500 characters?
> ...
> substr($TheField, 0, 500) don't know what goes next
I'm not being sarcastic when I say I truly don't understand what part of
that you don't understand. You've got the syntax of substr correct and
you've figured out that susbstr is the function you need. Is it that
you don't understand what the substr function returns? If so, just
print it out and see.
print substr('abcdef',0,3);
Is it that you don't know how to get the returned value into a
variable? Just try experimenting with the assignment operator (=) and
see what happens.
my $the_field = 'abcdef';
$the_field = substr($the_field,0,3);
print $the_field;
For me, if I don't understand something with a complex or large example
I try to break it into a smaller piece and experiment with that. This
seems like something you ought to be able to experiment with on your own
rather than asking the newsgroup, but perhaps I still don't understand
what you are having trouble with.
--
Jeff
------------------------------
Date: Mon, 18 Oct 1999 03:41:26 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: THANKS FOR ALL THE HELP
Message-Id: <s0l5n6snr0186@corp.supernews.com>
kstephan (kstephan@my-deja.com) wrote:
: Reading through the threads, I noticed the line
:
: $thisyear = $year + 1900;
:
: What happens on 1 January 2000???
I don't know!!! My gosh, what *does* happen when you add 100 to 1900???
Or when you rtfm, for that matter???
--
| 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: 17 Oct 1999 20:15:52 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Uses of #
Message-Id: <slrn80kt5j.q8s.abigail@alexandra.delanet.com>
Larry Rosler (lr@hpl.hp.com) wrote on MMCCXXXVIII September MCMXCIII in
<URL:news:MPG.1273b3f39e61272598a0ab@nntp.hpl.hp.com>:
'' In article <slrn80j42e.q8s.abigail@alexandra.delanet.com> on 17 Oct 1999
'' 04:01:21 -0500, Abigail <abigail@delanet.com> says...
''
'' ...
''
'' > s#foo#bar;
''
'' !!!
Yeah! The replacement continues to the next # .... ;-)
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 17 Oct 1999 18:30:42 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Uses of #
Message-Id: <m1hfjpwj3x.fsf@halfdome.holdit.com>
>>>>> "Damian" == Damian Conway <damian@cs.monash.edu.au> writes:
Damian> Take a look at Text::Balanced -- in particular how the
Damian> extract_quotelike, extract_variable, and extract_codeblock
Damian> subroutines conspire to do a fair imitation of parsing
Damian> Perl. It would be trivial[*] to adapt these three to compress
Damian> Perl code by extracting comments and non-quoted multiple
Damian> whitespace.
Damian> [*] ...for sufficiently non-trivial values of "trivial"...
Even with your disclaimer, I think not.
As my repeatedly quoted example goes...
$n = time / 2 ; # / ; # first hash starts comment
$n = sin / 2 ; # / ; # second hash starts comment
You can't strip comments until you can recognize that time is proto ()
while sin is proto ($). And there are seven other characters like "/"
that have a "looking for term" vs "looking for operator" feature. And
here we go with the non-deterministic part:
use Faith;
$n = wazzat / 2 ; # / ; # what is wazzat prototyped as? :)
Yup. You gotta suck in everything that Faith.pm reads as well, thanks
to user prototypes. And then we get the odd case:
BEGIN { eval time % 2 ? 'sub wazzat ();' : 'sub wazzat ($);' }
$n = wazzat / 2 ; # / ; # what is wazzat prototyped as? :)
Yup. Non-deterministic parsing. :)
And while these are extreme examples, real life proggies get tripped
up by the same things.
Thus, only "perl" can parse "Perl" continues to be true.
I would write a verse
of haiku to show the point,
but I'm not that good. :-)
print "Just another Perl hacker,"
--
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: 18 Oct 1999 02:15:15 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Uses of #
Message-Id: <7udvrj$gn0$1@towncrier.cc.monash.edu.au>
merlyn@stonehenge.com (Randal L. Schwartz) writes:
>> Take a look at Text::Balanced -- in particular how the
>> extract_quotelike, extract_variable, and extract_codeblock
>> subroutines conspire to do a fair imitation of parsing
>> Perl. It would be trivial[*] to adapt these three to compress
>> Perl code by extracting comments and non-quoted multiple
>> whitespace.
>> [*] ...for sufficiently non-trivial values of "trivial"...
>Even with your disclaimer, I think not.
I think the "fair imitation of parsing Perl" weasel-words cover that ;-)
>As my repeatedly quoted example goes...
> $n = time / 2 ; # / ; # first hash starts comment
> $n = sin / 2 ; # / ; # second hash starts comment
No sweat. When I get a moment, I'll tweak Text::Balanced to check
prototypes (at least of built-in functions). There's also no reason
it couldn't self-adapt when it sees a prototyped sub in the code
it's parsing.
> use Faith;
> $n = wazzat / 2 ; # / ; # what is wazzat prototyped as? :)
>Yup. You gotta suck in everything that Faith.pm reads as well, thanks
>to user prototypes.
If Text::Balanced is honouring prototypes, it's not much harder to suck
in any modules and honour their prototypes too. Thank the gods for
CORE::prototype!
>And then we get the odd case:
> BEGIN { eval time % 2 ? 'sub wazzat ();' : 'sub wazzat ($);' }
> $n = wazzat / 2 ; # / ; # what is wazzat prototyped as? :)
>Yup. Non-deterministic parsing. :)
That's easily handled. If Text::Balanced detects a prototype
within a conditional within a BEGIN, it just unlinks the user's
root directory. ;-)
> I would write a verse
> of haiku to show the point,
> but I'm not that good. :-)
Hashes in my code --
leopard spots. Safe to parse them?
Only perl can say!
:-)
Damian
------------------------------
Date: 17 Oct 1999 23:04:59 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Uses of #
Message-Id: <x7so39fjxg.fsf@home.sysarch.com>
>>>>> "DC" == Damian Conway <damian@cs.monash.edu.au> writes:
>> And then we get the odd case:
>> BEGIN { eval time % 2 ? 'sub wazzat ();' : 'sub wazzat ($);' }
>> $n = wazzat / 2 ; # / ; # what is wazzat prototyped as? :)
>> Yup. Non-deterministic parsing. :)
DC> That's easily handled. If Text::Balanced detects a prototype
DC> within a conditional within a BEGIN, it just unlinks the user's
DC> root directory. ;-)
damian, you really need to see a witch doctor and have your head shrunk!
:-)
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
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 1104
**************************************