[22131] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4353 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 6 18:11:03 2003

Date: Mon, 6 Jan 2003 15:10:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 6 Jan 2003     Volume: 10 Number: 4353

Today's topics:
        Printing  to webpage <captkirk2REMOVEME@mindspring.com>
    Re: Printing  to webpage <kasp@epatra.com>
    Re: Printing  to webpage <captkirk2REMOVEME@mindspring.com>
    Re: Printing  to webpage <kasp@epatra.com>
    Re: Printing  to webpage <chang0@adelphia.net>
    Re: Printing  to webpage <captkirk2REMOVEME@mindspring.com>
    Re: Printing  to webpage (Tad McClellan)
    Re: Printing  to webpage (Tad McClellan)
    Re: Printing  to webpage (Tad McClellan)
    Re: Printing  to webpage (Tad McClellan)
    Re: Problem with huge dataset, 100000000 a magic number <mgjv@tradingpost.com.au>
    Re: Problem with huge dataset, 100000000 a magic number <mthunter@students.uiuc.edu>
    Re: Queer behavior (Groen Kalkoen)
    Re: Solaris 5.8 Perl compilation problem <rgarciasuarez@free.fr>
    Re: Solaris 5.8 Perl compilation problem <michaelb@championdata.com.au>
        system() calls dont print to STDOUT or STDERR? (Matthew Walkup)
    Re: system() calls dont print to STDOUT or STDERR? <kasp@epatra.com>
    Re: system() calls dont print to STDOUT or STDERR? (Anno Siegel)
    Re: system() calls dont print to STDOUT or STDERR? (Tad McClellan)
    Re: Threads, dynamic loading programs, and using global <goldbb2@earthlink.net>
    Re: unixes: determine if file is an image <me@privacy.net>
    Re: While loop (Tad McClellan)
    Re: While loop (Tad McClellan)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 06 Jan 2003 12:02:02 -0800
From: 'Captain' Kirk DeHaan <captkirk2REMOVEME@mindspring.com>
Subject: Printing  to webpage
Message-Id: <monj1vsi8qsphs8qrg6j4aepcu8nnl6lci@4ax.com>

I'm a newbie to Perl.

I am trying to output some info to a webpage but keep getting server
errors.  I need to make sure I am attempting to do things the right
way.

Do I need to output data to a FORM on the page using GET/POST?



Kirk

www.mindspring.com/~captkirk2/
www.stormyacres.com


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

Date: Tue, 7 Jan 2003 01:37:11 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: Printing  to webpage
Message-Id: <avcnlv$8p4$1@newsreader.mailgate.org>

"'Captain' Kirk DeHaan" <captkirk2REMOVEME@mindspring.com> wrote in message
news:monj1vsi8qsphs8qrg6j4aepcu8nnl6lci@4ax.com...
> I'm a newbie to Perl.
>
> I am trying to output some info to a webpage but keep getting server
> errors.  I need to make sure I am attempting to do things the right
> way.
>
> Do I need to output data to a FORM on the page using GET/POST?

[snip]
Captain, your question is off-topic. Please discuss Perl only here!
Try a HTML related group.

--
Perl is designed to give you several ways to do anything, so
consider picking the most readable one.
             -- Larry Wall in the perl man page




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

Date: Mon, 06 Jan 2003 12:15:24 -0800
From: 'Captain' Kirk DeHaan <captkirk2REMOVEME@mindspring.com>
Subject: Re: Printing  to webpage
Message-Id: <aqoj1vggmaqf0gus023j7icom7r32vub5a@4ax.com>

On Tue, 7 Jan 2003 01:37:11 +0530, "Kasp" <kasp@epatra.com> wrote:

>"'Captain' Kirk DeHaan" <captkirk2REMOVEME@mindspring.com> wrote in message
>news:monj1vsi8qsphs8qrg6j4aepcu8nnl6lci@4ax.com...
>> I'm a newbie to Perl.
>>
>> I am trying to output some info to a webpage but keep getting server
>> errors.  I need to make sure I am attempting to do things the right
>> way.
>>
>> Do I need to output data to a FORM on the page using GET/POST?
>
>[snip]
>Captain, your question is off-topic. Please discuss Perl only here!
>Try a HTML related group.

I am doing this in a Perl script.  I would consider that ON topic.

