[17791] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5211 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 28 09:05:39 2000

Date: Thu, 28 Dec 2000 06:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <978012308-v9-i5211@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 28 Dec 2000     Volume: 9 Number: 5211

Today's topics:
    Re: Choose which DBM by trial and error? (Anno Siegel)
    Re: Code Review? (Garry Williams)
    Re: Code Review? (Colin Watson)
    Re: DBIProxy question (Honza Pazdziora)
    Re: FAQ 6.21:   What's wrong with using grep or map in  <bart.lateur@skynet.be>
    Re: Free win32 Perl IDE+easiest way to start learning P <bart.lateur@skynet.be>
    Re: Free win32 Perl IDE+easiest way to start learning P <samuel@knm-e.se>
    Re: just SELECT * from MSSQL 7.0 ?? <toughiq@i-one.at>
    Re: Language evolution C->Perl->C++->Java->Python (Is P <pulsar@qks.com>
        Newbie Q:Error 1067 on Win2k <jeremyfung@sina.com>
    Re: Newbie Q:Error 1067 on Win2k (Martien Verbruggen)
        Novice: problem with variables <rvdzant@planet.nl>
    Re: Novice: problem with variables nobull@mail.com
    Re: Open a big text file ( large than 200MB ) ghorghor@my-deja.com
    Re: Piping output from one script into another (Anno Siegel)
    Re: Piping output from one script into another (Colin Watson)
    Re: References (I'm not sure if the old message posted) <bart.lateur@skynet.be>
        Saving uploaded files w/CGI.pm -- Linux works great, Wi <micah@absolutely.geeks4christ.noorgspam!>
    Re: Saving uploaded files w/CGI.pm -- Linux works great nobull@mail.com
        Upload multi files with same source martinnitram@my-deja.com
        URL Testing Routine Problem usctjd02@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 28 Dec 2000 12:42:35 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Choose which DBM by trial and error?
Message-Id: <92fcfr$5eb$2@mamenchi.zrz.TU-Berlin.DE>

Abigail <abigail@foad.org> wrote in comp.lang.perl.misc:
>Ronald Schmidt (RonaldWS@software-path.com) wrote on MMDCLXXIV September
>MCMXCIII in <URL:news:3A480758.A8DF8355@software-path.com>:
>`` I am working on a programming that will try to deal with DBMs
>`` generically.  I want a user to be able to address a DBM file, preferably
>`` without the need for the user to specify which kind of DBM file it is
>`` (DB_File or NDBM_File etc.)  Is it safe to approach this by trying to
>`` tie the file O_RDONLY with several different DBM packages and see which
>`` one gives a good return value from tie?  If tie gives a good return code
>`` O_RDONLY will it then be safe to tie the file name for read/write and do
>`` updates?  I have appended some sample code to illustrate the question.
>
>
>You want to use AnyDBM_File.

Probably not.  AnyDBM_File makes no attempt at discovering the type
of database it is offered.  All it does is find the first installed
DB module and set @ISA accordingly.

Recognizing a db by trial and error may be workable, but it's certainly
not entirely safe.  Other heuristics may include: Is there only one
database file name.db?  Or are there two: name.dir and name.pag?
If you're running under Unix, can the file command identify the db?

Anno


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

Date: Thu, 28 Dec 2000 08:08:43 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: Code Review?
Message-Id: <fyC26.135$ld.15081@eagle.america.net>

On 28 Dec 2000 02:02:52 GMT, Colin Watson <cjw44@flatline.org.uk> wrote:
>Arcana <emerald-arcana@home.com> wrote:
>
>>            $pdata{"name"} = $_;
>
>Style nit: no need to quote hash keys if they're just words.

Hmmm.  I wonder if that's good advice?  

  $ perl -wle '$x{"time"} = "Hello, world";print $x{time}'
  Ambiguous use of {time} resolved to {"time"} at -e line 1.
  Hello, world
  $ perl -v

  This is perl, version 5.004_04 built for sun4-solaris

  $ perl -wle '$x{"time"} = "Hello, world";print $x{time}'
  Hello, world
  $ perl -v

  This is perl, v5.6.0 built for sun4-solaris

I guess that depends on what release of perl you're using.  (I don't
know when this was changed, though.  I couldn't find it in the
perldelta manual page for 5.6.0.)  

-- 
Garry Williams


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

Date: 28 Dec 2000 12:29:15 GMT
From: cjw44@flatline.org.uk (Colin Watson)
Subject: Re: Code Review?
Message-Id: <92fbmr$ukg$1@riva.ucam.org>

Garry Williams <garry@zvolve.com> wrote:
>On 28 Dec 2000 02:02:52 GMT, Colin Watson <cjw44@flatline.org.uk> wrote:
>>Style nit: no need to quote hash keys if they're just words.
>
>Hmmm.  I wonder if that's good advice?  
>
>  $ perl -wle '$x{"time"} = "Hello, world";print $x{time}'
>  Ambiguous use of {time} resolved to {"time"} at -e line 1.
>  Hello, world
>  $ perl -v
>
>  This is perl, version 5.004_04 built for sun4-solaris

Interesting:

  $ perl-5.004 -v | grep This   
  This is perl, version 5.004_05 built for i386-linux
  $ perl-5.004 -wle '$x{"time"} = "Hello, world";print $x{time}'
  Hello, world
  $ perl-5.005 -v | grep This
  This is perl, version 5.005_03 built for i386-linux
  $ perl-5.005 -wle '$x{"time"} = "Hello, world";print $x{time}'
  Hello, world
  $ perl-5.6 -v | grep This
  This is perl, v5.6.0 built for i386-linux
  $ perl-5.6 -wle '$x{"time"} = "Hello, world";print $x{time}'
  Hello, world

I haven't been around long enough to know when this might have been
changed, though. Of course, since 'time' is a function, it's probably a
good idea to quote that particular word just in case.

-- 
Colin Watson                                     [cjw44@flatline.org.uk]
"Alas, alas poor Willie, we'll hear his voice no more.
 What he took for H2O was H2SO4" - Ruthless Rhymes for Heartless Homes


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

Date: Mon, 25 Dec 2000 18:54:35 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: DBIProxy question
Message-Id: <slrn94f5t7.9k9p8.adelton@aisa.fi.muni.cz>

On Sat, 23 Dec 2000 18:09:23 -0800, news <loy_x@yahoo.com> wrote:

> > Does the single mode work, for a start?

[ I've fixed your ordering. ]

> Yeah, same error on client side, the following output on
> server(windows/dbiproxy side):
> 
> Sat Dec 23 18:05:15 2000 debug, Server starting in operation mode single
> Sat Dec 23 18:05:15 2000 notice, Server starting
> Sat Dec 23 18:05:15 2000 debug, Writing PID to c:\temp\dbiproxy.pid
> Sat Dec 23 18:05:37 2000 debug, Connection from [myip], port 3863
> Sat Dec 23 18:05:37 2000 debug, Child clone:
> DBI::ProxyServer=HASH(0x1f0c16c)
> 
> Sat Dec 23 18:05:37 2000 debug, New child starting
> (DBI::ProxyServer=HASH(0x1f0c
> 16c)).

Is it OK that new child is started in single mode?

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
   .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------


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

Date: Thu, 28 Dec 2000 10:53:46 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: FAQ 6.21:   What's wrong with using grep or map in a void context?
Message-Id: <0n6m4t43eg45nn8crst0m8n2rjjuv49jbf@4ax.com>

John Lin wrote:

>>That's no way to treat a programming
>>     language, you insensitive scoundrel!
>
>Hey, map and grep, you can save the trouble of building up a return list
>when (not defined wantarray), right?  Don't blame the programmers.

map() and grep() are not loops. They do something to each item, but
theoretically there's no garantee that it will be in the "natural"
order. Execution order might just as well be shuffled.

I blame the programmers for expecting grep and map to behave like a
loop.

p.s. If you want to avoid building a list, use grep() with a false (0)
at the end of the block.

	@a = 1 .. 10;
	grep { $_ &= -2; 0 } @a;
	print "@a\n";

I wonder if that extra stament isn't just more overhead than just
building the list. For short source lists.

-- 
	Bart.


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

Date: Thu, 28 Dec 2000 11:05:59 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Free win32 Perl IDE+easiest way to start learning Perl
Message-Id: <597m4t4ioa98okr8tucvhp4jqku865t4kc@4ax.com>

Neerav wrote:

>I Also, I would appreciate it if someone could tell me
[...]
> how Perl works is it eg: compiled like C++ or
>interpreted on the fly by a web browser or what?

Perl scripts are saved as source. When running a script, it is first
compiled into something like bytecode, and then this compiled script is
executed. No, it's not quite the ame as with C++. It's not executed by a
browser either: it is executed by the perl interpreter, an executable of
roughly 600k (depending on your platform). In the case of CGI scripts,
that executable resides on the server. The script is executed by the
server machine. It is only the output of this script that is sent to
your browser.

As for learning perl: I'd get a decent text editor, one that can run
"external tools", and capture their outputs (STDOUT and STDERR) in
another window. In that case, you can edit a perl script, click on the
"run" menu item or button, and you almost immediately see the result in
a new editor window. No need for a specific Perl IDE, a decent general
"programmer editor" will do.

-- 
	Bart.


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

Date: Thu, 28 Dec 2000 12:24:01 +0100
From: "Samuel Rydén" <samuel@knm-e.se>
Subject: Re: Free win32 Perl IDE+easiest way to start learning Perl
Message-Id: <HqF26.4761$3U5.5035@nntpserver.swip.net>

> As for learning perl: I'd get a decent text editor, one that can run
> "external tools", and capture their outputs (STDOUT and STDERR) in
> another window. In that case, you can edit a perl script, click on the
> "run" menu item or button, and you almost immediately see the result in
> a new editor window. No need for a specific Perl IDE, a decent general
> "programmer editor" will do.

Do you perhaps have one to recommend?


- Samuel




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

Date: Thu, 28 Dec 2000 11:34:05 +0100
From: Christian Tawfik <toughiq@i-one.at>
Subject: Re: just SELECT * from MSSQL 7.0 ??
Message-Id: <2o5m4tgis6kn7q1qs71i9ksj9u9m7ku983@4ax.com>

On 28 Dec 2000 12:08:54 +1100, "Kiel " <taboo@comcen.com.au> wrote:

>
>Christian Tawfik <toughiq@i-one.at> wrote:
>>hi,>
>>i just want to execute a SELECT * in a perl script!
>>
>>perl is running on Solaris 2.6 and a MSSQL 7.0 server should be
>>accessed.
>>
>>is there a possibility without installing DBD::Sybase module?? 
>>(and setting up a workaround to get to this damn MS product?)
>>
>>or is there a direct way to connect to a MSSQL server??


>open a pipe to mssql client.

hi,

this sounds good, but how to open a pipe to the microsoft sql server?
AFAIK this pipe thing works with different jobs, but not to connect to
a foreign host.

and if it works, have i the possibility to customize the SELECT
statement?? (select what from which table)??

thx for your help.

bye chris


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

Date: Thu, 28 Dec 2000 11:05:22 GMT
From: "David Simmons" <pulsar@qks.com>
Subject: Re: Language evolution C->Perl->C++->Java->Python (Is Python the  ULTIMATE oflanguages??)
Message-Id: <S7F26.49677$A06.1468142@news1.frmt1.sfba.home.com>

"Blair McGlashan" <blair@object-arts.com> wrote in message
news:92coer$6dq57$3@ID-50941.news.dfncis.de...
> Dave
>
> You wrote in message
> news:SH_06.26911$A06.980822@news1.frmt1.sfba.home.com...
> > ...
> > I don't know what machine or Smalltalk dialect that was run on.
> >
> > But when I run it on 650MHz Athlon in QKS Smalltalk on the v4 AOS
> Platform.
> >
> > "1000 factorial" takes 24ms (.024s).
>
> On my rather slower laptop machine (a 333 Celeron) Dolphin 4.0 takes
> just 13ms to execute 1000 factorial. This is one of the areas were Dolphin
> is faster than most (if not all) other Smalltalk's. I've always thought it
> could be made a fair bit faster too with a bit of optimization.
>
> > To try something that more fully tests multi-precision and GC
performance
> > try "10000 factorial", which on the same system takes 1257 ms (1.25s).
>
> D4 takes 1371mS to do that on the same 333; still faster (bearing in mind
> relative machine speed), but the other factors you mention (i.e. other
than
> LI arithmetic) are starting to come into play, evening out the difference.
>
> I'm glad there is at least one area of VM design and performance where we
at
> least appear to be ahead of AOS Dave :-).


Blair, thank you for pointing this out. I really hadn't thought about how
fast it ought to be.

I've been so busy on other areas I hadn't really gone in and re-verified the
heuristic feedback system in the garbage collection. And, there have been
quite a few changes since the v4 collector was last tuned a year or so
ago...

When I read your post, the first thing I did was run it on our v3 system
(which a slower than v4) to give me a ballpark reference point for
comparison. The only substantive difference between v3 and v4 for the
factorial test is in garbage collector, the multi-precision code is using
effectively the same algorithms.

The v3 AOS Platform yielded a result of 8ms for "1000 factorial" on the same
hardware versus v4 at 24ms.  So I knew something was up. After a few hours o
f mucking about exploring test cases and monitoring the GC patterns I
discovered two things.

a) The multi-precision numerics libraries in v4 were still calling templated
c++ object constructors that I created during the bootstrapping process --
principally to allow me to create objects at any time independently of the
gc design. These were not only slow but had a number of checks in them
for sanity issues.

