[10810] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4411 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 12 21:07:22 1998

Date: Sat, 12 Dec 98 18:00:19 -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           Sat, 12 Dec 1998     Volume: 8 Number: 4411

Today's topics:
    Re: 80 column conversion (Jaya_Kanajan)
    Re: A push in the right direction - Perl :c) <gellyfish@btinternet.com>
    Re: Comparing times and dates <rra@stanford.edu>
    Re: ls -l in perl? (Tad McClellan)
    Re: LWP problem/question <chobbs@silvervalley.k12.ca.us>
        memory usage (Boson)
    Re: memory usage (Ilya Zakharevich)
    Re: Multidimentional arays??? (Matthew Bafford)
    Re: Multidimentional arays??? (Matthew Bafford)
    Re: Multidimentional arays??? (Mark-Jason Dominus)
    Re: Perl and Zip dturley@pobox.com
        Question on Skalars & Arrays (Papick Garcia Taboada)
    Re: Question on Skalars & Arrays (Mark-Jason Dominus)
    Re: socket question: to wait or not to wait <spamsux-tex@habit.com>
    Re: Sorting problem: Is there a better way? (Helmut Richter)
    Re: using system() command in perl/cgi script running u <palincss@tidalwave.net>
        Wanted: Any app what use WebFS::FileCopy.pm (Tibor Lorincz)
    Re: Why Is Perl not a Language? (Bart Lateur)
        Writing Perl with Notepad <evanp@technologist.com>
    Re: Writing Perl with Notepad (Matthew Bafford)
    Re: Writing Perl with Notepad <evanp@technologist.com>
    Re: Writing Perl with Notepad (Kazzasher2)
    Re: Writing Perl with Notepad <rick.delaney@home.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 13 Dec 1998 01:07:14 GMT
From: jkanajan@ets.cis.brown.edu (Jaya_Kanajan)
Subject: Re: 80 column conversion
Message-Id: <74v402$ggj@cocoa.brown.edu>


Thanks everyone for your suggestions. I ended up using Text::Wrap as suggested.
 Since the purpose I am using it for does not have words longer than 80 columns
 I figured this would be fine. (I am interested though in Text::Format. Is it 
capable of the same result without the similar problem with long words?)


The script I was writing was intended to take source code,pseudo code in C,
Matlab,python,perl, etc and then generate very simple low level LaTeX for 
inclusion in reports.

Right now, I wanted to add in some more features but I coudn't think of a 
clean way of doing so. The way I did it, I while through the entire source 
file and wrap >80 column lines. However, some source code comes from PC's and 
also some are pseudo code so they have annoying large ammounts of whitespace
 which looks bad in a report. I would like to add something to my code that 
will take any sequence of greater then three carriage returns/newlines and 
replace it with a single newline. The problem is, the fact that I use a while 
to go through the input file makes it messy to do a counter for the newlines. 
Is there a cleaner way to do this?


Any comments suggestions greatly appreciated.

Thanks,
jaya

Here's what I ended up with:

---BEGIN_CODE---
#!/usr/local/bin/perl -w

use Text::Wrap;

$outfile = $ARGV[-1]; #last argument
$infile = $ARGV[-2]; #one before last argument

open(CODE,"<$infile") || die "'$infile' not openable";
open(OUT,">$outfile") || die "'$outfile' not openable";
$infile =~ s/\_/\\\_/; # quote any a underscore in the filename for LaTeX use.
print OUT "{\\centerline{\\underline{\\bf{$infile}}}\\small\n\\begin{verbatim}\n
";

while (<CODE>) {
    print OUT wrap("",'',$_);
}


print OUT "\n\\end{verbatim}\n\n}\n";
close(CODE);
close(OUT);
---END_CODE---


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

Date: 12 Dec 1998 23:33:46 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: A push in the right direction - Perl :c)
Message-Id: <74uugq$1ki$1@gellyfish.btinternet.com>

On Fri, 11 Dec 1998 16:03:22 -0500 Tommie N. Carter <tcarter@tiac.net> wrote:
> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>