Maybe I didn't explain it properly or ask the right question.

What is the proper syntax in Perl to output text, using print(?), to a
webpage?


Kirk

www.mindspring.com/~captkirk2/
www.stormyacres.com


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

Date: Tue, 7 Jan 2003 01:51:58 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: Printing  to webpage
Message-Id: <avcohc$9dn$1@newsreader.mailgate.org>

> >> Do I need to output data to a FORM on the page using GET/POST?
> >
> >[snip]
> >Captain, your question is off-topic. Please discuss Perl only here!
> >Try a HTML related group.
>
> I am doing this in a Perl script.  I would consider that ON topic.
>
> Maybe I didn't explain it properly or ask the right question.
>
> What is the proper syntax in Perl to output text, using print(?), to a
> webpage?
>


Try this URL http://www.pageresource.com/cgirec/ptut3.htm. I think this is
what you need.

PS: You should try to find stuff on your own first or look up a book that
you have read on Perl before.
--
Perl is designed to give you several ways to do anything, so
consider picking the most readable one.
             -- Larry Wall in the perl man page




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

Date: Mon, 06 Jan 2003 21:45:45 GMT
From: ebchang <chang0@adelphia.net>
Subject: Re: Printing  to webpage
Message-Id: <Xns92FBAA83F538Fchang0adelphia.net@24.48.107.54>

'Captain' Kirk DeHaan <captkirk2REMOVEME@mindspring.com> wrote in
news:aqoj1vggmaqf0gus023j7icom7r32vub5a@4ax.com: 

> On Tue, 7 Jan 2003 01:37:11 +0530, "Kasp" <kasp@epatra.com> wrote:
> 
>>"'Captain' Kirk DeHaan" <captkirk2REMOVEME@mindspring.com> wrote in
>>message news:monj1vsi8qsphs8qrg6j4aepcu8nnl6lci@4ax.com...
>>> I'm a newbie to Perl.
>>>
>>> I am trying to output some info to a webpage but keep getting server
>>> errors.  I need to make sure I am attempting to do things the right
>>> way.
>>>
>>> Do I need to output data to a FORM on the page using GET/POST?
>>
>>[snip]
>>Captain, your question is off-topic. Please discuss Perl only here!
>>Try a HTML related group.
> 
> I am doing this in a Perl script.  I would consider that ON topic.
> 
> Maybe I didn't explain it properly or ask the right question.
> 
> What is the proper syntax in Perl to output text, using print(?), to a
> webpage?

The proper syntax is 
    	
    	print "<The correct output text required by the HTTP server>";

Replacing <The correct output text required by the HTTP server> with the 
correct output text required by the HTTP server. 


In other words, the problem is a server/HTTP one, not a Perl one.  If I 
need to print your address on an envelope to send you snailmail spam, I 
need your correct address.  It doesn't matter what I use to print it.

So you need to learn a little more about the CGI interface.  One place to 
start:  http://www.comp.leeds.ac.uk/Perl/Cgi/start.html  There's a 
diagram illustrating the idea at 
http://www.utoronto.ca/webdocs/CGI/cgi2.html.  (Both of those will tell 
you what to fill in.)  When things go wrong, see 
http://www.perl.com/doc/FAQs/cgi/idiots-guide.html and ask questions on a 
suitable group such as comp.infosystems.www.authoring.cgi.  Unless, of 
course, the question is *about* Perl, rather than the subject area where 
you are using Perl.

-- 
EBC


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

Date: Mon, 06 Jan 2003 14:04:46 -0800
From: 'Captain' Kirk DeHaan <captkirk2REMOVEME@mindspring.com>
Subject: Re: Printing  to webpage
Message-Id: <kbvj1v4aj9q3ked9ciaoco0efuv74a303v@4ax.com>

On Tue, 7 Jan 2003 01:51:58 +0530, "Kasp" <kasp@epatra.com> wrote:

>> >> Do I need to output data to a FORM on the page using GET/POST?
>> >
>> >[snip]
>> >Captain, your question is off-topic. Please discuss Perl only here!
>> >Try a HTML related group.
>>
>> I am doing this in a Perl script.  I would consider that ON topic.
>>
>> Maybe I didn't explain it properly or ask the right question.
>>
>> What is the proper syntax in Perl to output text, using print(?), to a
>> webpage?
>>
>
>
>Try this URL http://www.pageresource.com/cgirec/ptut3.htm. I think this is
>what you need.
>
>PS: You should try to find stuff on your own first or look up a book that
>you have read on Perl before.


