[7530] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1157 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 10 13:07:14 1997

Date: Fri, 10 Oct 97 10:00:24 -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           Fri, 10 Oct 1997     Volume: 8 Number: 1157

Today's topics:
     A brief request (string handling) <Falcon@darkwave.org.uk>
     Re: A brief request (string handling) (brian d foy)
     Re: A brief request (string handling) (Greg Bacon)
     Re: can Perl do this? (Greg Bacon)
     Can WEBGET work with Perl for Win95? <twarneke@cisco.com>
     Re: Combined CGI Forms with CGI.pm (Jay Flaherty)
     Re: Coverting Flatfile *to* Excel (Brian Wheeler)
     Re: flush() - why, what and where? (Greg Bacon)
     Re: Forcing numeric interpretation? (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Help Parsing ASCII File, Part 2 <rtruban@erols.com>
     Re: How do I skip \, in a split /,/ <tycage@infi.net>
     Re: html2text (Tracy Bednar)
     Re: html2text (Greg Bacon)
     Re: Oraperl Error... Please help.. <pm@katz.cc.univie.ac.at>
     Re: perl compiler (Malcolm Beattie)
     Re: Perl script to delete old mail (Greg Bacon)
     PerlScript & ASP...accessing System Command Line? (Paul T. Burke)
     please help! <wanggan1@egr.msu.edu>
     Protecting Perl source code against copyright...how? <freeman@exti.com>
     Re: Protecting Perl source code against copyright...how (Jeremy D. Zawodny)
     Re: Protecting Perl source code against copyright...how (Andrew M. Langmead)
     Re: range of return values for rand function (Greg Bacon)
     Re: Result: Cannot compile perl 5.004.03 under NEXTSTEP (Scott Hess)
     threads of control <benneman@nortel.ca>
     Re: Tied filehandles (Greg Bacon)
     Re: True Compiled thomas@x-tekcorp.com
     Wouldn't it be great (Tracy Bednar)
     Re: Wouldn't it be great <yash@teczar.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 10 Oct 1997 14:49:44 +0100
From: -=Falcon=- <Falcon@darkwave.org.uk>
Subject: A brief request (string handling)
Message-Id: <343E3278.4452@darkwave.org.uk>

Hello all,
Just a quick message, 
I'm new to PERL, and have been up to now working solidly with TCL/TK
for all my utils/scripts and CGI programs.

However, I am currently modifying a script written by someone else, and
am
unsure on how to do something...read on :

I have a form on an HTML page consisting of THREE  text input boxes,
and ONE textarea, multi-line input box.
The script I am modifying takes the output of the form and mails it to
someone, in the form

fieldname1 : data1
fieldname2 : data2
textarea1  :lots
            of stuff
            here

and so on.
On the QUERY_STRING, I can see the return chars as:
%0D%0A

What I want to do, is output the information to ONE line in 
a file as well as mail, and I can do this up until I get to
the textarea as it writes the return chars in.

How can I search the string and replace the return chars with
spaces or other pre-chosen chars?

Please reply to Falcon@darkwave.org.uk!

Thanks

Peter Truman
-- 
      .---.        .-----------     Peter James Truman
     /     \  __  /    ------           -=Falcon=-
    / /     \( -`-,   -----           
   //////    '~ (    ---          Falcon@darkwave.org.uk
  //// / // :    ; ---      http://www.falcon.darkwave.org.uk/      
 // /   /  /)   / --        
/          //..\\ 
==========UU====UU===========================================================
          '//||\\` I wish my heart was taken, but I could never let it
go   
            ''``



------------------------------

Date: Fri, 10 Oct 1997 16:03:56 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: A brief request (string handling)
Message-Id: <61lhs3$jam@bgtnsc02.worldnet.att.net>

In article <343E3278.4452@darkwave.org.uk>, Falcon@darkwave.org.uk wrote:

> On the QUERY_STRING, I can see the return chars as:
> %0D%0A
> 
> What I want to do, is output the information to ONE line in 
> a file as well as mail, and I can do this up until I get to
> the textarea as it writes the return chars in.
> 
> How can I search the string and replace the return chars with
> spaces or other pre-chosen chars?

sinply replace those characters with whatever you want to replace
them:
 
   $data =~ s/[\r\n\f]+/ /g;

good luck :)

-- 
brian d foy                                 <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm


------------------------------

Date: 10 Oct 1997 15:48:15 GMT
From: gbacon@adtran.com (Greg Bacon)
To: Falcon@darkwave.org.uk
Subject: Re: A brief request (string handling)
Message-Id: <61linv$o58$7@info.uah.edu>

[Posted and mailed]

In article <343E3278.4452@darkwave.org.uk>,
	-=Falcon=- <Falcon@darkwave.org.uk> writes:
: Hello all,
: Just a quick message, 
: I'm new to PERL, and have been up to now working solidly with TCL/TK
: for all my utils/scripts and CGI programs.

Beware, Perl is dangerously addictive. :-)  You won't want to go back.