Hmm ... there is either something wrong with your client or there is 
something wrong with mine - now although your message does show a correct
content type for this it doesnt have an alternative text rendering so I
guess it must be yours ... anyhow fix it please becuae it does *confuse*
my client big time.  Oh well lets get on.

> Hi all,
> I'm new to perl and I've read through many of the messages so I hope
> I'm not treading water here.&nbsp; I want to create a perl script admin
> tool that let's me issue system calls using a form and passing the results
> of my system calls back to the web page.&nbsp; The overall result is to
> create a simulated shell using my browser.&nbsp; I'm hopeful I'll be able
> to use this as an administrative tool to access my http web site...

I really dont think that you want to do this without some very careful
thought - I hope that you realise how much of a security hole this could be.

Essentially what you want to do is simple however,  you can create a program
that simply takes the input from some text input form element and runs that
using the backtick operator - the following is an example that is basically
as secure as insecure can be and I dont want to be held responsible for any
harm that may be done as a result of its use :


#!/usr/bin/perl

use CGI;

$query = new CGI;

print $query->header,
      $query->start_html,"\n";
if ( $query->request_method eq "GET" )
  {
    print <<ERBLABLA;
     <form method='post' action='doshell.pl'>
       <input name='stuff' type='text'>
       <input type='submit'>
     </form>
ERBLABLA
   }
else
  {
    $command = $query->param('stuff');
    chomp($command);
    $output = `$command`;
    print "<PRE>$output</PRE>\n";
  }

print $query->end_html;
__END__

That said if you want to be doing administrative tasks through CGI you really
want to limit the commands that are possible to be executed possibly by using
other form elements to control those functions than text fields.  You should
really try to avoid at all costs allowing user input anywhere near a shell
and using the backticks with a form parameter like that is one sure way of
letting this happen.


Have fun

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 12 Dec 1998 17:05:06 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Comparing times and dates
Message-Id: <yliufgzwal.fsf@windlord.stanford.edu>

Asbjorn Gjemmestad <agjemmes@extremeonline.com> writes:

> I am trying to create a Perl script that will do the following:

> - Read a timeand date variable from a data file (the time HAS to be a
> single variable!)

> - Read the current time and date, and translate it into the same format
> as the time read from the data file.

> - Compare the current time/date with the time/date from the data file,
> and see how long time there is between them (minutes, hours, days,
> months).

> - Based on wether or not it is is more than x hours/days/months between
> the two occurences, a sub procedure is executed.

You want either Date::Parse or Date::Manip.  To find either module, see
CPAN (Date::Parse is part of the TimeDate distribution).  They'll do the
date manipulations for you.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Sat, 12 Dec 1998 07:56:13 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: ls -l in perl?
Message-Id: <tlst47.tic.ln@magna.metronet.com>

Matthew Bafford (dragons@scescape.net) wrote:
: In article <uiufi21vv.fsf@server3.symmetrycomm.com>, kin@symmetrycomm.com 
: says...
: => Does someone has some handy code sniplets to emulate a "ls -l"
: => listing purely in Perl?
: => 
: => Or is there perhaps a LS module?
: => 
: => I did check out Find and find.pl etc....

: If there is one, it (sh|w)ould be listed at:

:      http://www.perl.com/CPAN/CPAN.html

: Or, if that doesn't work out, you could roll your own using a combination 
: of stat, opendir, readdir, and closedir (and of course print).

: And, when you are done, you could submit the module! :)



   It's not a module, but here is a reasonable approximation
   as a program:


--------------------------------------
#!/usr/bin/perl -w
# myls - approximation of 'ls -l -L'

# from the man page for: ls - GNU fileutils-3.13
#
# -l, --format=long, --format=verbose
#
# In  addition  to  the  name of each file, print the
# file type, permissions, number of hard links, owner
# name, group name, size in bytes, and timestamp (the
# modification time unless other times are selected).
# For  files  with  a time that is more than 6 months
# old or more than 1 hour into the future, the times-
# tamp  contains the year instead of the time of day.
#
#
# -L, --dereference
#
# List the files linked to by symbolic links  instead
# of listing the contents of the links.
#



