[11338] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4938 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 19 10:07:21 1999

Date: Fri, 19 Feb 99 07:00:48 -0800
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, 19 Feb 1999     Volume: 8 Number: 4938

Today's topics:
    Re: ActivePerl for Windows 95 - browser droby@copyright.com
    Re: Are there any distance locators? (Tad McClellan)
        automatic converters of perl4 to perl5 vvv@vvv.vsu.ru
        BUG?? method invocation syntax and _require_ strangenes <t.wieger@intershop.de>
    Re: Can perl read a www page Carl_Cunningham@oh.god.dont.spam.me
    Re: Can perl read a www page (Tad McClellan)
        DEMO: using ioctl() <tchrist@mox.perl.com>
        DEMO: using syscall() <tchrist@mox.perl.com>
        FAQ 8.10: How do I read and write the serial port?   <perlfaq-suggestions@perl.com>
        FAQ 8.11: How do I decode encrypted password files?   <perlfaq-suggestions@perl.com>
        FAQ 8.12: How do I start a process in the background?   <perlfaq-suggestions@perl.com>
        FAQ 8.13: How do I trap control characters/signals?   <perlfaq-suggestions@perl.com>
    Re: FAQ 8.7: How do I clear the screen? (Marc-A. Woog)
        FAQ 8.9: How do I ask the user for a password?   <perlfaq-suggestions@perl.com>
    Re: File Locking Question <tchrist@mox.perl.com>
    Re: File Locking Question (Tad McClellan)
    Re: file mode from stat() (Tad McClellan)
        Help, needed to create a 3 tier hash/array structure lee.gammell@ctaylor.co.uk
        Help: Block file transforming... evlap@usa.net
    Re: HTML::Entities -- ??BUG?? (robert)
        IO::Socket Slowdown <snay@primenet.com>
        JOKE: Microsoft Innovation <tchrist@mox.perl.com>
        Mass Email Probs <curweb@cur.org>
        Need help with s/// pattern problem PlainTextVersion <khowe@performance-net.com>
        NEWBIE: Uninitialized value problem <petr.zemanek@ff.cuni.cz>
        Perl Editors for WinNT? (H.A.)
    Re: Perl Editors for WinNT? <null@127.0.0.1>
    Re: Perl Editors for WinNT? <snay@no-junkformeprimenet.com>
    Re: Perl interpreter for Win95? <REMOVErobbh@home.com>
    Re: Problem passing arrays and hashes to subroutines. (Tad McClellan)
    Re: Problem with oraperl in a web-browser <schoedema@my-dejanews.com>
    Re: Problem: Accessing File With Perl (Tad McClellan)
    Re: String Manipulation (yet another newbie question) (Tad McClellan)
        system usage accounting system wanted (Ken Rich)
        unpack henry@solcom.co.uk
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 19 Feb 1999 13:33:56 GMT
From: droby@copyright.com
Subject: Re: ActivePerl for Windows 95 - browser
Message-Id: <7ajp83$hja$1@nnrp1.dejanews.com>

In article <7ahu64$vuf$1@nnrp1.dejanews.com>,
  Reed_Wurts@prodigy.net wrote:
>
> So, I?m trying to figure out how I can get started with:
>
> 1) being able to read the error messages before the window closes.
>

Don't open a new window for your command (that's all "start" does).  And yes,
it's a DOS 7 command.

If you're in a DOS window, just typing "whatever.pl"  will run the file in the
window you've already got if you've got the .pl extension associated with
perl.exe.  It sounds like you do.  You can also type "perl whatever.pl".


> 2) getting a simple html form ?submit? action to generate a response back to
> the browser.
>
Yes, you do need a webserver.  CGI is done by a webserver, not by a browser.

There's likely help on getting started with CGI stuff in Perl somewhere on
your system.  If you've done a standard ActiveState install, there's a
C:\Perl\html directory with lots of documentation in html format

> 3) once I have figured those things out, my goal is to have the form info
> parsed, returned to the browser for viewing, and emailed to me. [eventually I
> want to do the same, and also save the form info for every submitter in a
> file, in my secure cgi-bin folder on a remote Windows NT IIs 4.0 (I think)
> server].
>

Good luck.  Read perlfaq9, the ActivePerl stuff on Web programming and Web
Server Config, and use the CGI.pm module.

--
Don Roby

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 19 Feb 1999 08:34:19 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Are there any distance locators?
Message-Id: <bpsja7.o5i.ln@magna.metronet.com>

Poohba (poohba@io.com) wrote:
: I am looking for a distance locator.  If anyone has any info on this
: please drop me a line.


   Go to a hardware store.

   Ask "the helpful hardware folk" for a "tape measure".

   Just the thing for determining short distances.


   The Global Positioning System (GPS) seems a viable option
   for longer distances.



   What is your Perl question?


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 19 Feb 1999 17:23:19 +0300
From: vvv@vvv.vsu.ru
Subject: automatic converters of perl4 to perl5
Message-Id: <eysoc2a2w8.fsf@video.uic.vsu.ru>

Hi,

are there automatic converters of perl4 scripts to perl5 available?

Thanks.

P.S. please CC: the answer to my email address.


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

Date: Fri, 19 Feb 1999 13:49:37 +0100
From: "Thomas E. Wieger" <t.wieger@intershop.de>
Subject: BUG?? method invocation syntax and _require_ strangeness
Message-Id: <36CD5DE0.F4977E3B@intershop.de>

Hello all out there!

Could somebody explain me the following behaviour?

When i start "Test.pm" i get

    "Undefined subroutine &B::A called at B.pm line 32."

When i activate Line 1 and deactivate Line 2, everything works fine.
Also, if i change the type of method invocation by activating line 3 and
deactivating line 4,
everything works fine.


i would be very glad, if somebody could help me.

Thomas