: I have a form on an HTML page consisting of THREE  text input boxes,
: and ONE textarea, multi-line input box.
: The script I am modifying takes the output of the form and mails it to
: someone, in the form
: 
: fieldname1 : data1
: fieldname2 : data2
: textarea1  :lots
:             of stuff
:             here
: 
: and so on.
: On the QUERY_STRING, I can see the return chars as:
: %0D%0A

Why aren't you using CGI.pm?  It does all of the encoding and decoding
for you so you don't have to deal with %-hexdigit-hexdigit.

: What I want to do, is output the information to ONE line in 
: a file as well as mail, and I can do this up until I get to
: the textarea as it writes the return chars in.
:
: How can I search the string and replace the return chars with
: spaces or other pre-chosen chars?

If you're determined not to use CGI.pm, then do something like

    # from CGI.pm
    # unescape URL-encoded data
    sub unescape {
        my($todecode) = @_;
        $todecode =~ tr/+/ /;       # pluses become spaces
        $todecode =~ s/%([0-9a-fA-F][0-9a-fA-F])/pack("c",hex($1))/ge;
        return $todecode;
    }

    ($textarea = unescape $textarea) =~ s/\s+/ /g;

The above decodes the data from your textarea and then substitutes a
single space for all runs of whitespace.

CGI.pm rocks.  Use it.  Check out its web page at

    http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html

It's so cool it comes with the standard distribution of perl.

: Please reply to Falcon@darkwave.org.uk!

What about everyone else in the group who might be interested in the
answer to your question too?

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


------------------------------

Date: 10 Oct 1997 15:11:28 GMT
From: gbacon@adtran.com (Greg Bacon)
To: Chris Kahrhoff <cck@wwdg.com>
Subject: Re: can Perl do this?
Message-Id: <61lgj0$o58$2@info.uah.edu>

[Posted and mailed]

In article <343D67AE.41F9@wwdg.com>,
	Chris Kahrhoff <cck@wwdg.com> writes:
: I'm am to learn perl in order to write a program that will collect data
: from a syslog of a terminal server and make a report of that data,
: including duration of connection, name of connection, etc.  Will perl do
: this?

But of course!

: How would I go about writing this program?

Have you read the Second Llama?

: Does a similar
: program already exist?

Have a look at Randal's fifteenth Unix Review column "Logfile Analysis"
at

    http://www.stonehenge.com/merlyn/UnixReview/col15.html

This will surely be of tremendous help to you.

: Thanks for any help you can give me.

No problem; I enjoy helping people (especially helping people let Perl
help them or helping Perl help people :-).

: I prefer
: email responses.

See Tad's followup.

Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


------------------------------

Date: Fri, 10 Oct 1997 09:42:11 -0400
From: Tom Warneke <twarneke@cisco.com>
Subject: Can WEBGET work with Perl for Win95?
Message-Id: <343E30B3.B2A2A686@cisco.com>

Hi,

I use webget on Unix with great success.

It doesn't work with Perl for Win95.  Any suggestions on  configuration
changes or wether it can be made to work at all in Windows?

Thank you in advance...
Tom


------------------------------

Date: 10 Oct 1997 13:03:32 GMT
From: fty@hickory.engr.utk.edu (Jay Flaherty)
Subject: Re: Combined CGI Forms with CGI.pm
Message-Id: <61l934$qme$1@gaia.ns.utk.edu>

Mike Fussy (fussy@mpinet.net) wrote:
: I've recently migrated from cgi-lib.pl to CGI.pm. With cgi-lib.pl
: combined forms are simple:
: 
: if &ReadParse(*in)
: {
:   &ProcessForm;
: }
: else
: {
:   &PrintForm;
: }
: 
: How do you accomplish the same functionality with CGI.pm? For example:
: 
: use CGI qw(:standard);
: 
: $query = new CGI;
: 
: $query always comes back as defined... How do I test if no data was
: passed into the script without doing something like testing for the
: existence of a known parameter??