use strict;


push @ARGV, '.' unless @ARGV;          # default to current directory

my $show_dnames = @ARGV > 1 ? 1 : 0;   # show dir names if more than one

my @mon = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);

my $now = time();


my $dname;
my @files;
while ($dname = shift) {

   print "$dname:\n" if $show_dnames;

   # grab all the non-dot filenames
   opendir(DIR, $dname) || die "could not open '$dname'  $!";
   @files = sort grep /^[^.]/, readdir DIR;
   closedir(DIR);

   my $total_blocks=0;
   my @out;
   foreach my $fname (@files) {

      my (undef,undef,$mode,$nlink,$uid,$gid,undef,$size,
          undef,$mtime, undef, undef, $blocks) = stat("$dname/$fname");

      $total_blocks += $blocks;

      my $user  = getpwuid($uid);   # convert numbers to names
      my $group  = getgrgid($gid);

      my(undef,$min,$hour,$mday,$mon,$year) = localtime($mtime);

      my $time;
      if ($mtime > $now + 3600 ||                  # an hour in the future
          $mtime < $now - (60 * 60 * 24 * 30 * 6)  # ~about~ six months
         )
         { $time = sprintf "%5d", $year+1900 }
      else
         { $time = sprintf "%02d:%02d", $hour, $min }

      my $modeStr = '?';                               # I dunno
      $modeStr = 'd' if ($mode & 0040000) == 0040000;  # directory
      $modeStr = 'c' if ($mode & 0020000) == 0020000;  # char special
      $modeStr = 'b' if ($mode & 0060000) == 0060000;  # block special
      $modeStr = 'l' if ($mode & 0120000) == 0120000;  # symbolic link
      $modeStr = 's' if ($mode & 0140000) == 0140000;  # socket
      $modeStr = 'p' if ($mode & 0010000) == 0010000;  # fifo
      $modeStr = '-' if ($mode & 0100000) == 0100000;  # regular file

      $modeStr .= rwx(($mode & 0700) >> 6);  # owner
      $modeStr .= rwx(($mode & 0070) >> 3);  # group
      $modeStr .= rwx(($mode & 0007) >> 0);  # others


      push(@out,
      sprintf "%10s %3u %-8.8s %-8.8s %8d %3s %2d %s %s\n",
              $modeStr, $nlink, $user, $group, $size, 
              $mon[$mon], $mday, $time,
              $fname);
    
   }

   # do the output
   print 'total ', $total_blocks / 2, "\n";
   foreach (@out) {
      print;
   }
   print "\n" if @ARGV;
}



sub rwx {
   my($bits) = @_;

   my $rwx  = ($bits & 4) ? 'r' : '-';
      $rwx .= ($bits & 2) ? 'w' : '-';
      $rwx .= ($bits & 1) ? 'x' : '-';

   return $rwx;
}

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


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


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

Date: Sat, 12 Dec 1998 14:15:02 -0800
From: Chris Hobbs <chobbs@silvervalley.k12.ca.us>
Subject: Re: LWP problem/question
Message-Id: <3672EAE6.16845FFE@silvervalley.k12.ca.us>

I wrote:

> >  1: use strict;
> >  2: use LWP::Simple qw/get/;
> >  3: use CGI qw/:form :html param header/;
> >  4:
> >  5: my $b_and_n_top =
> > "http://shop.barnesandnoble.com/bookSearch/isbnInquiry.asp?isbn=";
> >  6: my $isbn = param("isbn");
> >  7:
> >  8: my $b_and_n_page = get ($b_and_n_top . $isbn);
> >  9: print p("B & N Page should begin here...");
> > 10: print $b_and_n_page; # TEST TO MAKE SURE PAGE IS RETRIEVED!
> > 11: print p("...and it should stop here!");