Thanks.



Kirk

"There's a lot to be said 
 for a blow to the head", BOC.

www.mindspring.com/~captkirk2/
www.stormyacres.com


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

Date: Mon, 6 Jan 2003 16:02:12 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Printing  to webpage
Message-Id: <slrnb1jv74.ckb.tadmc@magna.augustmail.com>

Kasp <kasp@epatra.com> wrote:
> "'Captain' Kirk DeHaan" <captkirk2REMOVEME@mindspring.com> wrote in message
> news:monj1vsi8qsphs8qrg6j4aepcu8nnl6lci@4ax.com...

>> I am trying to output some info to a webpage but keep getting server
>> errors.


> Captain, your question is off-topic. Please discuss Perl only here!
> Try a HTML related group.


Errr, the question would be off-topic in an HTML newsgroup too...


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 6 Jan 2003 16:06:55 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Printing  to webpage
Message-Id: <slrnb1jvfv.ckb.tadmc@magna.augustmail.com>

'Captain' Kirk DeHaan <captkirk2REMOVEME@mindspring.com> wrote:

> What is the proper syntax in Perl to output text, using print(?), to a
> webpage?


The same syntax you use to output text that is not going to a webpage.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 6 Jan 2003 16:09:59 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Printing  to webpage
Message-Id: <slrnb1jvln.ckb.tadmc@magna.augustmail.com>

'Captain' Kirk DeHaan <captkirk2REMOVEME@mindspring.com> wrote:

> I am trying to output some info to a webpage but keep getting server
                                                                ^^^^^^
> errors.
  ^^^^^

   perldoc -q "server error"

      "My CGI script runs from the command line but not the
       browser.  (500 Server Error)"


You are expected to check the Perl FAQ *before* posting to 
the Perl newsgroup.


> Do I need to output data to a FORM on the page using GET/POST?


No.

The CGI specifies that you make output on STDOUT, 
a plain ol' print() makes output on STDOUT.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 6 Jan 2003 16:11:10 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Printing  to webpage
Message-Id: <slrnb1jvnu.ckb.tadmc@magna.augustmail.com>

'Captain' Kirk DeHaan <captkirk2REMOVEME@mindspring.com> wrote:

> I am trying to output some info to a webpage but keep getting server
> errors.


Then try running your program from the command line instead of
in a CGI environment, and see what it outputs.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 06 Jan 2003 22:32:03 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Problem with huge dataset, 100000000 a magic number?
Message-Id: <slrnb1k0v3.2j6.mgjv@verbruggen.comdyn.com.au>

On Mon, 06 Jan 2003 18:42:20 GMT,
	Mike Hunter <mthunter@students.uiuc.edu> wrote:
> On Sun, 05 Jan 2003 22:01:35 GMT, Martien Verbruggen wrote:
>>  On Fri, 03 Jan 2003 19:02:59 GMT,
>>  	Mike Hunter <mthunter@students.uiuc.edu> wrote:
>> > Greetings all,
>> > 
>> > I'm using perl to crunch some data generated from flow-tools.  My script
>> > works well until I get into really large data, where I end up with
>> > problems.  I may very well be running the machine out of memory, but
>> > some recent debugging output produced this:
>> > 
>> > processing line 99900000
>> > processing line 99950000
>> > processing line 100000000
>>  
>>  Could it be that somewhere around line 100000000 you pass the 2 GB
>>  mark [1]? Is the file larger than 2 GB, and if so, does your Perl on your
>>  OS support that?
> 
> How does one tell what the local limits are?

perl -V will tell you whether it was compiled with large file support.
Look for acompile-time-option of USE_LARGE_FILES.

Martien
-- 
                        | 
Martien Verbruggen      | The world is complex; sendmail.cf reflects
Trading Post Australia  | this.
                        | 


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

Date: Mon, 06 Jan 2003 22:40:53 GMT
From: Mike Hunter <mthunter@students.uiuc.edu>
Subject: Re: Problem with huge dataset, 100000000 a magic number?
Message-Id: <slrnb1k1l7.8eb.mthunter@ux12.cso.uiuc.edu>