I have the following scenario:
------------------------------------------------------
BEGIN SCENARIO
------------------------------------------------------
File A.pm contains this:

    package A;
    @ISA    = qw();

    sub new
    {
        my    ($packageName)    = @_;


        print( "A::new($packageName)\n" );

        my    $object    =    {
                              };
        bless( $object, $packageName );

        return $object;
    }
    #
    1;


File B.pm contains this:

    package B;

    #require A;      # Line 1
    require "A.pm";  # Line 2

    @ISA    = qw();

    sub new
    {
        my    ($packageName)    = @_;


        print( "B::new($packageName)\n" );
        my    $object    =    {
                              };
        bless( $object, $packageName );

        return $object;
    }


    sub test
    {
        my ($self)    = @_;


        $test    = new A ( 5 );  # Line 3 - This is the line, perl
doesn't like!!!!
    #    $test    = A->new( 5 ); # Line 4
    }



    1;


    require B;


    my    $instanceB    = new B;
    $instanceB->test();

------------------------------------------------------
END SCENARIO
------------------------------------------------------


perl -V gives
------------------------------------------------------
BEGIN PERL -V
------------------------------------------------------
Summary of my perl5 (5.0 patchlevel 4 subversion 02) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32
    uname=''
    hint=recommended, useposix=true, d_sigaction=undef
    bincompat3=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cl.exe', optimize='/Ox /Oy-', gccversion=
    cppflags='-DWIN32'
    ccflags ='-MD -DWIN32'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=n, randbits=15
  Linker and Libraries:
    ld='link', ldflags ='-nologo -subsystem:windows'
    libpth=\lib
    libs=oldnames.lib kernel32.lib user32.lib gdi32.lib  winspool.lib
comdlg32.lib advapi32.lib shel
l32.lib ole32.lib  oleaut32.lib netapi32.lib uuid.lib wsock32.lib
mpr.lib winmm.lib  version.lib odb
c32.lib odbccp32.lib
    libc=msvcrt.lib, so=dll
    useshrplib=undef, libperl=undef
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='', lddlflags='-dll'


Characteristics of this binary (from libperl):
  Compile-time options: DEBUGGING
  Built under MSWin32
  Compiled at Jan 15 1998 17:48:26
------------------------------------------------------
BEGIN PERL -V
------------------------------------------------------




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

Date: Fri, 19 Feb 1999 09:23:44 +0100
From: Carl_Cunningham@oh.god.dont.spam.me
Subject: Re: Can perl read a www page
Message-Id: <36CD1F8F.E7FC2054@oh.god.dont.spam.me>

Take a look at the documentation for LWP::Simple, it's a one-liner.


Carl Cunningham

Chinh Lam schrieb:

> Hello, I was wondering if there was way in perl to grab a web page
> off a remote server through the http protocol and store it on the
> computer that is running the script?
>
> Grabbing images is not neccessary.  Any help on this would be great!
> If you could email me a response it would help a lot.
>
> Thank you!
> chinh@ucdavis.edu





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

Date: Fri, 19 Feb 1999 08:16:50 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Can perl read a www page
Message-Id: <iorja7.44h.ln@magna.metronet.com>

Chinh Lam (chinh@catbert.ucdavis.edu) wrote:
: Hello, I was wondering if there was way in perl to grab a web page
: off a remote server through the http protocol and store it on the
: computer that is running the script?


   The LWP modules can do that.

   Go get "libwww-perl" from CPAN.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 19 Feb 1999 05:29:50 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: DEMO: using ioctl()
Message-Id: <36cd593e@csnews>

Here's an example of using the ioctl function:

    # find current window size
    require 'sys/ioctl.ph';
    if (ioctl(STDIN, &TIOCGWINSZ, $winsize)) {
	($rows, $cols, $xpixel, $ypixel) = unpack('S4', $winsize);
    } else {
	($rows, $cols) = ($ENV{LINES} || 24, $ENV{COLUMNS} || 80);
    }

And here's another:

    # find out how many bytes are available for reading
    # from a filehandle
    require 'sys/ioctl.ph';
    $size = pack("L", 0);
    ioctl(FH, FIONREAD(), $size)    or die "Couldn't call ioctl: $!\n";
    $size = unpack("L", $size);

And here's a complete program:


    #!/usr/bin/perl
    # jam - jam an argument into the stdin stream using
    #       the famous "terminal i/o control simulate
    #	    terminal input" ioctl.
    require 'sys/ioctl.ph';
    $TIOCSTI   = &TIOCSTI   if defined &TIOCSTI;
    $TIOCSTI ||= 0x5412;    # system dependent in case of failure

    $SIG{TTOU} = 'IGNORE'; 
    for (@ARGV) { jam($_) }
    sub jam {
	for (split(//, $_[0])) {
	    ioctl(STDERR, $TIOCSTI, $_)
		|| die "bad TIOCSTI: $!";
	}
    }

--tom
-- 
    if (instr(buf,sys_errlist[errno]))  /* you don't see this */
        --Larry Wall in eval.c from the 4.0 perl source code


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

Date: 19 Feb 1999 05:20:36 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: DEMO: using syscall()
Message-Id: <36cd5714@csnews>

Here's an example of using the syscall function:

    require 'sys/syscall.ph';
    $rc = syscall(&SYS_close, $fd + 0);  # must force $fd to numeric
    die "can't sysclose $fd: $!" if $rc == -1;

And here's another:

    { package main; require "sys/syscall.ph" }
    $host = "\0" x 65; ## preload scalar
    syscall(&::SYS_gethostname, $host, 65) == 0;

And finally, one more, somewhat longer:

    require 'sys/syscall.ph';

    # initialize the structures returned by gettimeofday
    $TIMEVAL_T = "LL"; 
    $done = $start = pack($TIMEVAL_T, ());

    # prompt 
    print "Press return when ready: ";

    # read the time into $start
    syscall(&SYS_gettimeofday, $start, 0)) != -1
               || die "gettimeofday: $!";
    
    # read a line
    $line = <>;
    
    # read the time into $done
    syscall(&SYS_gettimeofday, $done, 0) != -1
           || die "gettimeofday: $!";

    # expand the structure
    @start = unpack($TIMEVAL_T, $start);
    @done  = unpack($TIMEVAL_T, $done);

    # fix microseconds
    for ($done[1], $start[1]) { $_ /= 1_000_000 }
    
    # calculate time difference
    $delta_time = sprintf "%.4f", ($done[0]  + $done[1]  )
                                             -
                                  ($start[0] + $start[1] );
  
    print "That took $delta_time seconds\n";