> > The problem is that line 10 prints only half the time

And then Ronald J Kimball replied:
 
> print will never execute "only half the time".  If sometimes it does not
> give any output, then it must be because it had nothing to print.  In
> other words, $b_and_n_page must be empty at those times.

I should have been more precise in my statement - I did understand
that the page hadn't been retrieved and thus $b_and_n_page was
undefined. Thanks for making it clearer.

> Note that to check the response code from the remote server, you will
> have to use the full LWP interface.

I guess that's what I'll have to do, as I don't have any idea why B
& N's server doesn't send the page every time. It works great from
my browser, and I even hit it with telnet to see if anything looked
odd - it didn't.

Thanks for the pointer - time to read up on the full LWP module.

Chris



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

Date: Sat, 12 Dec 1998 21:38:33 GMT
From: boson@earthlink.net (Boson)
Subject: memory usage
Message-Id: <3672e099.537140028@news.earthlink.net>

I have a quick question. Assume I have a (pretty big) hash called %h.
Is my perl program using less memory if I use the hash as

   foreach (keys \%h) {...}

unstead of the usual (for me) foreach syntax

   foreach (keys %h) {...}


Thanks in advance.

Boson




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

Date: 12 Dec 1998 22:14:25 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: memory usage
Message-Id: <74ups1$rc$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Boson
<boson@earthlink.net>],
who wrote in article <3672e099.537140028@news.earthlink.net>:
> I have a quick question. Assume I have a (pretty big) hash called %h.
> Is my perl program using less memory if I use the hash as
> 
>    foreach (keys \%h) {...}
> 
> unstead of the usual (for me) foreach syntax
> 
>    foreach (keys %h) {...}

Yes.  To save as much memory as you can make this the first statement
of your program.

Ilya


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

Date: Sat, 12 Dec 1998 17:00:58 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Multidimentional arays???
Message-Id: <MPG.10dcb1a31d458b15989759@news.scescape.net>

In article <Pine.GSO.3.96.981212151908.22073B-100000@spain>, 
tlester@spain.iakom.com says...
=> Ever book I have that mentions ultidimentional arrays stat "Beyond the
=> scope of this book".  So I could use some instruction.  Can someone
=> explain how to do it in perl.

You need better books. :)

Woah! Some come free with the Perl dist!

perldoc perlref

:)

=> Just to clarify what I'm wanting to do...  like in C creating an array
=> like:
=> 
=> array[0][1]
=> array[0][2]
=> array[1][0]
=> array[1][1]
=> etc...

In this case:

#!/usr/bin/perl -w
use strict;

my @array;

$array[0][0] = "|0|0|";
$array[0][1] = "|0|1|";
$array[0][2] = "|0|2|";
$array[1][0] = "|1|0|";
$array[1][1] = "|1|1|";

print "Method 1:\n";

print "$array[0][0]\n";
print "$array[0][1]\n";
print "$array[0][2]\n";
print "$array[1][0]\n";
print "$array[1][1]\n";

print "\nMethod 2:\n";

foreach my $arrayref ( @array ) {
    foreach ( @{$arrayref} ) {
        print "$_\n";
    }
}
__END__
Method 1:
|0|0|
|0|1|
|0|2|
|1|0|
|1|1|

Method 2:
|0|0|
|0|1|
|0|2|
|1|0|
|1|1|


=> Thanks,

HTH!

=> Thomas

--Matthew