parameters are accessed by the $query->param() method. So you could
do the following:

Use CGI;
$query = new CGI;

unless ($query->param) {
	&PrintForm;
	exit;
}

# process form here

You really should read the excellent documenation:
http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html

Jay
--
**********************************************************************  
Jay Flaherty                                               fty@utk.edu
"Once in awhile you get shown the light, in the strangest of places if
you look at it right" - R. Hunter
**********************************************************************



------------------------------

Date: 10 Oct 1997 14:07:47 GMT
From: bdwheele@indiana.edu (Brian Wheeler)
Subject: Re: Coverting Flatfile *to* Excel
Message-Id: <61lcrj$r1c$1@dismay.ucs.indiana.edu>

In article <343D9BC3.51ADF654@ix.netcom.com>,
	Jerry Hicks <wghhicks@ix.netcom.com> writes:
> Timothy Lux wrote:
>> 
>> Hi:
>> 
>> Ive read the posts on how to get an Excel document into a flatfile database
>> (simple way is to save it as a comma-delimited text file within Excel)... but
>> I need to go the other way. I have a flatfile database where the 'admin' user
>> can choose to convert the data to an Excel document. I can get the data to any
>> format I need, but is the solution to:
>>         1 - convert the data to comma delimited
>>         2 - open Excel
>>         3 - open the file
>> 
>> I don't want the user to have to do anything special... is there a way to open
>> Excel and the file all from PERL?  Or would the solution be to send the comma
>> delimited file via email, and hope they know how to do it from that point on?
>> 
>> Thanks in advance--
>> 
>> Tim
> 
> Win32::OLE is your friend

	If you're not on Win32, OLE is worthless.  Look up the SYLK format.
It'll let you do all kinds of wacky stuff that excel will turn into a table.

Brian


------------------------------

Date: 10 Oct 1997 15:21:19 GMT
From: gbacon@adtran.com (Greg Bacon)
To: Gary Howland <ghowland@hotlava.com>
Subject: Re: flush() - why, what and where?
Message-Id: <61lh5f$o58$5@info.uah.edu>

[Posted and mailed]

In article <343DF2E3.7CA0@hotlava.com>,
	Gary Howland <ghowland@hotlava.com> writes:
: I've been playing around with tied filehandles, and have noticed that
: flush does not seem to be defined for them.  I then took at look at the
: IO::Handle packages, and the perl source, and couldn't figure out what
: the circumstances are for flush() to be available.  I can't find any
: reference to flush() in the documentation either.
: 
: So, first question:  Where is flush() documented?

According to my 5.004_03 version of perlvar(1):

    $OUTPUT_AUTOFLUSH

    $|    If set to nonzero, forces a flush right away and
          after every write or print on the currently
          selected output channel.  Default is 0 (regardless
          of whether the channel is actually buffered by the
          system or not; $| tells you only whether you've
          asked Perl explicitly to flush after each write).
          Note that STDOUT will typically be line buffered
          if output is to the terminal and block buffered
          otherwise.  Setting this variable is useful
          primarily when you are outputting to a pipe, such
          as when you are running a Perl script under rsh
          and want to see the output as it's happening.
          This has no effect on input buffering.  (Mnemonic:
          when you want your pipes to be piping hot.)

As you see, there's no flush operator, rather, each filehandle knows
whether it's buffered.

: Second question:  Why doesn't flush work in tied filehandles?

What led you to believe this is true?

Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


------------------------------

Date: Fri, 10 Oct 97 09:43:39 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Forcing numeric interpretation?
Message-Id: <343e3152$4$ofn$mr2ice@speaker>

In <Pine.GSO.3.96.971009071856.23840E-100000@usertest.teleport.com>, on
10/09/97 at 07,
   Tom Phoenix <rootbeer@teleport.com> said:
+-----
| > Perl works with strings.  You can give Perl a hint that you're working
| > with a numeric value by adding 0 to the value in question, but it's
| > still a string when all is said and done. 
| Not so. A scalar is converted as needed, and the result is cached. But the
+--->8