--tom
-- 
    "Since when did you hear people talk about writing LISP or BASIC *scripts*?
     JCL and shell make command *scripts*; perl and LISP make *programs*."  --me


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

Date: 19 Feb 1999 05:09:53 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 8.10: How do I read and write the serial port?  
Message-Id: <36cd5491@csnews>

(This excerpt from perlfaq8 - System Interaction 
    ($Revision: 1.36 $, $Date: 1999/01/08 05:36:34 $)
part of the standard set of documentation included with every 
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq8.html
if your negligent system adminstrator has been remiss in his duties.)

  How do I read and write the serial port?

    This depends on which operating system your program is running on. In
    the case of Unix, the serial ports will be accessible through files in
    /dev; on other systems, the devices names will doubtless differ. Several
    problem areas common to all device interaction are the following

    lockfiles
        Your system may use lockfiles to control multiple access. Make sure
        you follow the correct protocol. Unpredictable behaviour can result
        from multiple processes reading from one device.

    open mode
        If you expect to use both read and write operations on the device,
        you'll have to open it for update (see the section on "open" in the
        perlfunc manpage for details). You may wish to open it without
        running the risk of blocking by using sysopen() and
        `O_RDWR|O_NDELAY|O_NOCTTY' from the Fcntl module (part of the
        standard perl distribution). See the section on "sysopen" in the
        perlfunc manpage for more on this approach.

    end of line
        Some devices will be expecting a "\r" at the end of each line rather
        than a "\n". In some ports of perl, "\r" and "\n" are different from
        their usual (Unix) ASCII values of "\012" and "\015". You may have
        to give the numeric values you want directly, using octal ("\015"),
        hex ("0x0D"), or as a control-character specification ("\cM").

            print DEV "atv1\012";       # wrong, for some devices
            print DEV "atv1\015";       # right, for some devices

        Even though with normal text files, a "\n" will do the trick, there
        is still no unified scheme for terminating a line that is portable
        between Unix, DOS/Win, and Macintosh, except to terminate *ALL* line
        ends with "\015\012", and strip what you don't need from the output.
        This applies especially to socket I/O and autoflushing, discussed
        next.

    flushing output
        If you expect characters to get to your device when you print()
        them, you'll want to autoflush that filehandle. You can use select()
        and the `$|' variable to control autoflushing (see the section on
        "$|" in the perlvar manpage and the "select" entry in the perlfunc
        manpage):

            $oldh = select(DEV);
            $| = 1;
            select($oldh);

        You'll also see code that does this without a temporary variable, as
        in

            select((select(DEV), $| = 1)[0]);

        Or if you don't mind pulling in a few thousand lines of code just
        because you're afraid of a little $| variable:

            use IO::Handle;
            DEV->autoflush(1);

        As mentioned in the previous item, this still doesn't work when
        using socket I/O between Unix and Macintosh. You'll need to hardcode
        your line terminators, in that case.

    non-blocking input
        If you are doing a blocking read() or sysread(), you'll have to
        arrange for an alarm handler to provide a timeout (see the "alarm"
        entry in the perlfunc manpage). If you have a non-blocking open,
        you'll likely have a non-blocking read, which means you may have to
        use a 4-arg select() to determine whether I/O is ready on that
        device (see the section on "select" in the perlfunc manpage.

    While trying to read from his caller-id box, the notorious Jamie
    Zawinski <jwz@netscape.com>, after much gnashing of teeth and fighting
    with sysread, sysopen, POSIX's tcgetattr business, and various other
    functions that go bump in the night, finally came up with this:

        sub open_modem {
            use IPC::Open2;
            my $stty = `/bin/stty -g`;
            open2( \*MODEM_IN, \*MODEM_OUT, "cu -l$modem_device -s2400 2>&1");
            # starting cu hoses /dev/tty's stty settings, even when it has
            # been opened on a pipe...
            system("/bin/stty $stty");
            $_ = <MODEM_IN>;
            chop;
            if ( !m/^Connected/ ) {
                print STDERR "$0: cu printed `$_' instead of `Connected'\n";
            }
        }

-- 
Intel chips aren't defective.  They just seem that way.


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

Date: 19 Feb 1999 06:10:07 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 8.11: How do I decode encrypted password files?  
Message-Id: <36cd62af@csnews>

(This excerpt from perlfaq8 - System Interaction 
    ($Revision: 1.36 $, $Date: 1999/01/08 05:36:34 $)
part of the standard set of documentation included with every 
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq8.html
if your negligent system adminstrator has been remiss in his duties.)

  How do I decode encrypted password files?

    You spend lots and lots of money on dedicated hardware, but this is
    bound to get you talked about.

    Seriously, you can't if they are Unix password files - the Unix password
    system employs one-way encryption. It's more like hashing than
    encryption. The best you can check is whether something else hashes to
    the same string. You can't turn a hash back into the original string.
    Programs like Crack can forcibly (and intelligently) try to guess
    passwords, but don't (can't) guarantee quick success.

    If you're worried about users selecting bad passwords, you should
    proactively check when they try to change their password (by modifying
    passwd(1), for example).

-- 
    X-Windows: A mistake carried out to perfection.
	--Jamie Zawinski


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

Date: 19 Feb 1999 06:42:38 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 8.12: How do I start a process in the background?  
Message-Id: <36cd6a4e@csnews>