-- 
PS: Please us a sigline like the one above (ie: two
dashes and a space on a line by it's self).  Thanks!


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

Date: Sat, 12 Dec 1998 17:12:09 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Multidimentional arays???
Message-Id: <MPG.10dcb4404d26438b98975a@news.scescape.net>

In article <3672E3AE.5358FBF6@catnmoose.com>, marty@catnmoose.com says...

[snip]

=>  @win[0] = [0,1,2];    # these are row wins
=>  @win[1] = [3,4,5];
=>  @win[2] = [6,7,8];
=>  @win[3] = [0,3,6];    # columnar wins
=>  @win[4] = [1,4,7];
=>  @win[5] = [2,5,8];
=>  @win[6] = [0,4,8];    # diagonal wins
=>  @win[7] = [2,4,6];

[snip]

Scalar value @win[0] better written as $win[0] at - line 5.
Scalar value @win[1] better written as $win[1] at - line 6.
Scalar value @win[2] better written as $win[2] at - line 7.
Scalar value @win[3] better written as $win[3] at - line 8.
Scalar value @win[4] better written as $win[4] at - line 9.
Scalar value @win[5] better written as $win[5] at - line 10.
Scalar value @win[6] better written as $win[6] at - line 11.
Scalar value @win[7] better written as $win[7] at - line 12.

I smell the odor of a '-w'-less script... :)

--Matthew


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

Date: 12 Dec 1998 20:37:23 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Multidimentional arays???
Message-Id: <74v5oj$6qv$1@monet.op.net>

In article <Pine.GSO.3.96.981212151908.22073B-100000@spain>,
Thomas Lester  <tlester@spain.iakom.com> wrote:
>Ever book I have that mentions ultidimentional arrays stat "Beyond the
>scope of this book".  So I could use some instruction.  Can someone
>explain how to do it in perl.

A short article that explains this is at

	http://www.plover.com/~mjd/perl/FAQs/references.html



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

Date: Sun, 13 Dec 1998 00:59:00 GMT
From: dturley@pobox.com
Subject: Re: Perl and Zip
Message-Id: <74v3gj$nd9$1@nnrp1.dejanews.com>

In article <36717d61.609910596@news1.alterdial.uu.net>,
  beimer@uu.net wrote:
>
> Are there any Perl modules that provide an interface to Zip and Unzip
> functions?  Or does anyone have any good routines for handling Zip and
> Unzip files.

zip is (usually) a windoze utility. However, I did have a customer who
insisted on zipping files on a unix server. We installed a unix port of zip
and use dit like this:

my $zip_path = '/usr/local/bin/zip';
my $outFile = 'file.zip';
my $inFile = 'file.txt';
my @args = ("$zip_path", "$outFile", "$inFile");
my $rc = system(@args);

error checking, etc. cost extra. :-)
____________________________________
David Turley
dturley@pobox.com
http://www.binary.net/dturley/

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


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

Date: Sun, 13 Dec 1998 01:07:17 GMT
From: papick.taboada@gmx.net (Papick Garcia Taboada)
Subject: Question on Skalars & Arrays
Message-Id: <36731147.82355000@news.inka.de>

Hi!

I am new to perl and I was wondering how to do the 
following tasks:

1) I normaly split an \t formatted line this way:
	( $f1, $f2, $f3) = split( /\t/ ,  $myRecordLine );
    By now I only have those three fields, but I am sure
    that tommorow there could be 5 or 6...
    So, I thought, it would be nice if I could store the left
    side if the assignment into an skalar, like:
    $myStructure = '( $f1, $f2, $f3)';
    Is there any way use $myStructure instead of the ( $f1, ... )???
    Somethig like @$?!myStructure = split(....);

2) Somewhere I define 
        $sortoder = "firstname";
     Somewhere else I whant to get the contents of the skalar 
     refered to by $sortorder, like:
      $curSearchKeyValue = givemewhatisin( $sortorder );

Are this things possible?

brgds

Papick

 
----------------------------------------
papick.taboada@gmx.net
http://www.uni-karlsruhe.de/~Papick.Taboada


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

Date: 12 Dec 1998 20:35:07 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Question on Skalars & Arrays
Message-Id: <74v5kb$6n2$1@monet.op.net>

In article <36731147.82355000@news.inka.de>,
Papick Garcia Taboada <papick.taboada@gmx.net> wrote:
>1) I normaly split an \t formatted line this way:
>	( $f1, $f2, $f3) = split( /\t/ ,  $myRecordLine );
>    By now I only have those three fields, but I am sure
>    that tommorow there could be 5 or 6...