On Mon, 06 Jan 2003 22:32:03 GMT, Martien Verbruggen wrote:
>  On Mon, 06 Jan 2003 18:42:20 GMT,
>  	Mike Hunter <mthunter@students.uiuc.edu> wrote:
> > On Sun, 05 Jan 2003 22:01:35 GMT, Martien Verbruggen wrote:

> >>  Could it be that somewhere around line 100000000 you pass the 2 GB
> >>  mark [1]? Is the file larger than 2 GB, and if so, does your Perl on your
> >>  OS support that?
> > 
> > How does one tell what the local limits are?
>  
>  perl -V will tell you whether it was compiled with large file support.
>  Look for acompile-time-option of USE_LARGE_FILES.

Thanks.  perl -V says (among other things):

uselargefiles=define

So I don't think that's the problem.  I'm starting to think that the
number was indeed a coincidence.  Naturally, the problem has not
reoccured since I added the code to print out the exact line number :)

Thanks,

Mike


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

Date: 6 Jan 2003 11:51:13 -0800
From: groen_kalkoen@yahoo.co.uk (Groen Kalkoen)
Subject: Re: Queer behavior
Message-Id: <bbfa349b.0301061151.1085facb@posting.google.com>

mandar_amdekar@hotmail.com (Mandar Amdekar) wrote...
> 1>
> print("Input: ");
> my($var) = <STDIN>;
> print("Your input = $var\n");
> 
> 2>
> print("Input: ");
> my($var);
> $var = <STDIN>;
> print("Your input = $var\n");
> 
> When I run 1, the <ENTER> does not end the stdin steam, which is not
> what I want, but program 2 does end the stdin steam on hitting
> <ENTER>

($var) is a list so its allowing more than one value from STDIN. $var
is a scalar so it works. The following would also work...

my $var = <STDIN>;


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

Date: 06 Jan 2003 21:15:23 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: Solaris 5.8 Perl compilation problem
Message-Id: <slrnb1jsof.6t9.rgarciasuarez@dat.local>