b) The gc heuristic feedback system was significantly perturbed. That system
decides when and how to execute various portions of the collector, and
correspondingly, how aggressively to work at keeping memory defragmented
(which results from pinning etc). In other words, I had added some
additional cases for special objects but I had not got around to retuning
the algorithms to account for the impact of those changes.

As I've mentioned in other posts and during presentations, the factorial and
fibonacci cases are really good tests of the GC system. I just had not
realized how significant they are...

I've been busy preparing the system for alpha testing and I had not planned
on performing tuning at this stage. Now that you've prodded me into it,
the system is significantly faster across the board. There is clearly more
refinement I can perform in the heuristics system, but here is what a few
hours of heuristics tuning achieved:

AOS v4 Platform, 650MHz Athlon
 ------------------------------
a) The GC system now requires/consumes less memory during
   various baseline tests.

b) "1000 factorial" takes 4-6ms depending on whether you use the
    cpu's cycle timer, the OS <QueryPerformanceCounter>. The
    <GetThreadTimes> call revealed that it had a accuracy/
    granularity of some ~10ms so it was not valid here.

c) "10000 factorial" takes
    641ms, 633ms, 630ms (cycle timer, perf-timer, thread-times)

d) "100000 fibonacci" takes
    337ms, 337ms, 340ms (cycle timer, perf-timer, thread-times)