Use

	@f = split( /\t/, $myRecordLine );

Then the fields are in $f[0], $f[1], etc.
To find out how many fields, use:

	$numberOfFields = @f;


>2) Somewhere I define 
>        $sortoder = "firstname";
>     Somewhere else I whant to get the contents of the skalar 
>     refered to by $sortorder, like:
>      $curSearchKeyValue = givemewhatisin( $sortorder );

$$sortorder will get the contents of $firstname.
But it is probably better to  use a hash for this application.


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

Date: Sat, 12 Dec 1998 17:08:47 +0000
From: Austin Schutz <spamsux-tex@habit.com>
Subject: Re: socket question: to wait or not to wait
Message-Id: <3672A31F.1AC7@habit.com>

> figure out how the client process can check, without pending for input,  if
> there is anything in the input socket.  If there is something in the socket,
> the client process reads it.  If not, the client process continues its
> execution.
> 

	Hmm.. you might try 'select'ing a function that would do that for you.
	Couldn't help myself, sorry.
	
	Try perldoc perlfunc, look for 'select'.

	Austin


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

Date: 12 Dec 1998 22:21:29 GMT
From: Helmut.Richter@lrz-muenchen.de (Helmut Richter)
Subject: Re: Sorting problem: Is there a better way?
Message-Id: <74uq99$iod$1@sparcserver.lrz-muenchen.de>

"Allan M. Due" <Allan@Due.net> writes:

>Tad McClellan wrote in message ...
>>Erik de Castro Lopo (please@see.sig) wrote:
>>
>>: I've got a list of items which are all of the form
>>: of one or more alpahbetic charaters followed by
>>: one or more digits and I need to sort them. The
>>: sorting should be done on the alphabetic part
>>: first. If there are two list items with the same
>>: alphabetic part they should be ordered on the basis
>>: of the size of the numeric part.

Does the following code what you want:

@sorted = sort collat @unsorted;

where collat is defined as follows:

sub collat0 {
  # replace all characters by lower case characters, hyphens, and digits
  local ($x) = $_[0];
  $x =~ tr/\200-\253\256\260-\377\254\255\257/\000-\037 !c??Y|?"ca<R ?23\047uP.,1o>????AAAAAAACEEEEIIIIDNOOOOOxOUUUUYTsaaaaaaaceeeeiiiidnooooo:ouuuuyty-/;
  $x =~ tr/0-9A-Za-z/-/cs;
  $x =~ tr/A-Z/a-z/;
  if ($x =~ /^-/) {
    return $';
  } else {
    return $x;
  };
}

sub collat1 {
  # like collat0 but care about groups of digits
  local ($x) = &collat0 ($_[0]);
  $x =~ s/(\d+)/'.'.chr(length($1)).$1/ge;
  return $x;
}

sub collat { &collat1 ($a) cmp &collat1 ($b) }


It does what you want and some more, e.g. cope with upper case and lower
case letters, make a reasonable substitution for international ISO 8859-1
letters and so on. collat0 is just the collating sequence itself;  collat1
prefixes each group of digits with a single character indicating its
length. So "abc11" comes after "abc9" but "abc008" comes after both of
them. In most cases this is what you want although it does not exactly
conform to your specification.

The difference between "collat0" and "collat1" has been made because
"collat0" is at the same time a nice procedure to generate admissible file
names from arbitrary strings.

Helmut Richter



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

Date: Sat, 12 Dec 1998 16:42:18 -0500
From: Steve Palincsar <palincss@tidalwave.net>
Subject: Re: using system() command in perl/cgi script running under Linux
Message-Id: <3672E33A.AF3B4663@tidalwave.net>

Odds are, your web server is running as user "nobody" and has a
very limited path.  Does that user have rights to run pgp?  Are
you specifying a full path to the executable?   I have no idea
what pgp looks like when it runs, but if it emits some kind of
text have you tried running it in backtics and examining its
output to see if it actually ran at all?