(This excerpt from perlfaq8 - System Interaction 
    ($Revision: 1.36 $, $Date: 1999/01/08 05:36:34 $)
part of the standard set of documentation included with every 
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq8.html
if your negligent system adminstrator has been remiss in his duties.)

  How do I start a process in the background?

    You could use

        system("cmd &")

    or you could use fork as documented in the section on "fork" in the
    perlfunc manpage, with further examples in the perlipc manpage. Some
    things to be aware of, if you're on a Unix-like system:

    STDIN, STDOUT, and STDERR are shared
        Both the main process and the backgrounded one (the "child" process)
        share the same STDIN, STDOUT and STDERR filehandles. If both try to
        access them at once, strange things can happen. You may want to
        close or reopen these for the child. You can get around this with
        `open'ing a pipe (see the section on "open" in the perlfunc manpage)
        but on some systems this means that the child process cannot outlive
        the parent.

    Signals
        You'll have to catch the SIGCHLD signal, and possibly SIGPIPE too.
        SIGCHLD is sent when the backgrounded process finishes. SIGPIPE is
        sent when you write to a filehandle whose child process has closed
        (an untrapped SIGPIPE can cause your program to silently die). This
        is not an issue with `system("cmd&")'.

    Zombies
        You have to be prepared to "reap" the child process when it finishes

            $SIG{CHLD} = sub { wait };

        See the section on "Signals" in the perlipc manpage for other
        examples of code to do this. Zombies are not an issue with
        `system("prog &")'.

-- 
"Everything you said about Plan 9 is wrong"
     -- Rob Pike, letting a speaker have it


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

Date: 19 Feb 1999 07:19:11 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 8.13: How do I trap control characters/signals?  
Message-Id: <36cd72df@csnews>

(This excerpt from perlfaq8 - System Interaction 
    ($Revision: 1.36 $, $Date: 1999/01/08 05:36:34 $)
part of the standard set of documentation included with every 
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq8.html
if your negligent system adminstrator has been remiss in his duties.)

  How do I trap control characters/signals?

    You don't actually "trap" a control character. Instead, that character
    generates a signal which is sent to your terminal's currently
    foregrounded process group, which you then trap in your process. Signals
    are documented in the section on "Signals" in the perlipc manpage and
    chapter 6 of the Camel.

    Be warned that very few C libraries are re-entrant. Therefore, if you
    attempt to print() in a handler that got invoked during another stdio
    operation your internal structures will likely be in an inconsistent
    state, and your program will dump core. You can sometimes avoid this by
    using syswrite() instead of print().

    Unless you're exceedingly careful, the only safe things to do inside a
    signal handler are: set a variable and exit. And in the first case, you
    should only set a variable in such a way that malloc() is not called
    (eg, by setting a variable that already has a value).

    For example:

        $Interrupted = 0;   # to ensure it has a value
        $SIG{INT} = sub {
            $Interrupted++;
            syswrite(STDERR, "ouch\n", 5);
        }

    However, because syscalls restart by default, you'll find that if you're
    in a "slow" call, such as <FH>, read(), connect(), or wait(), that the
    only way to terminate them is by "longjumping" out; that is, by raising
    an exception. See the time-out handler for a blocking flock() in the
    section on "Signals" in the perlipc manpage or chapter 6 of the Camel.

-- 
    echo "Congratulations.  You aren't running Eunice."
        --Larry Wall in Configure from the perl distribution


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

Date: Fri, 19 Feb 1999 14:04:36 GMT
From: mwoog@gmx.net (Marc-A. Woog)
Subject: Re: FAQ 8.7: How do I clear the screen?
Message-Id: <36cd6efb.18847139@news.datacomm.ch>

On 19 Feb 1999 02:34:50 -0700, Tom Christiansen
<perlfaq-suggestions@perl.com> wrote in <36cd303a@csnews>:

>  How do I clear the screen?
>
>    If you only have to so infrequently, use `system':
>
>        system("clear");

For us (WIN)DOSlers: system("cls").

Regards,

Marc


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

Date: 19 Feb 1999 04:35:15 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 8.9: How do I ask the user for a password?  
Message-Id: <36cd4c73@csnews>

(This excerpt from perlfaq8 - System Interaction 
    ($Revision: 1.36 $, $Date: 1999/01/08 05:36:34 $)
part of the standard set of documentation included with every 
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq8.html
if your negligent system adminstrator has been remiss in his duties.)

  How do I ask the user for a password?

    (This question has nothing to do with the web. See a different FAQ for
    that.)

    There's an example of this in the "crypt" entry in the perlfunc
    manpage). First, you put the terminal into "no echo" mode, then just
    read the password normally. You may do this with an old-style ioctl()
    function, POSIX terminal control (see the POSIX manpage, and Chapter 7
    of the Camel), or a call to the stty program, with varying degrees of
    portability.

    You can also do this for most systems using the Term::ReadKey module
    from CPAN, which is easier to use and in theory more portable.

        use Term::ReadKey;

        ReadMode('noecho');
        $password = ReadLine(0);

-- 
    "Yes, you can think of almost everything as a function, but this may upset
    your wife." --Larry Wall


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

Date: 19 Feb 1999 05:09:48 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: File Locking Question
Message-Id: <36cd548c@csnews>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, "Bill Sanders" <undefined@null.com> writes:
:In a script I've written, I use flock to protect the file while it's being
:written to. Code snippet:
:
:open (COUNT, ">$count_file") || die "Unable to open $count_file: $!\n";
:flock(COUNT, 2);

Gee, that's clever -- shutting the barn door once the horses have
escaped.

I've posted the answer to this within the last 48 hours.  
Please look around.

--tom
-- 
Your csh still thinks true is false.  Write to your vendor today and tell
them that next year Configure ought to "rm /bin/csh" unless they fix their
blasted shell. :-)   --Larry Wall in Configure from the perl distribution


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

Date: Fri, 19 Feb 1999 07:55:51 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: File Locking Question
Message-Id: <7hqja7.44h.ln@magna.metronet.com>

Bill Sanders (undefined@null.com) wrote:
: In a script I've written, I use flock to protect the file while it's being
: written to. Code snippet:

: flock(COUNT, 8);
: close (COUNT);


   You have a race condition there.

   You may lose your time slice after unlocking and before closing.

   If another process write to the file during that time, the file
   may be corrupted.


: However, I have experienced what appears to be a file corruption. The
: counter went from about 4500 to 10 overnight.


   That's what happens when you lose the race  :-)


: My question: If another process is simply reading this file, while another
: is writing, will this corrupt it? 


   No, but the "reading" program may not work right.


: Presently, I do not use flock in the code
: where the file is being read. Should I be doing this?


   Yes, unless you don't mind reading undependable data.


: Any thoughts as to if this may be the cause of my error are appreciated!


   One thought when having trouble with locking would seem to be
   to search for "lock" in the Frequently Asked Questions that
   came with your perl.

   There are 3 of them in Perl FAQ, part 5.

   This one:

      "I still don't get locking.  I just want to increment the 
       number in the file.  How can I do this?"

   says:

      "DO NOT UNLOCK THIS UNTIL YOU CLOSE"

   so you should probably do that  :-)


   You normally _never_ need to unlock a file.

   Just let the close() handle it for you.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 19 Feb 1999 07:23:22 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: file mode from stat()
Message-Id: <akoja7.44h.ln@magna.metronet.com>

jesper@ad.se wrote:

: ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime,
: $blksize, $blocks) = stat("stat");

: Now for the question, how do I interpret $mode to get the octal code?


I posted a rather crufty version of "ls -l" using Perl in December.

   Subject: Re: ls -l in perl?

   http://www.dejanews.com/=kn/[ST_rn=ps]/getdoc.xp?AN=421645318

See also:

   http://www.plover.com/~mjd/perl/lsMode/


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 19 Feb 1999 14:17:20 GMT
From: lee.gammell@ctaylor.co.uk
Subject: Help, needed to create a 3 tier hash/array structure
Message-Id: <7ajrp8$jpb$1@nnrp1.dejanews.com>

I would like to create a 3 tier structure using

    volumes
        have 1 or more plexes
            have 1 or more subdisks

 for each volume,plex and subdisk I need to store its size

#! /usr/bin/perl

# try to create a 3 tier structure ...
#
# create a sample entry for volume v1
#
$VOL{"v1"} = 100;
$VOL{"v1"}{"p1"} = 100;
$VOL{"v1"}{"p1"}{"s1"} = 25;
$VOL{"v1"}{"p1"}{"s2"} = 25;
$VOL{"v1"}{"p1"}{"s3"} = 25;
$VOL{"v1"}{"p1"}{"s4"} = 25;
$VOL{"v1"}{"p2"} = 100;
$VOL{"v1"}{"p2"}{"s1"} = 25;
$VOL{"v1"}{"p2"}{"s2"} = 25;
$VOL{"v1"}{"p2"}{"s3"} = 25;
$VOL{"v1"}{"p2"}{"s4"} = 25;


# now print out the structure

foreach $vname (sort keys %VOL ) {
	print "Volume: $vname size: $VOL{$vname}\n";

	foreach $pname (sort keys %{ $VOL{$vname} }) {
		print "\tPlex: $pname size: $VOL{$vname}{$pname}\n";

		foreach $sname (keys %{$VOL{$vname}{$pname}}) {
			print "\t\tSubdisk: $sname size: $VOL{$vname}{$pname}
{$sname}\n"
		}
	}
}

However, it produces this

Volume: v1 size: 100
	Plex: p1 size: 100
		Subdisk: p1 size: 100
		Subdisk: p2 size: 100
		Subdisk: s1 size: 25
		Subdisk: s2 size: 25
		Subdisk: s3 size: 25
		Subdisk: s4 size: 25
	Plex: p2 size: 100
		Subdisk: p1 size: 100
		Subdisk: p2 size: 100
		Subdisk: s1 size: 25
		Subdisk: s2 size: 25
		Subdisk: s3 size: 25
		Subdisk: s4 size: 25
	Plex: s1 size: 25
	Plex: s2 size: 25
	Plex: s3 size: 25
	Plex: s4 size: 25

but why i need is this,

Volume: v1 size: 100
	Plex: p1 size: 100
		Subdisk: s1 size: 25
		Subdisk: s2 size: 25
		Subdisk: s3 size: 25
		Subdisk: s4 size: 25
	Plex: p2 size: 100
		Subdisk: s1 size: 25
		Subdisk: s2 size: 25
		Subdisk: s3 size: 25
		Subdisk: s4 size: 25

Any hints would be appreciated by a perl novice,

Lee Gammell.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 19 Feb 1999 13:37:02 GMT
From: evlap@usa.net
Subject: Help: Block file transforming...
Message-Id: <7ajpdt$hmu$1@nnrp1.dejanews.com>

Hi All!
I want to transform a file (text or binary). I tried:
-----------
my ( $infilename, $outf) = @ARGV;
open(INFILE, $infilename) or die "Can't open `$infilename': $!";
open(OUTFILE, ">$outf");
while ($nr = sysread INFILE, $buffer, 4096  > 0) {
  while ($nr > 0) {
# transformin' $buffer ......... - in this example just copying the file
    $nw = syswrite OUTFILE, $buffer, $nr
  }
  if ($nw < 0) {
    warn "couldn't write: $!\n"
  }
  $nr -= $nw;
};
if ($nr < 0) {
  warn "Couldn't read file: $!\n"
}
close INFILE;
close OUTFILE;
------
it doesnt work! Where I've made a mistake?
I get only some initial bytes of the whole file in the output file.

Thanks.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 19 Feb 1999 15:23:31 +0100
From: robert@il.fontys.nl (robert)
Subject: Re: HTML::Entities -- ??BUG??
Message-Id: <7ajs53$6vs@charm.il.fontys.nl>