e) "1000000 fibonacci" takes.
    3438ms, 3423ms, 3430ms (cycle timer, perf-timer, thread-times)

>
> Regards
>
> Blair
>
> (Both figures are elapsed times measured using the microsecond
> clock/profiling counter)

The updated execution times for "1000 factorial" are about the same as
you're getting for a 333MHz Celeron; assuming the cycle ratios of 650MHz
Athlon vs 333MHz Celeron and assuming the Athlon caches are helping more
than the Celeron.

The performance of "1000 factorial" has improved by a factor of 4-6X.
The performance of "10000 factorial" has improved by a factor of 2X.
The performance of "100000 fibonacci" has improved by a factor of 15X.

Based on my v3 AOS Platform numbers, these are the kind of performance I
would expect. I'm reasonably certain that they might be able to improved by
up to 20% or so with more extensive gc profiling and tuning analysis.

So I'd say that for now anyway, we've gotten two Smalltalk's demonstrating
multi-precision performance that is probably an order of magnitude faster
than Ruby; and a number of orders of magnitude faster than the originally
posted Python.

And I think it is probably a fair guess that it is somewhat representative
of the performance of gc sensitive code on such systems. In other words, I'm
betting the actual numerics calculations are about as fast as they can be.
The actual variants are the GC behavior. It adds confidence that SmallScript
should execute competitively well in its scripting language role.