Liew Fook Sin wrote:
> 
> Hi,
> 
> I am suppose to decrypt a series of files in a particular directory
> automatically using a perl/cgi script.
> By the way the files are all encrypted using pgp.
> 
> I have use the system() command to perform this task in
> a perl/cgi script as pgp commands need to be embed inside
> my script.
> 
> My problem is when the script is run manually, it works fine but
> when it is called via a URL from a HTML form., the script runs
> without error but the commands in the system() simply is not
> executed.
> 
> Can somebody please tell what is wrong and how can this be
> done. Thank you.
> 
> liew
> malaysia


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

Date: 12 Dec 1998 23:53:11 GMT
From: clt@kiss.sk (Tibor Lorincz)
Subject: Wanted: Any app what use WebFS::FileCopy.pm
Message-Id: <74uvl7$bdv$1@news.entry.sk>

Hello all...

I looking for a any GPLed CGI-script what use WebFS::FileCopy.pm module.
(or any other non-CGI app using WebFS)

Can anybody drop me an any pointer?

thanx,
regards,
tibor 


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

Date: Sat, 12 Dec 1998 23:38:17 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Why Is Perl not a Language?
Message-Id: <3673fe51.2162232@news.skynet.be>

Craig Berry wrote:

>  1) no user interface
>
>As opposed to what?  C? :)  What do you mean by a language "having" a UI?

Urm... Make that a difference between a "program" and a "script".

*My* Perl "programs" usually don't have a user interface. Just a command
line. Most of them serve to process/convert files. Compare that to, say,
a spreadsheet program.

Therefore, a "CGI program" is a bit of a contradiction in terms. Even if
written in C.

	Bart.


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

Date: Sat, 12 Dec 1998 19:37:32 -0500
From: Evan Panagiotopoulos <evanp@technologist.com>
Subject: Writing Perl with Notepad
Message-Id: <36730C4B.D0A1B217@technologist.com>

This is a multi-part message in MIME format.
--------------31C935D452E45C802F4A6D88
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I have no problems writing Perl scripts with vi.  Yesterday though, I
tried to write a script with Notepad but after I saved it on Linux and
tried to execute it gave me an error complaining about linefeeds or
something like that.  Can I use Notepad or different windows editor
for script writing? I have a class of high school students and using
vi is like pulling teeth.

Thanks,

--------------31C935D452E45C802F4A6D88
Content-Type: text/x-vcard; charset=us-ascii;
 name="evanp.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Evan Panagiotopoulos
Content-Disposition: attachment;
 filename="evanp.vcf"

begin:vcard 
n:Panagiotopoulos;Evan
tel;fax:(914) 457-4056
tel;home:Home Sweet Home
tel;work:Valley Central High School (914) 457-3122
x-mozilla-html:TRUE
org:Valley Central High School;Mathematics Department
adr:;;;;;;
version:2.1
email;internet:evanp@technologist.com
title:Computer Teacher
fn:Evan Panagiotopoulos
end:vcard

--------------31C935D452E45C802F4A6D88--



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

Date: Sat, 12 Dec 1998 19:58:37 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Writing Perl with Notepad
Message-Id: <MPG.10dcdb4495d3713d98975b@news.scescape.net>

In article <36730C4B.D0A1B217@technologist.com>, evanp@technologist.com 
says...
=> This is a multi-part message in MIME format.
=> --------------31C935D452E45C802F4A6D88
=> Content-Type: text/plain; charset=us-ascii
=> Content-Transfer-Encoding: 7bit

Please don't do that.

=> I have no problems writing Perl scripts with vi.  Yesterday though, I
=> tried to write a script with Notepad but after I saved it on Linux and
=> tried to execute it gave me an error complaining about linefeeds or
=> something like that.  Can I use Notepad or different windows editor

Something like that?

=> for script writing? I have a class of high school students and using
=> vi is like pulling teeth.

Sure.  You have to watch for (at least) two things when using a windows 
editor:

1) Make sure the line endings are 'fixed'.
2) Make sure the last line, if the last line of a format or of a here-  
   doc, has a blank line after it.