So I saw in another response (the one that showed the SVs)... looks like
things have improved since last time I was around here.  (I'd have checked the
source except that I'm about out of disk space and would have to jettison
something to bring it back online....)

-- 
brandon s. allbery              [Team OS/2][Linux]          bsa@void.apk.net
cleveland, ohio              mr/2 ice's "rfc guru" :-)                 KF8NH
Warpstock '97:  OS/2 for the rest of us!  http://www.warpstock.org
Memo to MLS:  End The Burn Scam --- Doug Logan MUST GO!  FORZA CREW!



------------------------------

Date: Fri, 10 Oct 1997 12:20:40 GMT
From: Rob Truban <rtruban@erols.com>
Subject: Help Parsing ASCII File, Part 2
Message-Id: <343E1D98.1B7196EA@erols.com>

Hi Again,

Here is a subset of the file I want to parse:

fdn
  serialNumber
  manufacturerNamename
  productLabel                     release

 ------------------------------------------------------------------------------

 --------------------------------
 --------------------------------------------------
 -------------------------------- ----------------

  HOST1
  123-45-6789
  Northern Telecom
  DMS 100                          Ver 3.1.2



This file was made as result of an SQL query on a Sybase database.  The
top part is the header and the info at the bottom is the
result.  I want to take this info and put it into another database
(Access) possible via Visual Basic.

After reading a few books and reading some posts on here, it was my
thinking that my best approach would be to parse this data
into an associative array.  Each piece of the header would be a key
element, then the data that relates to each key goes into the record
part of the array.  Now this subset of data only has one "record", and
an actually file would have many records to parse out and put into the
new database.  Would I still want to use an A. Array?

My problem so far is that I have no clue on how to parse or talk to the
Access database.  What can I do?  Not much! :)   I did
find an example in one of my books that parses html looking for certain
tags.  They use a getc(*) and step through the file one character at
a time.  It seems there would be a better way to do this for me
(especially with the header data having no white space inside of string
I wish to parse).

I looked at my 1st Perl code 4 days ago and I've never written a parser
in any language,  so if I seem very clue less, that would help explain
why :)
Any help or insight would be greatly appreciated.

Thanks again,

Rob Truban





------------------------------

Date: Fri, 10 Oct 1997 09:15:58 -0400
From: Ty Cage Warren <tycage@infi.net>
Subject: Re: How do I skip \, in a split /,/
Message-Id: <343E2A8E.2B3AC9B7@infi.net>

Tad McClellan wrote:
> 
> Ty Cage Warren (tycage@infi.net) wrote:
> : Toutatis wrote:
> : >
> : > $line = 'xxxx,xx\,xx,xxxx'
> : > How do I split this line into three fields, omitting the escaped comma?
> 
> With great difficulty ;-)
> 
> Seems like there must be a better way, but I include mine below.
> 
> : Try
> 
> : $line = 'xxxx,xx\,xx,xxxx';
> : @fields = split(/[^\\],/,$line);
> 
> Well you can try that if you want, but it won't do what he asked for ;-)
> 
> I get these three array elements:
> 
> xxx
> xx\,x
> xxxx
> 
> (two 'x's went into the bit bucket)
> 
> : The /[^\\],/ means match anything that isn't a literal \ followed by a
> : comma.
> 
> That's true enough, but since it is used in a split(), whatever
> matches (including the non-backslash char that matched the char class)
> is not included in the returned substrings...

*sigh*  Did I forget to put in an "untested" disclamer?  
;-)
 
Ty "Hey, I was a physics major, 3 x's round to 4" Warren

+---+
Ty Cage Warren                                           tycage@infi.net
Systems Engineer                                                 InfiNet
Homepage: http://tazer.engrs.infi.net/~tycage
PGP Public Key: http://tazer.engrs.infi.net/~tycage/pgpkey.html
PGP Fingerprint: FF C1 28 CA 80 B5 31 78  B1 24 2E 8C AB DA FB D2
------------->Never invoke anything bigger than your head.<-------------


------------------------------

Date: Fri, 10 Oct 1997 13:36:56 GMT
From: spectran@netcom.com (Tracy Bednar)
Subject: Re: html2text
Message-Id: <spectranEHu8HL.Bx6@netcom.com>

If you have lynx, you can do
lynx -dump abc.html

Very handy, if not, then check out some of the modules, I think
LWP or LIBWWW.

- T

ps:  If any can help me setup sockets to work with perl I'd really
appreciate it, I've used h2ph, with no luck.


