[15631] in Perl-Users-Digest
Perl-Users Digest, Issue: 3044 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 14 21:05:26 2000
Date: Sun, 14 May 2000 18:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <958352709-v9-i3044@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 14 May 2000 Volume: 9 Number: 3044
Today's topics:
Access from several Perl-Scripts on one variable? <thorsten_kuske@gmx.net>
Re: alarm problem <gellyfish@gellyfish.com>
Re: counter <edbubbleluk@hotmail.com>
Re: counter (Abigail)
Defining charset in cgi script <trexxa@gireve.com>
Defining charset in cgi script <trexxa@gireve.com>
Defining charset in cgi script <trexxa@gireve.com>
Re: Directory Help in perl <jc@juliancardarelli.com>
Re: Directory Help in perl (Lon Stowell)
Re: extracting mails <gellyfish@gellyfish.com>
Re: Files in subdirectories <gellyfish@gellyfish.com>
Re: Help with Perl/CGI scripts <gellyfish@gellyfish.com>
Re: How to COPY a website <Callus@Sympatico.ca>
Re: How to COPY a website <bob@oblong.take_it_out.com.au>
Re: How to COPY a website (Randal L. Schwartz)
interface with NetLedger XML interface toddboyle@my-deja.com
Re: Is this new language possible in perl? (Craig Berry)
Re: Please Help friend on perl problem <gellyfish@gellyfish.com>
Re: Regular Expressions help <peterm@zeta.org.au>
Re: Silencing module warnings. <anmcguire@ce.mediaone.net>
Specify a path in the use <cyrilh@iname.com>
Re: Specify a path in the use <jeff@vpservices.com>
Re: Specify a path in the use (Clinton A. Pierce)
Re: spoofing identity <gellyfish@gellyfish.com>
Re: strings and limits (Tad McClellan)
Re: strings and limits (Tad McClellan)
Re: tar in Perl, system or not <xah@xahlee.org>
Re: tar in Perl, system or not <tony_curtis32@yahoo.com>
Re: Telnet Server in Perl <gellyfish@gellyfish.com>
Re: the Test, to write to conference <gellyfish@gellyfish.com>
Re: This error catching code should work right? <Luc-Etienne.Brachotte@wanadoo.fr>
Re: using an array from the disk (Tad McClellan)
Re: where can i find perl? <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 May 2000 17:16:09 -0500
From: "Thorsten" <thorsten_kuske@gmx.net>
Subject: Access from several Perl-Scripts on one variable?
Message-Id: <01be9e56$a0d767c0$c9bb06d5@unbekanb>
Is it possible to access from several Perl-Scripts on one variable?
I would be really glad if you could answer me that question and how to do
so, because this would mean to me to save several hours of work.
Thank you very much!
------------------------------
Date: 14 May 2000 11:37:39 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: alarm problem
Message-Id: <8flvlj$su9$1@orpheus.gellyfish.com>
On Sat, 13 May 2000 20:18:29 +0100 beaumontsystems wrote:
> I am having a problem using alarm().
> When I have the line...
> alarm(0);
> ... I get the error message...
> "The Unsupported function alarm function is unimplemented at line xxx".
> I cant figure out what this means. Ive looked at perldoc -f alarm.
> Any ideas/suggestions ?
Look in the perldiag and perlport manpages. Though IMO there is nothing
hidden in that message - it means just what it says.
/J\
--
It's like something out of that twilighty show about that zone.
--
fortune oscar homer
------------------------------
Date: Sun, 14 May 2000 19:11:04 -0400
From: "Ed" <edbubbleluk@hotmail.com>
Subject: Re: counter
Message-Id: <8fnbjd$ps7$1@slb7.atl.mindspring.net>
I have tried writing a counter.pl which starts out with the script you wrote
#!/usr/bin/perl
use CGI;
$query = new CGI;
$usr_addr = $ENV{'REMOTE_USER'};
$counterdata = 'counter.data';
$users = 'counter.visitors';
etc
etc
etc
and I can never get it to work. I always get premature end of script errors
I get other scripts to work like formmail scripts and searches, but they
dont have this
use CGI;
$query = new CGI;
Does my web hosting have to support something that allows me to do this
use CGI; command?
Thanks
ED
Andy Chantrill <andy@u2me3.com> wrote in message
news:8fkel0$2uo$1@plutonium.btinternet.com...
> Try http://www.cgi-resources.com
>
>
------------------------------
Date: 14 May 2000 23:16:45 GMT
From: abigail@foad.org (Abigail)
Subject: Re: counter
Message-Id: <slrn8hucut.3j5.abigail@ucan.foad.org>
On Sun, 14 May 2000 19:11:04 -0400, Ed <edbubbleluk@hotmail.com> wrote:
++
++ #!/usr/bin/perl
++
++ use CGI;
++ $query = new CGI;
++
++ $usr_addr = $ENV{'REMOTE_USER'};
++ $counterdata = 'counter.data';
++ $users = 'counter.visitors';
++
++ etc
++ etc
++ etc
++
++ and I can never get it to work.
That's because you don't have semicolons after etc.
Abigail
------------------------------
Date: Sun, 14 May 2000 22:22:55 GMT
From: "Jimmy E." <trexxa@gireve.com>
Subject: Defining charset in cgi script
Message-Id: <3HFT4.61295$so1.741219@news20.bellglobal.com>
Hello,
I would like to know how can I define a charset in a .cgi script file.
My regular html pages contain the following line in order to use the Greek
Character set:
<meta http-equiv="Content-Type" content="text/html; charset=windows-1253">
How do I translate this line in order to be inserted in a .cgi scept file.
If I'll insert it as-is, I get an error.
I use some Greek text as output on my cgi, and 1253 charset must be used in
order for the characters to be displayed properly.
Thanks in advance.
------------------------------
Date: Sun, 14 May 2000 22:23:52 GMT
From: "Jimmy E." <trexxa@gireve.com>
Subject: Defining charset in cgi script
Message-Id: <YHFT4.61302$so1.695788@news20.bellglobal.com>
Hello,
I would like to know how can I define a charset in a .cgi script file.
My regular html pages contain the following line in order to use the Greek
Character set:
<meta http-equiv="Content-Type" content="text/html; charset=windows-1253">
How do I translate this line in order to be inserted in a .cgi scept file.
If I'll insert it as-is, I get an error.
I use some Greek text as output on my cgi, and 1253 charset must be used in
order for the characters to be displayed properly.
Thanks in advance.
------------------------------
Date: Sun, 14 May 2000 22:25:57 GMT
From: "Jimmy E." <trexxa@gireve.com>
Subject: Defining charset in cgi script
Message-Id: <VJFT4.61318$so1.741297@news20.bellglobal.com>
Hello,
I would like to know how can I define a charset in a .cgi script file.
My regular html pages contain the following line in order to use the Greek
Character set:
<meta http-equiv="Content-Type" content="text/html; charset=windows-1253">
How do I translate this line in order to be inserted in a .cgi scept file.
If I'll insert it as-is, I get an error.
I use some Greek text as output on my cgi, and 1253 charset must be used in
order for the characters to be displayed properly.
Thanks in advance.
------------------------------
Date: Sun, 14 May 2000 22:29:46 GMT
From: "Julian L. Cardarelli" <jc@juliancardarelli.com>
Subject: Re: Directory Help in perl
Message-Id: <uNFT4.5360$f12.125938@news1.rdc1.on.wave.home.com>
Use this code:
----------------------------------------------------------------------------
----
#!/usr/bin/perl
use strict;
my @files;
my $dir = ".";
opendir DIR, "$dir";
map { push @files, $_ if (-f "$dir/$_") } readdir(DIR);
print join("\n", @files);
---------------------------------------------------------------------------
The code will push filenames onto @files if the file test operator (-f)
returns true. Remove the print and fool around with it a bit to fit your own
needs.
= Julian
CoDoGG wrote in message <391CC441.20BF33FC@HoMe.CoM>...
>Could some please help me..
>I am writing a perl CGI program, and I want to find a file in the
>directory.
>
>Is there a easy way that I could generate a list or a array of filenames
>of a certain directory to easily loop through and compare.
>
>Thanks alot,
>Co-DoGG
>
------------------------------
Date: 14 May 2000 18:00:33 -0700
From: lstowell@triton.dnai.com (Lon Stowell)
Subject: Re: Directory Help in perl
Message-Id: <8fni7h$c3p$1@triton.dnai.com>
In article <uNFT4.5360$f12.125938@news1.rdc1.on.wave.home.com>,
Julian L. Cardarelli <jc@juliancardarelli.com> wrote:
>Use this code:
>
>----------------------------------------------------------------------------
>----
>
>#!/usr/bin/perl
>
>use strict;
>
>my @files;
>my $dir = ".";
>
>opendir DIR, "$dir";
>map { push @files, $_ if (-f "$dir/$_") } readdir(DIR);
>print join("\n", @files);
>
>---------------------------------------------------------------------------
>
>The code will push filenames onto @files if the file test operator (-f)
>returns true. Remove the print and fool around with it a bit to fit your own
>needs.
Is there any limit to the number of file names this would
handle? Have PERL 4, 5, and even 5.6 available on solaris.
I need to run through a huge directory and construct a list
of filenames to be used as arguments to another function.
Roughly 32K files...which so far has overflowed.
Not quite ready yet to simply bust it up into 10k chunks,
seems the cowards way out.
------------------------------
Date: 14 May 2000 12:07:58 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: extracting mails
Message-Id: <8fm1ee$338$1@orpheus.gellyfish.com>
On Sat, 13 May 2000 13:40:21 +0200 Jens Luedicke wrote:
> hi there ...
>
> How can I extract all mails from an mbox mail-folder into single files ?
>
> Let's say that I have ten mails in my folder at /var/spool/mail/me
> and I want to dump each mail into an own file somewhere in my homedir.
> How can I do that?
I would start with Mail::Util which is part of the Mail-tools package
available from CPAN.
/J\
--
When you participate in sporting events, it's not wether you win or
lose. It's how drunk you get.
--
fortune oscar homer
------------------------------
Date: 14 May 2000 11:35:16 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Files in subdirectories
Message-Id: <8flvh4$sf8$1@orpheus.gellyfish.com>
On Sun, 14 May 2000 05:18:26 GMT chris2037@my-deja.com wrote:
> I have the following code which will list the files in a given
> directory:
>
>
> #!/usr/local/bin/perl
>
> $namev = "dir1";
> $curdir = "/public/staff/usern";
>
>
> opendir DH, "$curdir/$namev" or die "Can't open: $!";
>
> while ($namev = readdir(DH)) {
> print "$namev\n";
>
> }
> closedir(DH);
>
>
> dir1 could have subdirectories which in turn can have subdirectories...
>
> I have looked at perlfunc and perldoc, neither goes into this. Can
> anyone help? Thanks.
>
Yes. Use File::Find. If you really *must* do it with readdir() then you
might search on Deja News as examples have been posted - some better and
some worse. But I would still suggest using File::Find .
/J\
--
I can't believe it! Reading and writing actually paid off!
--
fortune oscar homer
------------------------------
Date: 14 May 2000 12:14:47 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help with Perl/CGI scripts
Message-Id: <8fm1r7$4df$1@orpheus.gellyfish.com>
On Sat, 13 May 2000 21:48:03 GMT malverian@hotmail.com wrote:
>
>> Where can I find a Perl or CGI guestbook script (win98 platform) for
>> my angelfire.com homepage? I have tried atleast 20 different kinds
>> of scripts, but they don't seem to work!!!! I finally figured out
>> that its because of my platform. I would greatly appreciate all of
>> your help.
>
>
> Okay, I will give you a few pointers.
> a) It doesn't matter what platform you are using on your personal
> computer since the CGIs will be hosted by your web server. (Which would
> be Angelfire)
> b) Make sure you are uploading in ASCII and -not- Binary.
>
> If you still have problems post a reply to this, I'll try and help you
> out.
>
Probably better to post to comp.infosystems.www.authoring.cgi as I dont
think there are any Perl language issues here.
/J\
--
Unlike most of you, I am not a nut.
--
fortune oscar homer
------------------------------
Date: Sun, 14 May 2000 22:29:26 GMT
From: Tony Reed <Callus@Sympatico.ca>
Subject: Re: How to COPY a website
Message-Id: <140520001829184669%Callus@Sympatico.ca>
In article <CkFT4.5349$f12.123160@news1.rdc1.on.wave.home.com>, "Keith
Smith" <ksmith@firesnacks.com> wrote:
: Hi folks:
:
: Are there any good scripts out there for retrieving all the files found at a
: website? Essentially, I would like to point this tool at a URL and have it
: decend all the local links and retrieve all the content associated with
: static html links.
Although this isn't the place, and although I don't use IE, I should
say that Internet Explorer has this kind of thing built into it. When
you do a "save as" it will let you save the whole site as a compressed
archive, and you can specify how may layers down you want to go, and if
you want to save "off-site" links. I thought at the time, "geez, I
wish Netscape did this."
--
Tony Reed <mailto:callus@sympatico.ca>
Open the door softly, somebody wants you dear! You'll hear him calling you,
bump, like a blizz in the muezzin of the turkest night.
------------------------------
Date: Mon, 15 May 2000 09:01:10 +1000
From: "Bob Long" <bob@oblong.take_it_out.com.au>
Subject: Re: How to COPY a website
Message-Id: <391f3038$0$31502@news01.syd.optusnet.com.au>
Teleport Pro from www.tenmax.com .
Bob Long
www.oblong.com.au
---
"Keith Smith" <ksmith@firesnacks.com> wrote in message
news:CkFT4.5349$f12.123160@news1.rdc1.on.wave.home.com...
> Hi folks:
>
> Are there any good scripts out there for retrieving all the files found at
a
> website? Essentially, I would like to point this tool at a URL and have
it
> decend all the local links and retrieve all the content associated with
> static html links.
>
> Thoughts/coments?
> Keith
>
>
------------------------------
Date: 14 May 2000 16:32:26 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: How to COPY a website
Message-Id: <m1aehsr9md.fsf@halfdome.holdit.com>
>>>>> "Bob" == Bob Long <bob@oblong.take_it_out.com.au> writes:
Bob> Teleport Pro from www.tenmax.com .
Which is blocked on my website because it has been shown not to
respect robots.txt. Evil Product. Do not buy. Do not promote.
--
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, 15 May 2000 00:51:59 GMT
From: toddboyle@my-deja.com
Subject: interface with NetLedger XML interface
Message-Id: <8fnhnb$ldi$1@nnrp1.deja.com>
NetLedger.com is an accounting system that runs over the internet.
Basically they provide a quickbooks type of experience on a browser,
plus you can send/receive payments, invoices, orders, that kind of
thing.
Maybe some of you developers will find this useful as a back end
to what you're doing. Don't flame me. I don't work there.
NetLedger is releasing a whole new set of XML schemas for A2A
application to application) integration and ecommerce, over the
internet. It is called smbXML, XML for small /midsized Businesses.
This is a reasonably complete set of schemas for interfacing between
the modules of low-end accounting and business systems.
This includes the usual purchase order, invoice, bill payment, etc.
(simpler than Ariba cXML, Commerce One xCBL, BASDA, etc) but also has
many more including the general journal, as well as methods to invoke
all kinds of edits and updates on lists and transactions. wheee! For
example,
<!-- Create Journal Entry. Basic General Journal Entry
NOTE: All Journal Entries must balance. -->
<Add req_id="T22" external_id="JE9912-54">
<JournalEntry date="12/31/1999" tran_id="1001">
<JournalItem account="6352 Payroll:Fees" entry_type="debit"
amount="18.50"
memo="12/31 P/R" line_num="1"/>
<JournalItem account="6354 Payroll:Salary/Wages" entry_type="debit"
amount="648.00"
memo="12/31 P/R" line_num="2"/>
<JournalItem account="6356 Payroll:Taxes" entry_type="debit"
amount="80.70"
memo="12/31 P/R" line_num="3"/>
<JournalItem account="1000 Checking--Central Internet Bank"
entry_type="credit"
amount="747.20" memo="12/31 P/R" line_num="4"/>
</JournalEntry>
</Add>
You're not gonna believe this, but NetLedger has actually built these
XML interfaces. (Their service costs $5/month) These new interfaces
will allow users to send and receive every kind of transaction that
exists in their accounting system to/from the server. I have been
predicting that they would be the first webledger with open
interfaces. (I dont work for NetLedger. I am a CPA and consult
in the accounting/xml space.)
They say they're going to stream these XML over HTTP or middleware
with their partners *and users*. In other words you will be able to
click into an upload or download screen and send an unlimited number
of rows of transactions in a single transmission.
There isn't any other General Ledger or general accounting provider
besides NetLedger that has anything resembling this open XML
interface, not for $5/month or $500/month, that I can see.
This is priceless, for all of the internet BSP (business service
provider) who doesn't have a complete integrated solution. It enables
any collection of BSPs to form up and integrate with each other and
with a General Ledger back end. (Here are some BSPs/dotcoms:
http://www.gldialtone.com/links.htm#bsps and
http://www.gldialtone.com/webledger.htm)
Perl developers, Foxpro, VB, delphi etc will find the webledger
architecture quite compelling once you take a look at it. I've been
reporting on this for several years an maintain an info website on
webledger http://www.gldialtone.com What this lets you do is
compete right along side the biggest vendors on earth, with your own
little peashooter application simply by creating it as a module of the
webledger. If you think commercial webledgers are too expensive you
can build your own around SMBXML. Draw you a picture.
Let's say your VB program generates sales of some kind. If you push
Accounts Receivable up to the webledger, they can be billed and
collected electronically, and maintained in an integrated ledger with
the rest of the company's receivables and sales. this is a level
playing field folks. You can query the Webledger for customer list.
You have a customer and vendor list in the sky. Or, you can maintain
the master customer list and make NetLedger the slave. It's all up
to you, and the platform vendor isn't going to break your software, or
pull some lock-in trick.
Device people, WAP developers, cash register vendors, are going to
have a field day with this. You can shoot XML transactions all day
long or upload them in a batch at end of day.
Small business users will be able to choose best of breed providers
for their particular needs, for billing, payroll, web storefront,
timesheet, and fifty other things--- and NetLedger will be willing to
maintain your general ledger. When you conduct business on the other
website it will be submitted to your accounting system for review and
posting. You can potentially avoid most duplication of work.
This is also of immediate importance to every user who has been
worried about getting their data *into* NetLedger, or *out* of
NetLedger for backup, or in case they change to a different platform.
You can literally download every bit of data, using the worlds most
open and portable data language, XML.
This is gonna be huge. Look at their release at http://www.smbxml.org
It was up there for awhile Friday anyway. Its gone right now but I
guess it will be back online. Here are the counts:
114 occurrences of <!ENTITY %
78 occurrences of <!ELEMENT --these define the documents, and
and various requests.
73 occurrences of <!ATTLIST -- you can see most elements hav attribs.
116 #REQUIRED attributes --attributes contain all the parameters etc.
279 #IMPLIED attributes inside the documents, records etc.
It looks like they're going to contribute the schemas to the typical
'org' to include third party vendors, and make it into an open
standard. The license text already basically says the whole wide world
can use the schemas. Wow... good work guys!
This is the beginning of the end, of the age of lock-in and standalone
desktop accounting systems and good riddance,
TOdd
* Todd F. Boyle CPA http://www.GLDialtone.com/
* tboyle@rosehill.net Kirkland WA (425) 827-3107
* XML accounting, WebLedgers, ASPs, GL dialtone, whatever it takes
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 15 May 2000 00:40:34 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Is this new language possible in perl?
Message-Id: <shuhs2jvje475@corp.supernews.com>
pohanl@my-deja.com wrote:
: function query (my own term) means you can ask a component what
: functions/methods it supports.
Usually called 'introspection'.
: This new language would have components with no constraints on values
: passed to it.
: as for the values, instead of being dedicated to a method in a
: component/class/function, it would be placed on a bloodstream/"bus".
: cells/components would grab it when they have appropriate functions
: that can use it.
See the work ca. 1980-1990 on "blackboard architectures" in the AI
community for some interesting ideas in this direction.
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "The road of Excess leads to the Palace
of Wisdom" - William Blake
------------------------------
Date: 14 May 2000 11:46:29 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Please Help friend on perl problem
Message-Id: <8fm065$ul2$1@orpheus.gellyfish.com>
On Sat, 13 May 2000 19:04:27 GMT velocity wrote:
> print SOCK @header;
> ############ add permanent headers here#####################
> print SOCK "Organization: Sons of Liberty\n";
> print SOCK "FUCK CABAL\n";
> print SOCK "FUCK NANAU\n";
> ############################################################
> print SOCK "Subject: $subj\n";
You appear to have some non header items in your header there.
If you had used Net::NNTP you wouldnt have had this problem.
/J\
--
You tried your best and you failed miserably. The lesson is 'never try'.
--
fortune oscar homer
------------------------------
Date: Mon, 15 May 2000 09:19:29 +1000
From: "Peter G. Martin" <peterm@zeta.org.au>
To: malverian@hotmail.com
Subject: Re: Regular Expressions help
Message-Id: <391F3481.4C78F69C@zeta.org.au>
malverian@hotmail.com wrote:
>
> In article <87puqqf23z.fsf@shleppie.uh.edu>,
> Tony Curtis <tony_curtis32@yahoo.com> wrote:
> > And what might $pass be? If you keep on posting articles
> > that don't tell people anything that might help to find a
> > solution, you're going to get very frustrated.
>
> Okay, let me restate my problem.
>
> When I use a regular expression to look for a variable, it reads it as
> the number of characters, not the actual string.
>
> How would I fix this?
Read more about regular expressions, lists, scalar values and
assignments.
$count = @things;
is +designed+ to return a count of items in the @things list. It
is an assignment in a scalar context.
If you want to get list results from an assignment, you have
to have something on the left hand side that indicates that
a list is wanted, not a scalar.
e.g. also read about wantarray()
>
> $variable = "Wow this ^is^ really cool!";
> $thing = "is";
>
> if ($variable =~ /^$thing^/i) {
> print "Good! It is good!";
> } else {
> print "No! It's badddd!";
> }
>
/^$thing^/ to me looks like something that starts with $thing
(the "^$thing" bit) and is followed by the "^" character.
Somehow, I don't think this is what you meant.
You really do need to read more about regular expressions and
how they work. Head for the Llama or the Camel or use
perldoc perlre
a good deal more.
--
--peterm Peter G. Martin -- Tech. Writer
http://www.zeta.org.au/~peterm +61 2 9818 5094
Mobile: 0408 249 113 peterm@zeta.org.au
------------------------------
Date: Sun, 14 May 2000 17:06:49 -0500
From: "Andrew N. McGuire" <anmcguire@ce.mediaone.net>
Subject: Re: Silencing module warnings.
Message-Id: <391F2379.A6CB07C1@ce.mediaone.net>
Andrew Johnson wrote:
>
> In article <391D829A.C31C154B@ce.mediaone.net>,
> Andrew N. McGuire <anmcguire@ce.mediaone.net> wrote:
> > Steve wrote:
> > >
> > > What you're talkin about isn't a warning it's the standard
> > > output from that process. You can probably change this
> > > behaviour, but you'll have to read the docs first.
> >
> > No, I have read the docs, it is coming from a specific
> > warn() call inside the Find.pm module. I do not want to
> > alter the module, I want to squash the warnings from the
> > module, by redirecting the STDERR. I have found a way
>
> Rather than redirecting STDERR you could also override
> File::Find's warn() function with your own no-op version:
>
> #!/usr/bin/perl -w
> use strict;
>
> package File::Find;
> use subs 'warn';
> sub warn {}
>
> package main;
> use File::Find;
>
> # your remaining 'find' script...
>
> This reaches in and diddles with the package, but leaves STDERR
> available for other diagnostic messages in your script.
Thank you very much, I suspected that some similar
course of action was necessary, but could not figure
out how to 'express myself' in Perl.
Works like a champ, thanks again as I have now learned
something about package manipulation, I will read more
on it later.
Best Wishes,
anm
--
/*-------------------------------------------------------.
| Andrew N. McGuire |
| anmcguire@ce.mediaone.net |
`-------------------------------------------------------*/
------------------------------
Date: Sun, 14 May 2000 19:11:31 -0700
From: "Cyril H." <cyrilh@iname.com>
Subject: Specify a path in the use
Message-Id: <391F5CD3.849F5938@iname.com>
Hello, I have a simple quetion :
I'm using perl on Windows , and I'd like to use a specified file in my
script. The problem is I don't know how to include the path of my file.
The following ...
use CGI;
use "c:\mylib\uilts.pm";
doesn't work.
Any idea?
Thanks a lot.
\Cyril.
------------------------------
Date: Sun, 14 May 2000 16:48:20 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Specify a path in the use
Message-Id: <391F3B44.54A91C1B@vpservices.com>
"Cyril H." wrote:
>
> I'm using perl on Windows , and I'd like to use a specified file in my
> script. The problem is I don't know how to include the path of my file.
>
> The following ...
>
> use CGI;
> use "c:\mylib\uilts.pm";
>
> doesn't work.
First off, "doesn't work" is not a good problem description, you need to
tell us an actual error messages. Second, if you are trying to "use" a
module not in the standard library, you don't do it by including the
full name to the module, you do something like this:
use lib 'c:/mylib';
use uilts;
Third, never mix double quote marks and single backslashes - the double
quote marks will make the backslashes interpolated so either use single
quotes or double backslashes or just use forward slashes which, for most
things, works just as well.
--
Jeff
------------------------------
Date: Sun, 14 May 2000 23:53:27 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Specify a path in the use
Message-Id: <X%GT4.74089$h01.527605@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <391F5CD3.849F5938@iname.com>,
"Cyril H." <cyrilh@iname.com> writes:
> I'm using perl on Windows , and I'd like to use a specified file in my
> script. The problem is I don't know how to include the path of my file.
This is in The Fine Manual, as an FAQ.
> use CGI;
> use "c:\mylib\uilts.pm";
>
use lib 'c:/mylib/';
use uilts;
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours!
clintp@geeksalad.org for details see http://www.geeksalad.org
"If you rush a Miracle Man,
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: 14 May 2000 11:43:03 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: spoofing identity
Message-Id: <8flvvn$u0b$1@orpheus.gellyfish.com>
On Sat, 13 May 2000 19:21:06 GMT blah80 wrote:
> I know this is pretty basic, but here goes:
>
> Every 5 minutes I want to execute a pgm that hits a site and scrapes then
> parses the html. I don't really have permission to do this, so they might
> spot me in the logs pretty soon and block my ip address. I know people have
> bots hitting sites all the time and they solve this. How do they do that?
>
I would recommend that you use LWP::RobotUA which will help you create
a program that is more likely to behave in a way that wont piss anyone off.
Also see :
<http://info.webcrawler.com/mak/projects/robots/robots.html>
before you set about creating such a thing.
/J\
--
Safety? But sir! If truth be known, I actually caused more accidents
around here than any other employee, including a few doozies no one
every found out about.
--
fortune oscar homer
------------------------------
Date: Sun, 14 May 2000 17:29:43 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: strings and limits
Message-Id: <slrn8hu6m7.tt4.tadmc@magna.metronet.com>
On Sun, 14 May 2000 18:00:33 +0200, Ganix <ganix#gmx.net> wrote:
>Silly question, but is there a common way of
>getting - say 10 characters long - parts out of
>a string and put them into an array?
Sure.
You didn't say what to do with "left over" characters though...
... so I get to pick!
I pick "return a final string shorter than 10 chars if any".
>I suppose perl can triuph with some certain
>command for this purpose.
>I think at some kind of split with regular expression.
You can make use of split() returning separators when in parens
in the regex, then using grep() to eliminate the empty strings:
--------------------------------
#!/usr/bin/perl -w
use strict;
$_ = '0123456789abcdefghij0123456789ABCDEFGHIJ0123456789abc';
foreach ( grep length, split /(.{1,10})/ ) {
print "$_\n";
}
--------------------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 14 May 2000 17:42:28 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: strings and limits
Message-Id: <slrn8hu7e4.u24.tadmc@magna.metronet.com>
On Sun, 14 May 2000 17:29:43 -0400, Tad McClellan <tadmc@metronet.com> wrote:
>On Sun, 14 May 2000 18:00:33 +0200, Ganix <ganix#gmx.net> wrote:
>
>>Silly question, but is there a common way of
>>getting - say 10 characters long - parts out of
>>a string and put them into an array?
>>I think at some kind of split with regular expression.
>You can make use of split() returning separators when in parens
>in the regex, then using grep() to eliminate the empty strings:
[snip]
or, just do it with a m//g:
-------------------------------
#!/usr/bin/perl -w
use strict;
$_ = '0123456789abcdefghij0123456789ABCDEFGHIJ0123456789abc';
my @ra = /(.{1,10})/g;
foreach ( @ra ) {
print "'$_'\n";
}
-------------------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 14 May 2000 16:20:09 -0700
From: Xah <xah@xahlee.org>
Subject: Re: tar in Perl, system or not
Message-Id: <B54482B9.8CA2%xah@xahlee.org>
Tony Curtis <tony_curtis32@yahoo.com>:
> Actually you are looking for a file called 'file.tar' in
> the home directory of user 'xah'. Perl doesn't directly
> understand the ~USER notation.
You are right, that '~username' does not expand to user's home directory in
qx. However, that is NOT the reason my program does not work.
My code actually uses full path. Try to untar a tar file in Perl and you'll
see. The odd thing is that, if you run the same command in shell it works.
Help anyone?
Xah
xah@xahlee.org
http://xahlee.org/PageTwo_dir/more.html
"I love bondage and discipline languages. <wink wink, geek girls>"
------------------------------
Date: Sun, 14 May 2000 23:33:10 GMT
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: tar in Perl, system or not
Message-Id: <878zxclnbc.fsf@shleppie.uh.edu>
>> On Sun, 14 May 2000 16:20:09 -0700,
>> Xah <xah@xahlee.org> said:
> Tony Curtis <tony_curtis32@yahoo.com>:
>> Actually you are looking for a file called 'file.tar'
>> in the home directory of user 'xah'. Perl doesn't
>> directly understand the ~USER notation.
> You are right, that '~username' does not expand to
> user's home directory in qx. However, that is NOT the
> reason my program does not work.
> My code actually uses full path. Try to untar a tar file
> in Perl and you'll see. The odd thing is that, if you
> run the same command in shell it works.
Your code *doesn't* use a full (absolute) path. It uses a
relative path, viz. '~xah/file.tar', which is a file
(called 'file.tar') in a subdirectory (called '~xah') of
the current directory.
The following works for me:
system 'tar', 'xvf', 'file.tar';
but as mentioned before:
system 'tar', 'xvf', '~tonyc/file.tar';
tar: ~tonyc/file.tar: No such file or directory
tar: Error is not recoverable: exiting now
Either the code you posted is not what you're actually
trying to run, in which case you can't expect to get the
answer you want (although you might get the answer you
need :-) or...you're omitting some crucial information
about what you are doing.
hth
t
------------------------------
Date: 14 May 2000 12:11:00 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Telnet Server in Perl
Message-Id: <8fm1k4$3m5$1@orpheus.gellyfish.com>
On Sat, 13 May 2000 15:22:06 +0100 Sam Smith wrote:
>
> I have written soemthign which pretends to be a telnet
> server in perl. It works fine using inetd to redirect STDIN
> and STDOUT and doesn't do anything special with them.
>
> Unfortunately, I also need some of the features of the
> telnet spec which inetd doesn't provide (such as the ability
> to switch echoing on and off).
>
> I've had a look through CPAN, but there doesn't appear to be
> a telnet server written in perl. Does anyone know of one or
> module which I could use / modify to do what I need?
>
Not as far as I know. You could look at the code for Net::Telnet and
see what a client does or alternatively you could read the appropriate
RFC from <http://www.rfc-editor.org>
/J\
--
Marge, I agree with you -- in theory. In theory, communism works. In
theory.
--
fortune oscar homer
------------------------------
Date: 14 May 2000 12:18:05 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: the Test, to write to conference
Message-Id: <8fm21d$51q$1@orpheus.gellyfish.com>
On Sun, 14 May 2000 02:24:36 +0400 Teterlev Sergey wrote:
> just a test
>
> WarkaMEN.
This is what misc.test is for. Please read the useful articles in
news.announce.newusers .
/J\
--
Television! Teacher, mother, secret lover.
--
fortune oscar homer
------------------------------
Date: Mon, 15 May 2000 00:13:10 +0200
From: Luc-Etienne Brachotte <Luc-Etienne.Brachotte@wanadoo.fr>
Subject: Re: This error catching code should work right?
Message-Id: <391F24F5.5287E89@wanadoo.fr>
Kevin Stone a écrit :
> I'm experimenting with error catching code that is more robust than the
> standard "WORK OR DIE" method. Below is an example of my error catching
> code. All I'm doing is opening a file saving its contents to an array and
> closing it. My intent is to create highly descriptive, intuitive error
> messages for a log file and also for printing it to the screen...
>
> $status = open (DBASE, $database);
> if ($status > 0) {last;}
> else
> {
> $error='failed to open';
> $file='database file';
> $location='add entries';
> &errorlog;
> }
> @database = <DBASE>;
> $status = close (DBASE);
> if ($status == 1) {last;}
> else
> {
> $error='failed to close';
> $file='database file';
> $location='add entries';
> &errorlog;
> }
>
If I unterstand well, you want to write
$status = open (DBASE, $database);
if (!$status)
{
$error='failed to open';
$file='database file';
$location='add entries';
&errorlog;
}
@database = <DBASE>;
$status = close (DBASE);
if ($status != 1)
{
$error='failed to close';
$file='database file';
$location='add entries';
&errorlog;
}
------------------------------
Date: Sun, 14 May 2000 17:12:38 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: using an array from the disk
Message-Id: <slrn8hu5m6.tt4.tadmc@magna.metronet.com>
On Sun, 14 May 2000 11:48:31 -0700, Baris <sumengen@hotelspectra.com> wrote:
>I want to use this array on harddisk to solve this problem. What is the best
>way to handle this array?
perldoc -f tie
perldoc perltie
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 14 May 2000 12:08:56 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: where can i find perl?
Message-Id: <8fm1g8$390$1@orpheus.gellyfish.com>
On Sat, 13 May 2000 12:02:51 GMT cdgdgjgjd@dydydhy.com wrote:
> where can i find perl?
find / -name perl -print
/J\
--
Just a statue? Is the Statue of Liberty just a statue? Is the Leaning
Tower of Pizza just a statue?
--
fortune oscar homer
------------------------------
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 3044
**************************************