Again, its hard to compare because we don't know what the original processor
was for those Ruby and Python numbers -- but these are good approximations
assuming a 200MHz cpu for the Ruby and Python tests.

Python (1000 factorial)
------
> It's not very fast though:
>
>     real    0m10.433s
>     user    0m10.104s
>     sys     0m0.033s

Ruby (1000 factorial)
----
> time ruby fact.rb 1000
>
> real    0m0.129s
> user    0m0.086s
> sys     0m0.034s


-- Dave Simmons [www.qks.com / www.smallscript.com]
  "Effectively solving a problem begins with how you express it."





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

Date: Thu, 28 Dec 2000 05:36:50 -0500
From: "Liang Fang" <jeremyfung@sina.com>
Subject: Newbie Q:Error 1067 on Win2k
Message-Id: <92f53s$7h4$1@flotsam.uits.indiana.edu>

HI, all,

I have a problem with my newly installed Apache 1.3.12 on Win2k.
Everytime I try to start the apache service, either by command line
or by GUI service panel, it reports error as follows:
-net start apache

System error 1067.

What's wrong here? What should I do?

Thank you very much!

-lf




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

Date: Thu, 28 Dec 2000 23:04:11 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Newbie Q:Error 1067 on Win2k
Message-Id: <slrn94mb1r.2ud.mgjv@martien.heliotrope.home>