gonzalo@interimagen.com wrote:
: Hello guys:

:     Do you know how I can discart HTML tags and anly take the text form a
: HTML file?. I need open a file just to extract the text.


: Thank you.

: -------------------==== Posted via Deja News ====-----------------------
:       http://www.dejanews.com/     Search, Read, Post to Usenet


------------------------------

Date: 10 Oct 1997 15:27:34 GMT
From: gbacon@adtran.com (Greg Bacon)
To: gonzalo@interimagen.com
Subject: Re: html2text
Message-Id: <61lhh6$o58$6@info.uah.edu>

[Posted and mailed]

In article <876458973.9075@dejanews.com>,
	gonzalo@interimagen.com writes:
:     Do you know how I can discart HTML tags and anly take the text form a
: HTML file?. I need open a file just to extract the text.

I'm assuming you read the perlfaq9(1) manpage or the HTML version at

    http://www.perl.com/CPAN/doc/FAQs/FAQ/PerlFAQ.html
        #perlfaq9_Networking_Revision

but just missed "How do I remove HTML from a string?" at

    http://www.perl.com/CPAN/doc/FAQs/FAQ/PerlFAQ.html
        #How_do_I_remove_HTML_from_a_stri

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


------------------------------

Date: 10 Oct 1997 13:06:01 GMT
From: pm <pm@katz.cc.univie.ac.at>
Subject: Re: Oraperl Error... Please help..
Message-Id: <61l97p$1ib4$1@ftp.univie.ac.at>

Tony Banchieri <tbanchie@cisco.com> wrote:

: I now get the error when executing the program: 
:    fetchrow: handle  is not a hash reference at per_detail.cgi line 69.

You get this very informative message whenever an SQL error occurs.
You might print the SELECT statement and execute it using sqlplus,
this way you get meaningful error messages.

-- 
Peter Marksteiner                       e-mail: Peter.Marksteiner@univie.ac.at
Vienna University Computer Center                   Tel: (+43 1) 4277 14055
Universitaetsstrasse 7, A-1010 Vienna, Austria      FAX: (+43 1) 4277 9140


------------------------------

Date: 10 Oct 1997 13:26:40 GMT
From: mbeattie@sable.ox.ac.uk (Malcolm Beattie)
Subject: Re: perl compiler
Message-Id: <61laeg$e0p$1@news.ox.ac.uk>

In article <343CED5E.5FCF@iti-oh.com>,
Brad Hochstetler  <bhh@iti-oh.com> wrote:
>I have statically installed the perl compiler, with no problems,
>my basic test programs worked fine.  But when I went to a little
>more sophisticated program I got this error message:
>
>Can't locate object method "first" via package "B::OP" at
>/home/bhh/perl5/lib/solaris/5.00401/B.pm line 95.
>END failed--cleanup aborted.
>
>I can't seem to find the method "first" using grep liberally.  Am I 
>overlooking something basic here?  The command I used to compile
>the perl program was:
>
>bperl -MO=C,-ofoo.c foo.pl
>
>I am using perl5.004_01 and the alpha3 release of the compiler.

5.004 introduced a new keyword which broke the compiler's list of
known keywords. 5.004 also introduced other changes that break alpha3.
I'm busy working on 5.005 which will have a somewhat better version of
the compiler and will be out in November.

--Malcolm

-- 
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Oxford University Computing Services
"I permitted that as a demonstration of futility" --Grey Roger


------------------------------

Date: 10 Oct 1997 14:57:10 GMT
From: gbacon@adtran.com (Greg Bacon)
To: Dan Cradler <dcradler@mods.com>
Subject: Re: Perl script to delete old mail
Message-Id: <61lfo6$o58$1@info.uah.edu>

[Posted and mailed]

In article <343D237F.76C3@mods.com>,
	Dan Cradler <dcradler@mods.com> writes:
: Does anyone know of a script to delete all mail older than a certain
: date from all unix mail inboxes? I am in need of such a script to
: implement a company policy and am hoping I don't need to start from
: scratch. I am fairly new to Perl but experienced in C and sh so any
: suggestions would be helpful.

The problem is that you're going to have to jump through some hoops to
keep track of how old all messages are in every mailbox because the
owner could go through and modify the Date: fields to get under your
scythe.  Even if you have a dbm of messages and the date they first
appeared in the mail spool, your users can still go in and change
Message-IDs.  They could just as easily reorder their mailbox, so you
can't keep an array of dates, because you're bound to end up with
mismatches.