Michael wrote in comp.lang.perl.misc :
> 
> I am trying to build perl 5.8.0 on a SPARC Solaris box (2.8).  During
> the running of Configure (./Configure -de -Dusethreads -Dcc='gcc
> -B/usr/ccs/bin/') I get the following:

I don't know what you're trying to achieve there with your -B option to
gcc, but this doesn't sound like a good idea, to mix Solaris' compiler
suite with gcc.

Moreover, if you want to specify additionnal flags for the C compiler
command-line, you should use the 'ccflags' configuration variable
instead, as in
    sh Configure -Accflags=-B/...

-- 
Grepping the source is good for the soul. -- the perldebguts manpage


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

Date: Tue, 7 Jan 2003 09:43:35 +1100
From: "Michael Blackmore" <michaelb@championdata.com.au>
Subject: Re: Solaris 5.8 Perl compilation problem
Message-Id: <cznS9.5$x24.28526@vicpull1.telstra.net>

Rafael,

Thanks for the input.  The -B option comes from the README.solaris file, it
solved a problem I have had with using GNU as and ld, it is not really
necessary here, just an habit of mine.  Leaving it off in this case has no
affect.

Cheers,

Michael

"Rafael Garcia-Suarez" <rgarciasuarez@free.fr> wrote in message
news:slrnb1jsof.6t9.rgarciasuarez@dat.local...
> Michael wrote in comp.lang.perl.misc :
> >
> > I am trying to build perl 5.8.0 on a SPARC Solaris box (2.8).  During
> > the running of Configure (./Configure -de -Dusethreads -Dcc='gcc
> > -B/usr/ccs/bin/') I get the following:
>
> I don't know what you're trying to achieve there with your -B option to
> gcc, but this doesn't sound like a good idea, to mix Solaris' compiler
> suite with gcc.
>
> Moreover, if you want to specify additionnal flags for the C compiler
> command-line, you should use the 'ccflags' configuration variable
> instead, as in
>     sh Configure -Accflags=-B/...
>
> --
> Grepping the source is good for the soul. -- the perldebguts manpage




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

Date: 6 Jan 2003 14:08:31 -0800
From: mwalkup@cadrc.calpoly.edu (Matthew Walkup)
Subject: system() calls dont print to STDOUT or STDERR?
Message-Id: <53f567bc.0301061408.3f1f11d6@posting.google.com>

I've written a program that ties stdout and stderr.  It works great
for my uses and captures almost everything thats printed to STOUT or
STERR.  The problem im having is with system() calls.  Eventhough
everything before and after the system() call is captured by my tie,
system() calls are not.

I am wondering if there is a different handle system() calls are
pointing to, or if the system call is printing to something external
to perl.  If it is external, is there a way to captuer the STDOUT and
STDERR of a system call?

Im running activeperl on a win32 system, if it matters.

Thanks,

Matt


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

Date: Tue, 7 Jan 2003 03:41:43 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: system() calls dont print to STDOUT or STDERR?
Message-Id: <avcuv3$e7i$1@newsreader.mailgate.org>

"Matthew Walkup" <mwalkup@cadrc.calpoly.edu> wrote in message
news:53f567bc.0301061408.3f1f11d6@posting.google.com...
> I am wondering if there is a different handle system() calls are
> pointing to, or if the system call is printing to something external
> to perl.  If it is external, is there a way to captuer the STDOUT and
> STDERR of a system call?

Assume your system call is as simple as "ls"
Current code calls: system("ls");
Change the code to: system("ls > ls.tmp")

So what this does is uses simple file redirection to get the results.
Hope that's fine.




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

Date: 6 Jan 2003 22:27:32 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: system() calls dont print to STDOUT or STDERR?
Message-Id: <avcvsk$4pf$2@mamenchi.zrz.TU-Berlin.DE>

Kasp <kasp@epatra.com> wrote in comp.lang.perl.misc:
> "Matthew Walkup" <mwalkup@cadrc.calpoly.edu> wrote in message
> news:53f567bc.0301061408.3f1f11d6@posting.google.com...
> > I am wondering if there is a different handle system() calls are
> > pointing to, or if the system call is printing to something external
> > to perl.  If it is external, is there a way to captuer the STDOUT and
> > STDERR of a system call?
> 
> Assume your system call is as simple as "ls"
> Current code calls: system("ls");
> Change the code to: system("ls > ls.tmp")
> 
> So what this does is uses simple file redirection to get the results.
> Hope that's fine.

No it isn't, not if we're talking Perl.  Look up backticks for
a better solution.  There is (of course) a FAQ about this,
"perldoc -q 'output of a command'" finds it.

Anno


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

Date: Mon, 6 Jan 2003 16:34:29 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: system() calls dont print to STDOUT or STDERR?
Message-Id: <slrnb1k13l.css.tadmc@magna.augustmail.com>

Matthew Walkup <mwalkup@cadrc.calpoly.edu> wrote:

> is there a way to captuer the STDOUT and
> STDERR of a system call?


   perldoc -q STDERR

      "How can I capture STDERR from an external command?"


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 06 Jan 2003 17:57:36 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Threads, dynamic loading programs, and using globals?
Message-Id: <3E1A09E0.AAC1F764@earthlink.net>

Joe wrote:
> Benjamin Goldberg wrote:
> >
> > Hmm... Ok, how about this.  Take the following code, and put it into
> > a file named "threads/shared/vars.pm" somewhere in your @INC path...
> >
> 
> Thanks.
> You know too much :)
> 
> I knew an external global package can be one of the solutions, just
> that yours is much more elegant. In one sense it is overkill as
> resources can be shared among all types of plugins, not just the same
> type.

Although they *can be* shared among all types of plugins, they won't be,
unless you carefully contrieve to do so.  That is, if you have:

   # plugins/abc.pm
   package plugins::abc;
   use threads::shared::vars qw($q);
   # stuff with $q.
   __END__

   # plugins/def.pm
   package plugins::def;
   use threads::shared::vars qw($q);
   # stuff with $q.
   __END__

Each of these $q variables will be a *different* $q variable, specific
to that package, just as if they'd each been declared using 'use vars'.

If you want to give one package access to the shared variables of one or
more other packages, then you would have to do something like:

   # plugins/abcdef;
   package plugins::abc;
   use threads::shared::vars qw($q);
   BEGIN { *plugins::abcdef::abc_q = \$q };
   package plugins::def;
   use threads::shared::vars qw($q);
   BEGIN { *plugins::abcdef::def_q = \$q };
   package plugins::abcdef;
   # stuff with $abc_q and $def_q
   __END__

> OTOH, if Main needed more control or knowledge of the loaded
> plugins, as is usually the case, the structure is already in place and
> probably can be included with Main.

Keeping %vars hidden inside of the threads::shared::vars package
prevents it from being accessed in ways that could result in problems
(race conditions in particular).

Instead of changing %vars from a my() variable to an our() variable, and
having Main examine it directly, it would be much better (safer) to
provide some package functions to threads::shared::vars to examine it
(and, more importantly, lock() it and the parts of it being looked at
while examining it).

> It would have been nice to have a resource class that can be declared
> in a package but is global, so running the same package in a different
> threads it could be locked and shared.

I'm not sure what you mean -- as far as I can see, this is how it
already is with threads::shared::vars.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Tue, 7 Jan 2003 08:39:19 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: unixes: determine if file is an image
Message-Id: <avct2a$drsl3$1@ID-172104.news.dfncis.de>


"Mark Wirdnam" <mark.wirdnam@stud.unibas.ch> wrote in message
news:3c6df95c.0301060627.468214a1@posting.google.com...
> Hello! I am happily using Image::Magick, but one thing I can't figure
> out:
> How my Perl script should decide about whether a file is an image or
> not.
>
> I'm interested in any way this could be achieved, but preferably with
> Image::Magick. (Doing Read($file) or Ping($file) to a file that isn't
> an image seems to cause indefinite waiting...)
>
> I've looked through ready-made scripts I found on Internet and see
> solutions like
> $filename =~ /\.jpg/ . This isn't what I want because I don't want to
> rely on extensions.
>
> My tests have been on a mac os x platform, so basically if anyone has
> this problem for him/herself on a linux/freebsd or similar platform,
> any advice posted here would be greatly appreciated!!!

In addition to the suggested File::MMagic module, you could also try
Image::Info or Image::Size




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

Date: Mon, 6 Jan 2003 15:36:33 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: While loop
Message-Id: <slrnb1jtn1.ckb.tadmc@magna.augustmail.com>

Michael Peuser \(h\) <post@mpeuser.de> wrote:
> "Tad McClellan" <tadmc@augustmail.com> schrieb im Newsbeitrag
> news:slrnb1hf4a.9ot.tadmc@magna.augustmail.com...
> 
>> Your while is irritating too, just
>>
>>     s!(<pre>.+?)<br>(.+?</pre>)!$1\n$2!gs;
>>
>> will do the same thing...
> 
> Sorry, but it will not replace multiple <br> inside of  a <pre>  block.


Oops. I (now) see your point.


>> Try it with:
>>
>>    $line = "<pre>foobar</pre><br><pre>preformated</pre>\n";
>>
>> It will replace the <br> even though it is NOT inside a <pre>...
> 
> Indeed - regexes are tricky ;-)