On Thu, 28 Dec 2000 05:36:50 -0500,
	Liang Fang <jeremyfung@sina.com> wrote:
> HI, all,
> 
> I have a problem with my newly installed Apache 1.3.12 on Win2k.
> Everytime I try to start the apache service, either by command line
> or by GUI service panel, it reports error as follows:
> -net start apache
> 
> System error 1067.
> 
> What's wrong here? What should I do?

You should post this question to a group where they talk about the
apache server, or maybe Windows 2000. Not to a group where they talk
about the Perl programming language.

> Thank you very much!

No problem.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd.   | from a rich salesperson.
NSW, Australia                  | 


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

Date: Wed, 27 Dec 2000 02:14:35 +0100
From: "R.C. van der Zant" <rvdzant@planet.nl>
Subject: Novice: problem with variables
Message-Id: <3A49427B.C6756A6E@planet.nl>

Hi, hope somebody will take a pity on me and help me with the following
problem :


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

use DBI;
use CGI;
use CGI::Carp(fatalsToBrowser);

use vars qw($CGI $PWD $SVN $USN);

$SVN = "<some Oracle SQL*Net connection descriptor>";

$CGI = new CGI();

if ($CGI->param("login_db"))
{
  $USN=$CGI->param("username");
  $PWD=$CGI->param("password");
  disp_owner_screen($CGI,"Object owner selection",$USN,$PWD);
#
# Right until the end of subroutine : disp_owner_screen, 
# variables : $USN and $PWD have their (correct) value.
#
}
elsif ($CGI->param("show_objects"))
{
#
# Here they have vanished into "thin air". They are no longer defined.
# Is there any way to 'retain' the variables (and their value(s)) ?
# Thanks in advance for your suggestion(s)/help.
#
  debug_to_file("BEFORE \: disp_objects_screen",$USN,$PWD);
  disp_objects_screen($CGI,"Object information",$USN,$PWD);
  debug_to_file("AFTER \: disp_objects_screen",$USN,$PWD);
}
else
{
  disp_main_screen($CGI);
}


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

Date: 28 Dec 2000 13:16:00 +0000
From: nobull@mail.com
Subject: Re: Novice: problem with variables
Message-Id: <u9lmt07kkv.fsf@wcl-l.bham.ac.uk>

"R.C. van der Zant" <rvdzant@planet.nl> writes:

[ Why don't variables persist ]

I think you need to reduce your problem to a simpler one:

#!/usr/bin/perl -w
use strict;
use vars qw( $x );

if (rand() > 0.5 ) {
   $x = "Hello world\n";
} else {
   print $x; # Why does this not print Hello world?
}
__END__

The above code never prints Hello World regardless of the outcome of
the condition.  Even if you run the program several times.  That's because
every time you run a program it forgets all the variables from last
time it was run.

You may want to look into CGI::Persistant.

You also probably need to learn about the use of hidden fields in
HTML/CGI (not a Perl issue).

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 28 Dec 2000 11:01:41 GMT
From: ghorghor@my-deja.com
Subject: Re: Open a big text file ( large than 200MB )
Message-Id: <92f6ij$28n$1@nnrp1.deja.com>

In article <u9g0j9k9t2.fsf@wcl-l.bham.ac.uk>,
  nobull@mail.com wrote:
> nobull@mail.com writes:
>
> > BTW: You should replace the above with:
> >
> >   push @tab, $liste;
> >
> > [ This won't stop it compiling
>
> Brain fart!  s/compiling/eating all your memory/
sorry but in my code there is a $compteur
and when $compteur==1500 i exit
so i can t eat all my memory :)

here is the code -----------------------------------------
while(<fic>)
        {
                $liste=$_;
                $liste=~ s/\s+/ /g;
                @coupe=split(' ',$liste);
                if((@coupe[0]>=$debut)&&(@coupe[0]<=$fin))
                {
                        if($admin =~ /\w/)
                        {
                                if($victime =~/\w/ )
                                {
                                        if((@coupe[2]=~ /$admin/i)&&
(@coupe[4] =~
                                        {
                                                push @tab,$liste;
                                                $compteur++;
                                        }
                                }
                                else
                                {
                                        if(@coupe[2]=~ /$admin/i)
                                        {
                                                push @tab,$liste;
                                                $compteur++;
                                        }
                                }
                        }
                        else
                        {
                                if($victime =~ /\w/ )
                                {
                                        if(@coupe[4]=~ /$victime/i)
                                        {
                                                push @tab,$liste;
                                                $compteur++;
                                        }
                                }
                                else
                                {
                                        push @tab,$liste;
                                        $compteur++;
                                }
                        }
                }
                if($compteur==1500)
                {
                        close(fic);
                        affiche();
                        exit();
              }
        }
}
else
{
}
}


Sent via Deja.com
http://www.deja.com/


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

Date: 28 Dec 2000 11:49:06 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Piping output from one script into another
Message-Id: <92f9bi$5eb$1@mamenchi.zrz.TU-Berlin.DE>

Bernd Giegerich <bgi4711-for-news-use-only@this-is-a-valid-mailaddress-but-please-do-not-spam-me.de> wrote in comp.lang.perl.misc:
>Hi,
>
>your queston is more about bash than perl...
>
>>I have a Perl script that prints stuff to the screen using
>>"print".  (It prints a variable-length record to the screen).  The
>>script is called "psheet.pl" and it accepts 1 argument, a
>>filename. 
>
>If you want pdata.pl to get the output of psheet.pl as a command line 
>argument, you should use backticks:
>
>./pdata.pl `./psheet.pl p-sheet.txt`

Either that, or stick with the original pipeline, but expect the
output of psheet.pl to appear on STDIN, not @ARGV.

Anno


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

Date: 28 Dec 2000 12:31:27 GMT
From: cjw44@flatline.org.uk (Colin Watson)
Subject: Re: Piping output from one script into another
Message-Id: <92fbqv$uq8$1@riva.ucam.org>

Bernd Giegerich
<bgi4711-for-news-use-only@this-is-a-valid-mailaddress-but-please-do-not-spam-me.de> wrote:
>your queston is more about bash than perl...
>
>>I have a Perl script that prints stuff to the screen using
>>"print".  (It prints a variable-length record to the screen).  The
>>script is called "psheet.pl" and it accepts 1 argument, a
>>filename. 
>
>If you want pdata.pl to get the output of psheet.pl as a command line 
>argument, you should use backticks:
>
>./pdata.pl `./psheet.pl p-sheet.txt`

Or you could use xargs:

  ./psheet.pl p-sheet.txt | xargs ./pdata.pl

 ... though I imagine that's overkill for just one argument.

-- 
Colin Watson                                     [cjw44@flatline.org.uk]
"Abandon the search for Truth; settle for a good fantasy."


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

Date: Thu, 28 Dec 2000 12:26:41 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: References (I'm not sure if the old message posted)
Message-Id: <o7cm4t0kmkj86kdl2uio5uinbvfjq000g0@4ax.com>

Rajiv Eranki wrote:

>Here's the situation:
>I have a hash of areas, %world. This hash is blessed later and return
>as a reference.
>
>Now, each key in that hash is a scalar string, like "Venus".
>Each value to that hash is a reference to another hash, which contains
>information on that particular hash. So that the key "Venus" might
>point to a hash which contains keys like albedo or mass.
>
>e.g.
>world = {
>"Venus" => \%info
>etc.
>}
>
>The problem is, I need to create a "new" info hash, edit it, and point
>the planet to it each time I want to add a planet to the list.

Do this either with anonymous hashes:

	$world{Earth} = { key => 'value' };

or in a loop, with 'my' for your %info:

	foreach my $planet (qw(Earth Mars Jupiter) {
	     my %info = ( name => $planet );
	     $world{$planet} = \%info;
	}

Because of the "my" inside the loop *block*, that will be a different
hash (a different reference) every time.

-- 
	Bart.


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

Date: Thu, 28 Dec 2000 09:07:08 GMT
From: "Micah K Yoder" <micah@absolutely.geeks4christ.noorgspam!>
Subject: Saving uploaded files w/CGI.pm -- Linux works great, Windows makes it look like crap!
Message-Id: <0pD26.197610$U46.6106786@news1.sttls1.wa.home.com>

Hi,

I'm processing a JPG image upload using CGI.pm.  Running on my Linux
server at home, the image after uploading looks great.  Running on the
client's ISP's  @!%$#@% NT Server, the image colors are all distorted and
some of the image data appears to be missing.  Here's the relevant code:

	# and the pic
	my $filename = $query->param("pic_$MLS");
	if ($filename) {
		my $picno = GetNumPics($MLS) + 1;
		open (OUTPICFILE,">$photodir/$MLS-$picno.jpg");
		open (INPICFILE, "<$filename");
		binmode OUTPICFILE;
		binmode INPICFILE;
		my ($bytesread, $buffer);
		while ($bytesread=read(INPICFILE,$buffer,1024)) {
			print OUTPICFILE $buffer;
		}
		close OUTPICFILE;
		close INPICFILE;
	}

Any idea of what would be causing that and how to fix it?  Thanks!


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

Date: 28 Dec 2000 12:54:22 +0000
From: nobull@mail.com
Subject: Re: Saving uploaded files w/CGI.pm -- Linux works great, Windows makes it look like crap!
Message-Id: <u9ofxw7lkx.fsf@wcl-l.bham.ac.uk>

"Micah K Yoder" <micah@absolutely.geeks4christ.noorgspam!> writes:

> I'm processing a JPG image upload using CGI.pm.

> Here's the relevant code:

> 	my $filename = $query->param("pic_$MLS");
>       open (INPICFILE, "<$filename");

That's not a doing an HTTP upload, it is opening a file that is
already on the server (or at least accessable to the server via a
network file system).

> Running on the client's ISP's @!%$#@% NT Server, the image colors
> are all distorted and some of the image data appears to be missing.

> Any idea of what would be causing that and how to fix it?

I'd guess whatever mechanism you are using to upload the JPG file is
not treating it as binary data.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 28 Dec 2000 10:44:50 GMT
From: martinnitram@my-deja.com
Subject: Upload multi files with same source
Message-Id: <92f5j2$1gl$1@nnrp1.deja.com>

Dear all,

   I used CGI.pm to handle upload file. Everything work fine at first,
even upload two files in a single form; but if user input same image
src in both fields (say, both input c:\image.gif), i found that only
the first one can upload successfully, while another one is zero in
file size.

   I tried use both open(FILEHANDLER) and FILE::COPY to save the file
(and tried both ASCII and Binary file), same error occoured. Anyone had
idea in that?

   Great Thx.
   Urs, Martin


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 28 Dec 2000 13:48:58 GMT
From: usctjd02@my-deja.com
Subject: URL Testing Routine Problem
Message-Id: <92fgc9$8k9$1@nnrp1.deja.com>

I'm trying to use the following script to give a basic status of URLs
(up or down), however it fails on ssl sites.  I've tried adding the
SSLeay piece, but to no avail.  I must be doing something dumb,
assistance would be greatly appreciated...

#!/usr/local/bin/perl
  use LWP::UserAgent;

  my $ua = new LWP::UserAgent;

  my $request = new HTTP::Request('GET', $ARGV[0]);
  my $response = $ua->request($request);

  if ($response-> is_success) {
        print "SITE IS UP\n";
        } else {
        print $response->error_as_HTML;
        }



Sent via Deja.com
http://www.deja.com/


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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 5211
**************************************


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