The cards are telling you that this is a fascist way of enforcing
policy.  Perhaps your problem would be better solved by social means
than technical.  If you're determined to find the middle ground, you
might use a script like this:

    #! /usr/bin/perl -Tw
    # A loose take-off on tchrist's dfbitch
    # send hate mail to anyone whose mailbox is too big
    # what a vicious cycle.. :-)

    $0 =~ m!^.*/(.*)$!;
    $0 = $1;

    $ENV{PATH} = '/bin:/usr/bin';

    my $SENDMAIL = '/usr/lib/sendmail -oi -t';

    my $SPOOL    = '/var/mail';
    my $TOO_BIG  = 200 * 1024;  # i.e. 2 Kb
    my $BIGSTR   = sprintf "%0.1f", $TOO_BIG / 1024;

    sub bitch_at {
        my $user = shift;
        my $size = shift;

        return unless (defined $user and defined $size);

        open MAIL, "| $SENDMAIL" or die "$0: failed fork: $!\n";
        print MAIL <<EOBitch;
    From: Mailbox Watcher ($0) <daemon>
    To: $user
    Cc: root
    Subject: Your mailbox is too big ($size Kb)

    Company policy mandates that Unix mailboxes shouldn't grow past
    $BIGSTR kilobytes in size.  Your mailbox's size was $size kilobytes
    up to the point this message was sent, therefore you are not in
    compliance.  Please delete old messages from your mailbox.  You
    might also consider copying your mailbox to somewhere other than the
    mail spool ($SPOOL) and then emptying your mailbox that is in the
    mail spool.

    A copy of this message has been sent to the sysadmin.

    Thank you for your cooperation,
    The Daemon
    EOBitch

        unless (close MAIL) {
            my $msg;

            $msg =  "$0: `$SENDMAIL' exited " . ($? >> 8);
            $msg .= " (signal " . ($? & 255) . ")" if $? & 255;
            $msg .= "\n";

            warn $msg;
        }
    }

    ## main
    opendir SPOOL, $SPOOL or die "$0: failed opendir $SPOOL: $!\n";

    ## this assumes that user foo's mailbox is $SPOOL/foo
    while (defined($_ = readdir SPOOL)) {
        next unless defined(getpwnam $_);

        my $size = -s "$SPOOL/$_";
        if ($size >= $TOO_BIG) {
            bitch_at $_, sprintf("%0.1f", $size / 1024);
        }
    }

    __END__

which has the nice feature of not actually reading anyone's mail (which
I'm sure your users will appreciate :-).  To use it, run it as a nightly
(or daily) cron job.

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


------------------------------

Date: Fri, 10 Oct 1997 15:15:30 GMT
From: paul_burke@onesource.com (Paul T. Burke)
Subject: PerlScript & ASP...accessing System Command Line?
Message-Id: <343e440b.153888499@News>

Greetings,

I am a  newbie to PerlScript and ASP.  In an attempt to port over my
existing Perl scripts to PerlScript and ASP, I am in desperate need of
accessing the Windows NT system command line.  Could anyone point me
to an object that provides system call functionality. [being able to
capture the output back would be a big plus as well.]

TIA

Paul T. Burke
OneSource Information Services


------------------------------

Date: Fri, 10 Oct 1997 11:07:27 -0400
From: Gang Wang <wanggan1@egr.msu.edu>
Subject: please help!
Message-Id: <343E44AF.277@egr.msu.edu>

Hi,

I'm a beginner in Perl. I'm trying to write a perl script
to read/modify the registry content in Windows NT Win32 environment.
It uses Win32::Registry package like this:
use Win32::Registry

But when I tried to compile it, it gave me error:
Goto undefind subroutine &AutoLoader::AUTOLOAD at C:\Perl\lib/Win32/
Registry.pm line 84.

Can anyone give me the reason for this compilation error?

Thanks a lot,

-Gang
wanggan1@egr.msu.edu


------------------------------

Date: Fri, 10 Oct 1997 11:55:49 -0400
From: Bob Freeman <freeman@exti.com>
Subject: Protecting Perl source code against copyright...how?
Message-Id: <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?