That's why they pay us the big bucks.  :-)  :-)


> My suggestion does not work with
> - more than one <pre> block per line
> - <pre> blocks spanning lines


The code I suggested in another followup does handle both of those cases.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 6 Jan 2003 16:31:06 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: While loop
Message-Id: <slrnb1k0ta.css.tadmc@magna.augustmail.com>

Tad McClellan <tadmc@augustmail.com> wrote:
> Michael Peuser \(h\) <post@mpeuser.de> wrote:
>> "Tad McClellan" <tadmc@augustmail.com> schrieb im Newsbeitrag
>> news:slrnb1hf4a.9ot.tadmc@magna.augustmail.com...


[snip: wants to replace <br> using a regex]


>> Indeed - regexes are tricky ;-)


The "tricks" here are not because regexes are tricky.

They are because correctly parsing HTML is tricky.


> That's why they pay us the big bucks.  :-)  :-)


So folks that get the big bucks do not try to process HTML
with a regex, they use a module for parsing HTML when they
need to parse HTML.


>> My suggestion does not work with
>> - more than one <pre> block per line
>> - <pre> blocks spanning lines
> 
> 
> The code I suggested in another followup does handle both of those cases.


I should point out that my code will fail in _other_ situations though.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.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 V10 Issue 4353
***************************************


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