To get the proper line endings, either transfer as ASCII (when FTPing the 
file).

Or:

Do a

perl -i -pe 'tr/\r//d;' files

from the Linux prompt.

=> --------------31C935D452E45C802F4A6D88
[snip VCARD]

Please don't do that, either.

=> Thanks,

HTH!

--Matthew


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

Date: Sat, 12 Dec 1998 20:22:53 -0500
From: Evan Panagiotopoulos <evanp@technologist.com>
To: Matthew Bafford <dragons@scescape.net>
Subject: Re: Writing Perl with Notepad
Message-Id: <367316ED.C44079EE@technologist.com>

This is a multi-part message in MIME format.
--------------61283E92AA214E1434C19D4B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Thanks for the quick reply.  Can I have the first line of the script as
#!/usr/bin/perl -i -pe 'tr/\r//d;'  ?
Now that the $PATH has been established for all students is there an
alternative to automating the line command?

Thanks,
Evan Panagiotopoulos


Matthew Bafford wrote:

> In article <36730C4B.D0A1B217@technologist.com>, evanp@technologist.com
> says...
> => This is a multi-part message in MIME format.
> => --------------31C935D452E45C802F4A6D88
> => Content-Type: text/plain; charset=us-ascii
> => Content-Transfer-Encoding: 7bit
>
> Please don't do that.
>
> => I have no problems writing Perl scripts with vi.  Yesterday though, I
> => tried to write a script with Notepad but after I saved it on Linux and
> => tried to execute it gave me an error complaining about linefeeds or
> => something like that.  Can I use Notepad or different windows editor
>
> Something like that?
>
> => for script writing? I have a class of high school students and using
> => vi is like pulling teeth.
>
> Sure.  You have to watch for (at least) two things when using a windows
> editor:
>
> 1) Make sure the line endings are 'fixed'.
> 2) Make sure the last line, if the last line of a format or of a here-
>    doc, has a blank line after it.
>
> To get the proper line endings, either transfer as ASCII (when FTPing the
> file).
>
> Or:
>
> Do a
>
> perl -i -pe 'tr/\r//d;' files
>
> from the Linux prompt.
>

--------------61283E92AA214E1434C19D4B
Content-Type: text/x-vcard; charset=us-ascii;
 name="evanp.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Evan Panagiotopoulos
Content-Disposition: attachment;
 filename="evanp.vcf"

begin:vcard 
n:Panagiotopoulos;Evan
tel;fax:(914) 457-4056
tel;home:Home Sweet Home
tel;work:Valley Central High School (914) 457-3122
x-mozilla-html:TRUE
org:Valley Central High School;Mathematics Department
adr:;;;;;;
version:2.1
email;internet:evanp@technologist.com
title:Computer Teacher
fn:Evan Panagiotopoulos
end:vcard

--------------61283E92AA214E1434C19D4B--



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

Date: 13 Dec 1998 01:48:39 GMT
From: kazzasher2@aol.com (Kazzasher2)
Subject: Re: Writing Perl with Notepad
Message-Id: <19981212204839.15584.00002315@ng-fi1.aol.com>

=> for script writing? I have a class of high school students and using
=> vi is like pulling teeth.

or even better, get a copy of UltraEdit,
a windows based text editor specifically 
designed for perl, html etc. 
Absolutely awesome with many features.

www.ultraedit.com


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

Date: Sun, 13 Dec 1998 01:56:23 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Writing Perl with Notepad
Message-Id: <36732082.40A40409@home.com>

[posted & mailed]

Evan Panagiotopoulos wrote:
> 
> Can I have the first line of the script as
> #!/usr/bin/perl -i -pe 'tr/\r//d;'  ?

No.

> Now that the $PATH has been established for all students is there an
> alternative to automating the line command?
> 

You might want to get your class a better editor.  I will not recommend
one in particular or this thread may never end.  Try this resource:

    http://reference.perl.com/query.cgi?editors

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

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

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