--
Bob Freeman               Experience Technology, Inc.
mailto:freeman@exti.com      http://www.exti.com/
(905)-383-7086




------------------------------

Date: Fri, 10 Oct 1997 16:45:23 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Protecting Perl source code against copyright...how?
Message-Id: <343f5b91.162842124@igate.hst.moc.com>

[cc'd automagically to original author]

On Fri, 10 Oct 1997 11:55:49 -0400, Bob Freeman <freeman@exti.com>
wrote:

>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?

Copyright 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: Fri, 10 Oct 1997 16:52:03 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Protecting Perl source code against copyright...how?
Message-Id: <EHuHIs.8xC@world.std.com>

Bob Freeman <freeman@exti.com> writes:

>Subject: Re: Protecting Perl source code against copyright...how?

Wait, don't you actually want something that will programatically
_enforce_, rather than protect against, copyright.

>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?

Did you see this entry in the FAQ? It rather strongly tries to deter
you from what you are trying to do, but gives you some direction
towards how to accomplish it anyway. Don't dismiss its suggestion
about licenses immediately. Even if you want to try some of the
"intellectual property enforcement through obscurity" methods that are
mentioned, it is only fair to explicitly tell your customers what you
are or are not allowing them to do with your code.

<URL:http://www.perl.com/CPAN/doc/manual/html/pod/perlfaq3/
How_can_I_hide_the_source_for_my.html>

>  How can I hide the source for my Perl program?
>
>    Delete it. :-) Seriously, there are a number of (mostly
>    unsatisfactory) solutions with varying levels of "security".
>
>    First of all, however, you *can't* take away read permission, because
>    the source code has to be readable in order to be compiled and
>    interpreted. (That doesn't mean that a CGI script's source is readable
>    by people on the web, though.) So you have to leave the permissions at
>    the socially friendly 0755 level.
>
>    Some people regard this as a security problem. If your program does
>    insecure things, and relies on people not knowing how to exploit those
>    insecurities, it is not secure. It is often possible for someone to
>    determine the insecure things and exploit them without viewing the
>    source. Security through obscurity, the name for hiding your bugs
>    instead of fixing them, is little security indeed.
>
>    You can try using encryption via source filters (Filter::* from CPAN).
>    But crackers might be able to decrypt it. You can try using the byte
>    code compiler and interpreter described below, but crackers might be
>    able to de-compile it. You can try using the native-code compiler
>    described below, but crackers might be able to disassemble it. These
>    pose varying degrees of difficulty to people wanting to get at your
>    code, but none can definitively conceal it (this is true of every
>    language, not just Perl).
>
>    If you're concerned about people profiting from your code, then the
>    bottom line is that nothing but a restrictive licence will give you
>    legal security. License your software and pepper it with threatening
>    statements like "This is unpublished proprietary software of XYZ Corp.
>    Your access to it does not give you permission to use it blah blah
>    blah." We are not lawyers, of course, so you should see a lawyer if
>    you want to be sure your licence's wording will stand up in court.


-- 
Andrew Langmead


------------------------------

Date: 10 Oct 1997 15:15:00 GMT
From: gbacon@adtran.com (Greg Bacon)
To: jim@theaction.com
Subject: Re: range of return values for rand function
Message-Id: <61lgpk$o58$3@info.uah.edu>

[Posted and mailed]

In article <EHt6ws.4w6@nonexistent.com>,
	jim@theaction.com (Jim Sauer) writes:
: According to the camel book :
: rand returns a value between 0 and 1 (including 0 and excluding 1).
: rand EXPR returns a number between 0 and the value of EXPR.
: Is that also (including 0 but excluding the value of EXPR)?

According to my 5.004_03 docs:

    rand EXPR

    Returns a random fractional number greater than or
    equal to 0 and less than the value of EXPR.  (EXPR
    should be positive.)  If EXPR is omitted, the
    value 1 is used.

My interpretation of that is that the return value of rand is on the
range [0, EXPR).

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


------------------------------

Date: 10 Oct 1997 15:00:57 GMT
From: scott@doubleu.com (Scott Hess)
Subject: Re: Result: Cannot compile perl 5.004.03 under NEXTSTEP 3.3
Message-Id: <SCOTT.97Oct10100055@slave.doubleu.com>

In article <EHstrx.1sB@RnA.NL> Gerben_Wierda@RnA.nl writes:
   I would like a new cc (this is gcc 2.5.8), but as far as I know,
   when I install a newer gcc, I lose the possibility to make fat
   binaries, and that is not acceptable.