shapirojs.no@spam.hotmail.com <shapirojs@my-dejanews.com>:
 >I'm using HTML::LinkExtor and links such as
 ><a href='myscript.cgi?next=1&chapter=0'>
 >are coming out as 'myscript.cgi?next=1&chapter;=0'
 >
 >Pop the lid on HTML::Entities and we find:
 >sub decode_entities
 >{
 >    ......
 >
 >    s/(&\#(\d+);?)/$2 < 256 ? chr($2) : $1/eg;
 >    s/(&\#[xX]([0-9a-fA-F]+);?)/$c = hex($2); $c < 256 ? chr($c) : $1/eg;
 >    #s/(&(\w+);?)/$entity2char{$2} || "$1;"/eg; <-------------- Happens here
 >
 >  ..........
 >  }
 >----------- end of HTML::Entities excerpt
 >I don't see why we're (possibly) adding a semi-colon.

Apparently, HTML::LinkExtor is feeding HTML::Entities the wrong things.
URI's, like the ones defined with HREF, should not be fed through routines
which process &...; character references which are meant for text only.

Btw, my version of HTML::Entities (1.12) doesn't add semi-colons:
s/(&(\w+);?)/$entity2char{$2} || $1/eg;

                                                                        robert


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

Date: Fri, 19 Feb 1999 06:32:05 -0800
From: Shane Nay <snay@primenet.com>
Subject: IO::Socket Slowdown
Message-Id: <36CD75E5.FDECE08B@no-junkformeprimenet.com>

It seems as though the IO:Socket interface sucks up CPU time.  I open up
a socket, and am waiting on info i.e.
$sock=new IO::Socket::INET(PeerAddrt=>"whatever.com", PeerPort=>1400,
Proto=>'tcp');
print $sock "Someinfo\n";
$dat=$sock->getline;
close $sock;

Then the CPU is totally devoted to this single Socket command, nothing
else gets done.  I am running RH5.0, with perl version 5.005_02.  Is
there anyway to get this to not happen?  I am runnig a series of servers
that speak to eachother via the IO::Socket for data proccessing.  The
thing thats killing me is that during that point were the CPU is totally
devoted to the the $sock->getline;  ,  All the other socket operations
start dieing, which totally blows a bunch of operations.  Is there
anything I can do to alleviate this problem?  I have found a work
around, but it is just that, a work around, and I know that I will have
to deal with this problem again.  Will upgrading Perl versions resolve
this problem?  Any comments will be appreciated,
Thanks,
Shane




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

Date: 19 Feb 1999 07:39:28 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: JOKE: Microsoft Innovation
Message-Id: <36cd77a0@csnews>

WASHINGTON DC -- April 2, 2003

Yesterday, the Supreme Court rejected on a split vote of 7 to 2
Microsoft's final appeal on Federal Judge Thomas Penfield Jackson's
innovative remedy to their crushing monopoly power.  Microsoft is now free
to integrate whatsoever they please into their operating systems products.
However, Jackson's ruling dictates that these operating systems may only
be distributed under the insidious Gnu Public License, so it is unlikely
that they shall choose to do so.  Full story to follow.
-- 
    "Since when did you hear people talk about writing LISP or BASIC *scripts*?
     JCL and shell make command *scripts*; perl and LISP make *programs*."  --me


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

Date: Fri, 19 Feb 1999 09:53:35 -0500
From: "Christopher Pieper" <curweb@cur.org>
Subject: Mass Email Probs
Message-Id: <7ajtns$o3n$1@news1.Radix.Net>

Ok so I have a file containing the message I want to send, and another file
with a list of all the email addresses I want to send the message too. Now I
got it to send just fine, only prob is now I am wondering if there is a way
to write a script to check all returned mail, "Those messages with email
addresses that don't work" and compile a new list. Is this at all possible
or am I just asking for too much here?




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

Date: Fri, 19 Feb 1999 10:27:20 -0400
From: "Kevin Howe" <khowe@performance-net.com>
Subject: Need help with s/// pattern problem PlainTextVersion
Message-Id: <Fxez2.7577$134.64664@tor-nn1.netcom.ca>

Could someone please help me figure out why the s// function won't work for
following script, I am pulling my hair out on this one. I think it may have
to do with the pattern variables ($1 , $2 , etc..) but can't say for sure.

Greatly appreciated,
Sincerely,
Kevin Howe


The Template
----------------------------------------
<title>
 <fmEVAL>
  $title
 </fmEVAL>
</title>
<fmEVAL>&getMeta;</fmEVAL>



The Script
--------------------------------------------
#!C:\PERL\bin\perl.exe

$title ="kevin";  ## Test Variable

open(LIST,"template.shtml"); ## Open the template file
@LINES = <LIST>;
close(LIST);

$LINE = join("<n>",@LINES); ## <n> is placeholder for when we split it later
on
$LINE =~ s/\n//g;  ## Eliminate newlines
$LINE =~ s/\t/<tab>/g;  ## Convert TABS (lets me see them)

&go; ## Do the script

sub go
{

 ## If there is an embedded tag
 if ($LINE =~ m/(<fmEVAL>(.*?)<\/fmEVAL>)/)
 {
  my $full_tag = $1;
  my $tag_value = $2;

  print "$full_tag\n";
  print "$tag_value\n";

  $tag_value =~ s/<n>//g;
  $tag_value =~ s/<tab>//g;
  $tag_value =~ s/\s//g;

  print "$tag_value\n";

  ## Evaluate Embedded Perl Code
  $tag_value = eval($tag_value);

  print "$tag_value\n";

  $LINE =~ s/$full_tag/$tag_value/;

  print $LINE;
  ## Invoke the subroutine again to check for other tags
  #&go;
 }
 else
 { ### Finished studying this line!
  print "done\n";print $LINE;}
}




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

Date: Fri, 19 Feb 1999 13:05:59 +0100
From: Petr Zemanek <petr.zemanek@ff.cuni.cz>
Subject: NEWBIE: Uninitialized value problem
Message-Id: <36CD53A6.B8B12683@ff.cuni.cz>


Sorry, probably a stupid mistake of mine, but I can't figure it out.
I have a script that should read a file into an array and sort it by
columns. I used the example from perlfaq4, but for some reason, perl -w
tells me that I use uninitialized value (it seems to be field1($a), at
least that's the only line which is reported by  -w). Can somebody tell
me where am I wrong? Thanks!

Here's the script:
#!perl -w
#open a file, read its lines to an array and sort by columns ...

$filename = $ARGV[0];
open (F, $filename) or die ("can't open $filename: $!\n");
@lines = <F>;

@sorted = sort { field1($a) <=> field2($b) ||
                         field2($a) cmp field2($b) ||
                         field3($a) cmp field3($b)
                      } @lines;

open(F, ">$filename");
print {F} @sorted;
# end


Petr Zemanek
petr.zemanek@ff.cuni.cz

P.S.: I sent the message once, but it seems it did not get through. In
case it somehow did, sorry for a dupe.



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

Date: 19 Feb 1999 13:36:57 GMT
From: ns-am528@chebucto.ns.ca (H.A.)
Subject: Perl Editors for WinNT?
Message-Id: <7ajpdp$gp5$1@News.Dal.Ca>

I'm just starting on Perl and I do most of my programming on WinNT.  I hate 
using Notpad for programming.  I was wondering if there is a nice CGI/Perl 
editor out there that I could use. Kind of like HTML editor (Not WYSIWYG).

If you have any sugesstions, I'll appreciate if you drop me a line at 
am528@chebucto.ns.ca

Thanks



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

Date: Fri, 19 Feb 1999 07:44:23 -0600
From: "Robert Burris" <null@127.0.0.1>
Subject: Re: Perl Editors for WinNT?
Message-Id: <7ajptd$ahu$1@ins8.netins.net>

http://www.textpad.com/

--
foss24 at netins dot net


H.A. wrote in message <7ajpdp$gp5$1@News.Dal.Ca>...
>...I was wondering if there is a nice CGI/Perl
>editor out there that I could use.




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

Date: Fri, 19 Feb 1999 06:48:50 -0800
From: Shane Nay <snay@no-junkformeprimenet.com>
Subject: Re: Perl Editors for WinNT?
Message-Id: <36CD79D1.537D6B1E@no-junkformeprimenet.com>

Perl Builder... pretty cool for building CGI stuff, allows auto printing of
HTML input templates, and includes some allright code for decoding POSTs and
GETs from forms.  Though personally I just use vi on Linux.

"H.A." wrote:

> I'm just starting on Perl and I do most of my programming on WinNT.  I hate
> using Notpad for programming.  I was wondering if there is a nice CGI/Perl
> editor out there that I could use. Kind of like HTML editor (Not WYSIWYG).
>
> If you have any sugesstions, I'll appreciate if you drop me a line at
> am528@chebucto.ns.ca
>
> Thanks



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

Date: Fri, 19 Feb 1999 12:57:39 GMT
From: "Robb" <REMOVErobbh@home.com>
Subject: Re: Perl interpreter for Win95?
Message-Id: <7ddz2.14862$lp5.2658@news.rdc1.tn.home.com>

Thanks!  The Activestate website looks like a great resource. I'm a web
designer trying to learn more about cgi scripting for use with web
databases.  Appreciate the tip!

Robb
http://members.home.net/robbh
Please post any responses to this newsgroup.  To email me, delete
"REMOVE" from the email address embedded in this posting...thank you.


>Yeah go to www.activestate.com and run the self installing binary. It
>runs for most people right out of the box. BTW almost any version of
>perl you get will be an interprer - there are perl compilers out
>there, but not for Win95 I don't think.




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

Date: Fri, 19 Feb 1999 07:12:18 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Problem passing arrays and hashes to subroutines.
Message-Id: <ivnja7.44h.ln@magna.metronet.com>

James Oliver (oliver.james.jh@bhp.com.au) wrote:

: I have a question regarding passing both an array and a hash as the argument
: of a subroutine.

: Specifically I want to be able to perform something like this:

: my_sub(%hash, @array);

: I am sure I
: am doing something stupid, 


   You are correct.   :-(

   (the "something" is not checking the docs installed on your hard disk)


: so if you could please provide a pointer I would
: be extremely appreciative.


   If you are having a problem with subroutines, you should
   read the docs that came with your perl that discuss
   subroutines.

   Namely 'perlsub.pod', titled "Perl subroutines".

   The second paragraph there says (emphasis added):

----------------------
The Perl model for function call and return values is simple: all
functions are passed as parameters one single flat list of scalars, and
all functions likewise return to their caller one single flat list of
scalars.  Any arrays or hashes in these call and return lists will
collapse, losing their identities--but you may always use
          ^^^^^^^^^^^^^^^^^^^^^^^
pass-by-reference instead to avoid this.
----------------------


   Get thee to 'perlref.pod' and pass references instead.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 19 Feb 1999 12:32:34 GMT
From: Peter Schoenenberger <schoedema@my-dejanews.com>
Subject: Re: Problem with oraperl in a web-browser
Message-Id: <7ajll2$edl$1@nnrp1.dejanews.com>

That's a good thought, but I have already set the following variable in the
Perl-Script:

$ENV{ORACLE_HOME}="/opt/app/oracle/product/7.3.4";

Are there any other variables which must been set?

The script _IS_ running on a unix-shell using 'perl <scriptname>' but is not
running from the WWW Server as a CGI (errorlog see below).

Peter


In article <36CCD8DE.32300FB@his.com>,
  Chris Morrow <morrowc@his.com> wrote:
> 1) Your script is running from the WWW Server...as a CGI.
> 2) you might have set the ORACLE_HOME in the CGI script and now since
> you have upgraded (and removed the old version) the ORACLE_HOME is
> different???
>
> Just a thought and a comment.
>
> This seems to most likely NOT be a problem with Apache, it seems like
> your code might need a quick fix (change ORACLE_HOME to be correct?)
>
> -Chris
>
> schoedema@my-dejanews.com wrote:
> >
> > I have the following configuration:
> > Solaris 2.5, Apache 1.2.5, Netscape 4.04 under Solaris.
> > I have a Perl script, that connects to an oracle-DB via CGI and Oraperl
from a
> > browser (IE4 or Netscape 4). Under Oracle V.7.3.2 everything works fine.
> > After upgrading the DB to V.7.3.4 the script didn't work properly anymore.
The
> > Apache error-log produces the follwing message:
> >
> > ---------- install_driver(Oracle) failed: Can't load
> > '/usr/local/lib/perl5/site_perl/sun4- solaris/auto/DBD/Oracle/Oracle.so' for
> > module DBD::Oracle: ld.so.1: /usr/local/bin/perl: fatal: libclntsh.so.1.0:
> > can't open file: errno=2 at
> > /usr/local/lib/perl5/sun4-solaris/5.00403/DynaLoader.pm line 155.
> >
> >  at (eval 1) line 2
> >
> >   DBI::install_driver('DBI', 'Oracle') called at
> > /usr/local/lib/perl5/site_perl/Oraperl.pm line 57  require Oraperl.pm called
> > at /usr/local/www/cgi-bin/digidat/list_msanl line 21  main::BEGIN() called
at
> > /usr/local/lib/perl5/site_perl/Oraperl.pm line 0  eval {...} called at
> > /usr/local/lib/perl5/site_perl/Oraperl.pm line 0 BEGIN failed--compilation
> > aborted at /usr/local/www/cgi-bin/digidat/list_msanl line 21. -----------
> >
> > If I create a softlink from the old oraclehome to new oraclehome the script
> > is running without a problem even from the webbrowser. Obviously there seems
> > to be a problem with the path-tracking within the Apache server.
> >
> > I'm grateful for any suggestions concerning my problem.
> >
> > -----------== Posted via Deja News, The Discussion Network ==----------
> > http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 19 Feb 1999 08:14:47 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Problem: Accessing File With Perl
Message-Id: <nkrja7.44h.ln@magna.metronet.com>

Shao-Ju Chao (Bruce) (schao1@nycap.rr.com) wrote:


: My question, if at the same time there are a lot of people submitting
: the form,
: what will happen to the data file? 


   It may be corrupted.


: What happens if another update
: request comes in while
: the data file is being updated by another request? 


   The file will be corrupted.


: A few weeks ago we
: experienced
: a strange situation that, the data file was "mysteriously reset" (to an
: empty file) during the
: "peak hour" of submmiting the survey form. 


   See?

   :-)


: We suspect that this is
: becasue too many requests
: want to access the same file so for some reason they find this file
: "unavailable" therefore
: create a new file.


   No. They all operate on the same file.

   Multitasking (using the CGI is one form of that) requires
   some additional care over single tasking.

   You need to lock the file if you are going to write to it.

   You must also ensure that _every_ program that writes to the
   file also respects the lock.


: Please let me know if you have any similar experience, thankS!


   perldoc -f flock


   See also Perl FAQ, part 5:

      "How can I lock a file?"

      "What can't I just open(FH, ">file.lock")?"

      "I still don't get locking.  I just want to increment the 
       number in the file.  How can I do this?"


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 19 Feb 1999 08:03:04 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: String Manipulation (yet another newbie question)
Message-Id: <ouqja7.44h.ln@magna.metronet.com>

Larry Rosler (lr@hpl.hp.com) wrote:
: In article <36d142b5.7839445@news.skynet.be> on Thu, 18 Feb 1999 
: 16:59:35 GMT, Bart Lateur <bart.lateur@skynet.be> says...
: > Uri Guttman wrote:
: > 
: > >  TM>    index($field, '_1') >= $[
: > >
: > >the use of $[ is deprecated. you shouldn't rely on its existance. perl
: > >uses zero based indexing for arrays and strings.
: > 
: > !!!
: > 
: > I think it should exist FOREVER. Backward compatibilityn, you know the
: > drill. It is deprecated to *change* it, however. You preferably should
: > always use the default value for it (= 0).

: Agreed.  And that's why I think that Tad McClellan's using $[ to answer 
: a simple post (instead of just 0, as I did earlier :-) is pointless 
: pedantry and potentially misleading.
                           ^^^
                           ^^^

   Actually I meant it to be _leading_.

   In the spirit of learning to fish vs. giving a fish, I figured
   a reader that was not aware of $[ would say "Huh?".

   The thinking reaction to "Huh?" is to check the docs, either
   $[ in perlvar or index() in perlfunc.

   Either place would point out that you shouldn't be changing $[.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 19 Feb 1999 13:31:56 GMT
From: kenr@troi.cc.rochester.edu (Ken Rich)
Subject: system usage accounting system wanted
Message-Id: <7ajp4c$2dd14@biko.cc.rochester.edu>

I am looking for Unix system usage accounting packages to look at.  So
far I have only found Unisol JobAcct, which looks pretty good except it
uses oracle under the hood.  I sure would love to have competing
products to compare it with.  someone has a (even homegrown) perly
system accounting package, I'm interested in looking at it.

Thanks.

--
-ken rich                                     kenr@troi.cc.rochester.edu


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

Date: Fri, 19 Feb 99 14:20:33
From: henry@solcom.co.uk
Subject: unpack
Message-Id: <NEWTNews.919435132.1622.henry@procrusteus.solcom.co.uk>


Is it possible to use unpack to unpack different bits of
a byte into different variables?

Or does each new element of the format imply moving on to new byte?

I thought that for instancewould
  ($upper6bits, $lower2bits) = unpack('B6B2', $somedata)

would extract the upper six bits of the first byte of somedata
into upper6bits, and the lower two bits of the first byte of
somedata into lower2bits.
But it doesn't behave as I expect - lower2bits is set to the
upper two bits of the second byte of somedata.

Does one  have to shift and mask to extract bit fields from bytes
or is there a Perl way of doing it?

Thanks

Henry





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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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