You can use a newer gcc to create thin binaries - which, since they
are assembled by NeXT's as, are Mach-O thin binaries, you can then
lipo together to make a fat binary.  I guess then the problem becomes
whether you can build a gcc cross-compiler for sparc/hppa on NeXTSTEP.

Later,
--
scott hess <scott@doubleu.com> (606) 578-0412 http://www.doubleu.com/
<Favorite unused computer book title: The Compleat Demystified Idiots
  Guide to the Zen of Dummies in a Nutshell in Seven Days, Unleashed>


------------------------------

Date: Fri, 10 Oct 1997 09:31:42 -0400
From: Ben Newman <benneman@nortel.ca>
Subject: threads of control
Message-Id: <343E2E3E.EA14E657@nortel.ca>

I am very new to perl, so I am pretty sure that  I am asking a question
that has been addressed in other forums. Please bear with my ignorance.

I would like to know how perl handles asynchronous input from another
process. The nature of my application prevents me from taking a
procedural approach, and waiting for the input from this other process
before I do anything else. What I would like to do is implement some
sort of thread-like control, whereby I have a listening "thread" that
interrupts the current process and causes an action to tkae place. It
seems as if C would be the easiest way to to this, but I wonder if perl
could do it as well.

--
_______________________________________________
Ben Newman                   benneman@nortel.ca
Nortel Technologies

35 Davis Drive                    (919)991-2622
Research Triangle Park
Raleigh, North Carolina 27613      ESN 294-2622
_______________________________________________





------------------------------

Date: 10 Oct 1997 15:17:16 GMT
From: gbacon@adtran.com (Greg Bacon)
To: Gary Howland <ghowland@hotlava.com>
Subject: Re: Tied filehandles
Message-Id: <61lgts$o58$4@info.uah.edu>

[Posted and mailed]

In article <343DF34A.4A2E@hotlava.com>,
	Gary Howland <ghowland@hotlava.com> writes:
: Is it recommended that I use buffered IO (e.g. print, <>), or unbuffered
: IO (sysread, syswrite), for implementing tied filehandles?

It depends on the application.  What do you want to use tied filehandles
to do?

Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


------------------------------

Date: Fri, 10 Oct 1997 08:11:29 -0600
From: thomas@x-tekcorp.com
Subject: Re: True Compiled
Message-Id: <876402932.16441@dejanews.com>

Hi,

Although, strictly speaking, it's not 'true compiled', you can try
perl2exe which will take your perl source code and imbed it with the
perl interpreter into a .exe file. For more info, check out:

http://www.demobuilder.com/perl2exe.htm

>I'm using Perl under MS-Dos.
>I want obtain a true compiled program.
>Using GNU Perl4, I'm not able to create a .exe using dump-undump
>(it does under Unix but it doesn't under MS-Dos).
>
>Where could I find a "true" Perl Compiler?

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


------------------------------

Date: Fri, 10 Oct 1997 13:45:14 GMT
From: spectran@netcom.com (Tracy Bednar)
Subject: Wouldn't it be great
Message-Id: <spectranEHu8vE.D8H@netcom.com>

Wouldn't it be great if there was

Perl Access instead of  Access?
Visual Perl instead of  VB?
Visual Perl++ instead of  Visual C++ (This would already be in Visual Perl)
asm { } code allowed in perl
The Perl Virtual Machine


- T




------------------------------

Date: Fri, 10 Oct 1997 12:07:28 -0400
From: Yash Khemani <yash@teczar.com>
To: Tracy Bednar <spectran@netcom.com>
Subject: Re: Wouldn't it be great
Message-Id: <343E52C0.67EBA9BC@teczar.com>

Tracy Bednar wrote:
> 
> Wouldn't it be great if there was
> 
> Perl Access instead of  Access?

you can work with several db (better than access) with perl already :-).

> Visual Perl instead of  VB?
> Visual Perl++ instead of  Visual C++ (This would already be in Visual Perl)

so you wan a nice ide for writing perl? give me emacs with perl mode and
i'm
a happy camper :-)

> asm { } code allowed in perl
> The Perl Virtual Machine

a perl interpreter for java anyone?

> - T

cheers!
yash


------------------------------

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 1157
**************************************

home help back first fref pref prev next nref lref last post