[22973] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5193 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 7 21:10:40 2003

Date: Mon, 7 Jul 2003 18:10:14 -0700 (PDT)
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, 7 Jul 2003     Volume: 10 Number: 5193

Today's topics:
    Re: oneliner failed on Win2k with space in path name <bwalton@rochester.rr.com>
    Re: oneliner failed on Win2k with space in path name (Tad McClellan)
    Re: Open URL from email message <emschwar@pobox.com>
    Re: Perl for Win32 <mark_usenet@peculiarities.com>
        perl restaurant menu <mreed@reedassociates.com>
    Re: Perl Script Problems <yyyy@yyy.com>
    Re: Perl Script Problems <abuse@sgrail.org>
    Re: Perl Script Problems <kkeller-spammmm@wombat.san-francisco.ca.us>
    Re: Perl Script Problems (Tad McClellan)
    Re: Perl Script Problems (Tad McClellan)
    Re: Perl Script Problems <yyyy@yyy.com>
    Re: Perl Script Problems <yyyy@yyy.com>
    Re: Perl Script Problems <yyyy@yyy.com>
    Re: read sensor data <bwalton@rochester.rr.com>
    Re: references => how not to destroy my data ? <ben.goldberg@hotpop.com>
    Re: Regex help... <bwalton@rochester.rr.com>
        Total Butt Heads in this news group <yyyy@yyy.com>
    Re: Total Butt Heads in this news group <REMOVEsdnCAPS@comcast.net>
    Re: Total Butt Heads in this news group <yyyy@yyy.com>
    Re: Using semicolon delimited autosplit  "perl -aF\;" <bwalton@rochester.rr.com>
    Re: Wanted: Help/Script to truncate mp3 files. <spam@thecouch.homeip.net>
    Re: Win32 hidden Perl program <emschwar@pobox.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 07 Jul 2003 23:44:49 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: oneliner failed on Win2k with space in path name
Message-Id: <3F0A05EB.5090703@rochester.rr.com>

Xu Yang wrote:

 ...


> I have an oneliner Perl script (see below) works fine when the path
> name is 8.3 format on Win2K, but failed after it operated on a path
> name contains space:
> 
> c:\perl -e "while(<>) {if(/^define/){print $ARGV.#'.$_;}}" c:\usr\*.tt

'--------------------------------------------------^
*please* copy/paste working code, don't just type it in -- the above as 
given doesn't compile because the # is seen as the start of a Perl 
comment, resulting in unbalanced braces.  I assume it should be ...'#'...


> 
> If I change the "c:\usr" to "c:\program files", it failed with error:
> Can't open c:\program files\*.tt.
> I double quote the path, did not help either.
> 
> Is this because the old version (5.x) of perl I am using?
> 
> 
> Xu
> 

Your error message indicates that the command "shell" got the correct 
filename, but that such a file was not actually present.  Check in your 
"c:\program files" directory and see if there are any *.tt files in that 
directory.  Usually, there aren't any files in that directory -- only 
additional subdirectories.  The problem should have nothing to do with 
your version of Perl, and, in fact, doesn't appear to be a Perl problem 
at all.

-- 
Bob Walton



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

Date: Mon, 7 Jul 2003 19:31:53 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: oneliner failed on Win2k with space in path name
Message-Id: <slrnbgk47p.3da.tadmc@magna.augustmail.com>

Xu Yang <Xu.Yang@aspect.com> wrote:

> I have an oneliner Perl script (see below) works fine
                                             ^^^^^^^^^^
                                             ^^^^^^^^^^
> c:\perl -e "while(<>) {if(/^define/){print $ARGV.#'.$_;}}" c:\usr\*.tt
                                                  ^^^

I'm having trouble believing you there...

[ Have you seen the Posting Guidelines that are posted here frequently? ]


> Is this because the old version (5.x) of perl I am using?


No, it is because of the silly shell that you are forced to use.

You must expand the glob() in your Perl code, if your shell won't
expand it for you. Something like:

c:\perl -ne "BEGIN{ @ARGV=<$ARGV[0]> } print qq($ARGV#$_) if /^define/" *.tt


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


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

Date: 07 Jul 2003 16:49:48 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Open URL from email message
Message-Id: <eto8yra2bqr.fsf@wormtongue.emschwar>

Beable van Polasm <beable+unsenet@beable.com.invalid> writes:
> As for "emulating a click", what other actions do you think that
> clicking on a link would have than to get a web browser to display
> the page linked to? 

The answer, if it's HTML mail, and javascript is enabled, is "darn
near anything".  If the machine in question runs Windows, even more
so.

-=Eric
-- 
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
		-- Blair Houghton.


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

Date: Tue, 08 Jul 2003 00:29:19 GMT
From: Mark Grimes <mark_usenet@peculiarities.com>
Subject: Re: Perl for Win32
Message-Id: <MPG.1973b03cf28df875989688@news.sf.sbcglobal.net>

In article <5b4572c6.0307032052.41b67984@posting.google.com>, 
Torres__Armando@msn.com says...
> $PVCSDatabase = "\\\\PC\\Vault\\temp\\my folder";
> system("$PVCSClient get -pr$PVCSDatabase -a$SVRWEB -o -z -w
> /archives")

You want the system command to see something like this once it is all 
evaluated:

pvcsclient get -pr"\\PC\Vault\temp\my folder" -ac:/temp/eMitchell -o -z 
-w /archives

So, try something like:

system("$PVCSClient get -pr\"$PVCSDatabase\" -a$SVRWEB -o -z -w 
/archives")



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

Date: Mon, 07 Jul 2003 23:43:55 -0000
From: Mark Reed <mreed@reedassociates.com>
Subject: perl restaurant menu
Message-Id: <Xns93B1C8BA3E302mreedreedassociatesc@216.168.3.44>

Does anyone have a perl script that can be used to manage an online 
restaurant menu?

Im looking for examples to study and cant find any on the net at the 
popular archives.

thanks



-- 
---------------
Mark M. Reed
mreed@reedassociates.com



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

Date: Mon, 07 Jul 2003 23:21:30 GMT
From: "Robert" <yyyy@yyy.com>
Subject: Re: Perl Script Problems
Message-Id: <_fnOa.184173$nr.8346422@twister.southeast.rr.com>

Well Thanks for nothing why take time to provide a stupid answer

"Abigail" <abigail@abigail.nl> wrote in message
news:slrnbgjr50.tmv.abigail@alexandra.abigail.nl...
> Robert (yyyy@yyy.com) wrote on MMMDXCVII September MCMXCIII in
> <URL:news:fYlOa.177745$_w.7616965@twister.southeast.rr.com>:
> ..  Any help on this would be great since its a free script there is no
support.
>
> Perl is free, so by that logic, you're out of luck in this newsgroup.
>
> ..  I have a website on a win2k server running MSFP 2002 extensions. The
script
> ..  should create a html file on the fly but it won't. The script is one
of
> ..  those post card scripts that sends an e-mail and a link to the card.
All
> ..  works fine except for the card creation. The e-mail it sends contains
a link
> ..  but when clicked you get the 404 error.
> ..  Anybody PLEASE HELP
>
>
> There's a bug on line 17.
>
>
>
> Abigail
> -- 
> perl -we'$;=$";$;{Just=>another=>Perl=>Hacker=>}=$/;print%;'




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

Date: Mon, 07 Jul 2003 23:51:35 GMT
From: derek / nul <abuse@sgrail.org>
Subject: Re: Perl Script Problems
Message-Id: <gj1kgvch614qel2acbt3fsv229khpmblit@4ax.com>

On Mon, 07 Jul 2003 23:21:30 GMT, "Robert" <yyyy@yyy.com> wrote:

>Well Thanks for nothing why take time to provide a stupid answer

Your first mistake was to post a question that nobody could answer.
There is nowhere near information to even get a hint of what is happening.
It may not be a perl problem.

Your second mistake is criticizing the first response you got.
When I got my first "There's a bug on line 17"  I was dumb enough to go and
check my code, until I realised that I had not posted any code.

Your third mistake is top posting, everybody likes bottom posting here.

>"Abigail" <abigail@abigail.nl> wrote in message
>news:slrnbgjr50.tmv.abigail@alexandra.abigail.nl...
>> Robert (yyyy@yyy.com) wrote on MMMDXCVII September MCMXCIII in
>> <URL:news:fYlOa.177745$_w.7616965@twister.southeast.rr.com>:
>> ..  Any help on this would be great since its a free script there is no
>support.
>>
>> Perl is free, so by that logic, you're out of luck in this newsgroup.
>>
>> ..  I have a website on a win2k server running MSFP 2002 extensions. The
>script
>> ..  should create a html file on the fly but it won't. The script is one
>of
>> ..  those post card scripts that sends an e-mail and a link to the card.
>All
>> ..  works fine except for the card creation. The e-mail it sends contains
>a link
>> ..  but when clicked you get the 404 error.
>> ..  Anybody PLEASE HELP
>>
>>
>> There's a bug on line 17.
>>
>>
>>
>> Abigail
>> -- 
>> perl -we'$;=$";$;{Just=>another=>Perl=>Hacker=>}=$/;print%;'
>



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

Date: Mon, 7 Jul 2003 16:53:38 -0700
From: Keith Keller <kkeller-spammmm@wombat.san-francisco.ca.us>
Subject: Re: Perl Script Problems
Message-Id: <261deb.8tc.ln@goaway.wombat.san-francisco.ca.us>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

In article <_fnOa.184173$nr.8346422@twister.southeast.rr.com>, Robert wrote:
> Well Thanks for nothing why take time to provide a stupid answer

Well, you took the time to provide a stupid question.

- --keith

- -- 
kkeller-mmmspam@wombat.san-francisco.ca.us
(try just my userid to email me)
alt.os.linux.slackware FAQ:  http://wombat.san-francisco.ca.us/cgi-bin/fom

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj8KB/8ACgkQhVcNCxZ5ID+2LQCgkIMYeBKDYwuP7wjTe52SyIQQ
pSEAnAjjO4CgWdAPZXEXRQ3NspmDwRGU
=ddic
-----END PGP SIGNATURE-----


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

Date: Mon, 7 Jul 2003 18:45:28 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl Script Problems
Message-Id: <slrnbgk1go.3ap.tadmc@magna.augustmail.com>

Robert <yyyy@yyy.com> wrote:

> Well Thanks for nothing 


So long then.

   *plonk*


> why take time to provide a stupid answer


You reap what you sow.




[ snip TOFU ]


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


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

Date: Mon, 7 Jul 2003 18:50:59 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl Script Problems
Message-Id: <slrnbgk1r3.3ap.tadmc@magna.augustmail.com>

Robert <yyyy@yyy.com> wrote:

> Any help on this would be great since its 


What "it" is it that you are referring to?

We are expected to know what is wrong with it without even
knowing what "it" it is?

You seem to have absurd expectations.


> a free script there is no support.


You got what you paid for.


> The script
> should create a html file on the fly but it won't. 


It probably has a bug in it then.


> The script is one of
> those post card scripts 


But we have to guess which one of the many it is?


> that sends an e-mail and a link to the card. All
> works fine except for the card creation. 


Carefully examine the part of the code that creates the card then.

You will need to do this part yourself, since you are the only
one who knows what code you are talking about.

What code are you talking about?


> Anybody PLEASE HELP


You are joking, right?


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


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

Date: Tue, 08 Jul 2003 00:14:55 GMT
From: "Robert" <yyyy@yyy.com>
Subject: Re: Perl Script Problems
Message-Id: <32oOa.178180$_w.7656170@twister.southeast.rr.com>

WOW Thanks dude like totally rad and way cool
"Keith Keller" <kkeller-spammmm@wombat.san-francisco.ca.us> wrote in message
news:261deb.8tc.ln@goaway.wombat.san-francisco.ca.us...
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
>
> In article <_fnOa.184173$nr.8346422@twister.southeast.rr.com>, Robert
wrote:
> > Well Thanks for nothing why take time to provide a stupid answer
>
> Well, you took the time to provide a stupid question.
>
> - --keith
>
> - -- 
> kkeller-mmmspam@wombat.san-francisco.ca.us
> (try just my userid to email me)
> alt.os.linux.slackware FAQ:  http://wombat.san-francisco.ca.us/cgi-bin/fom
>
> -----BEGIN xxx SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> Comment: For info see http://www.gnupg.org
>
> iEYEARECAAYFAj8KB/8ACgkQhVcNCxZ5ID+2LQCgkIMYeBKDYwuP7wjTe52SyIQQ
> pSEAnAjjO4CgWdAPZXEXRQ3NspmDwRGU
> =ddic
> -----END PGP SIGNATURE-----




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

Date: Tue, 08 Jul 2003 00:33:16 GMT
From: "Robert" <yyyy@yyy.com>
Subject: Re: Perl Script Problems
Message-Id: <gjoOa.241666$jp.6615306@twister.southeast.rr.com>

The first post tells what it is unless your definition of it is not the
normal one
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnbgk1r3.3ap.tadmc@magna.augustmail.com...
> Robert <yyyy@yyy.com> wrote:
>
> > Any help on this would be great since its
>
>
> What "it" is it that you are referring to?
>
> We are expected to know what is wrong with it without even
> knowing what "it" it is?
>
> You seem to have absurd expectations.
>
>
> > a free script there is no support.
>
>
> You got what you paid for.
>
>
> > The script
> > should create a html file on the fly but it won't.
>
>
> It probably has a bug in it then.
>
>
> > The script is one of
> > those post card scripts
>
>
> But we have to guess which one of the many it is?
>
>
> > that sends an e-mail and a link to the card. All
> > works fine except for the card creation.
>
>
> Carefully examine the part of the code that creates the card then.
>
> You will need to do this part yourself, since you are the only
> one who knows what code you are talking about.
>
> What code are you talking about?
>
>
> > Anybody PLEASE HELP
>
>
> You are joking, right?
>
>
> -- 
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas




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

Date: Tue, 08 Jul 2003 00:31:04 GMT
From: "Robert" <yyyy@yyy.com>
Subject: Re: Perl Script Problems
Message-Id: <choOa.241664$jp.6614974@twister.southeast.rr.com>

Fuck you then
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnbgk1go.3ap.tadmc@magna.augustmail.com...
> Robert <yyyy@yyy.com> wrote:
>
> > Well Thanks for nothing
>
>
> So long then.
>
>    *plonk*
>
>
> > why take time to provide a stupid answer
>
>
> You reap what you sow.
>
>
>
>
> [ snip TOFU ]
>
>
> -- 
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas




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

Date: Mon, 07 Jul 2003 23:55:36 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: read sensor data
Message-Id: <3F0A0872.50604@rochester.rr.com>

Alythh wrote:

> Can I have some advices on the correct (Perl) way to read/write to an
> A/D card that I want to install on my PC to monitor sensors?
 ...


> Alessandro


You will have to ask your A/D card vendor, 

or look in their manual.  There is in 

general no nonproprietary standard for 

interfaces to such cards.


-- 
Bob Walton



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

Date: Mon, 07 Jul 2003 18:13:42 -0400
From: Benjamin Goldberg <ben.goldberg@hotpop.com>
Subject: Re: references => how not to destroy my data ?
Message-Id: <3F09F096.2F7A074D@hotpop.com>

Jan wrote:
> 
> Hi,
> 
> I'm struggling with references again.  Underneath you will find a code
> snippet with some comments interleaved to tell what's going on.
> 
> # start code snippet.
> 
> $recordIndex = 0;
> 
> open (GROUPS, "<groupsfile.txt") or die "Cannot open $groupsFile\n";
> while ($line = <GROUPS>)
> {
>    @juniorMembers = ();
>    @seniorMembers = ();

Are these used after this loop?  If not, then lexically scope them.

   my (@juniorMembers, @seniorMembers);

They will be automatically initialized with ().

> #
> # Snipped away code in which the two preceding arrays are populated
> and in which
> # which $group gets a valid value.  This code was tested and correct.
> So for
> # keeping things easy I'll leave this 'huge' part out...
> #
> 
>     foreach $juniorMember(@juniorMembers)
>       { push( @{$juniorArray}, $juniorMember) ; }
>     foreach $seniorMember(@seniorMembers)
>       { push( @{$seniorArray}, $seniorMember) ; }

What is put into $juniorArray and $SeniorArray before this?  If nothing,
or if only [], then you could do:

   $juniorArray = \@juniorMembers;
   $seniorArray = \@seniorMembers;

This of course will only work right if @juniorMembers and @seniorMembers
are lexically scoped to the loop with my().  If you leave out the my(),
and keep your old @juniorMembers = (); @seniorMembers = ();, then of
course simply taking references to them won't work quite right. 
Instead, you would have to do either what you have, or else one of:

   $juniorArray = [@juniorMembers];
   $seniorArray = [@seniorMembers];

Or:

   push @$juniorArray, @juniorMembers;
   push @$seniorArray, @seniorMembers;

> # Since I'm in while loop I try to store my data into an anonymous
> # array by using a hard reference (e.g. $juniorArray)
> 
>     $myrecord = {  GROUP      => $group,
>                    JUNIOR     => $juniorArray,
>                    SENIOR     => $seniorArray };
> 
>      $database[$recordIndex++] = $myrecord;

Is $recordIndex ever anything other than one-past-the-end of @database?

If not, then this could be written as:

   push @database, $myrecord;

And dispense with $recordIndex entirely.

> }
> 
> # End code snippet.
> 
> Next thing I know, for each record I have in my 'database' array, when
> dereferencing the arrays, about the same array contents.

Not just that... you probably have the same *arrays*, not just the same
contents.

> I do know that I do overwrite my references to the arrays, but hoped
> that would have been solved by storing these references in the
> anonymous hash.
> dumb, dumber...
> 
> So perl doesn't know the location of my 'junior' and 'senior' arrays
> data anymore, I guess.  Can someone offer some advice on more proper
> ways to come out of this while loop with the array data still intact ?

Rewrite the code something like this:

   use strict;   # always use strict!
   use warnings; # always use warnings (or else, -w on #! line)!
   open( my($groups), "<", "groupsfile.txt" )
      or die "Couldn't open groupsfile.txt: $!";
   my @database;
   while( my $line = <$groups> ) {
      my (@juniorMembers, @seniorMembers);
      # put stuff in @juniorMembers and @seniorMembers from $line.
      push @database, {
         GROUP      => $group,
         JUNIOR     => \@juniorMembers,
         SENIOR     => \@seniorMembers,
      };
   }
   close $groups;
   # process @database

[untested]

-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}


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

Date: Tue, 08 Jul 2003 00:25:00 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Regex help...
Message-Id: <3F0A0F56.70403@rochester.rr.com>

Math55 wrote:

> hi, why does "log" find lines like that:
> 
> 
> 20030707062514.ksyms
> 
> anyone any idea????
> 
> THANK YOU:)
> 

It's because of the error on line 17.
-- 
Bob Walton



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

Date: Mon, 07 Jul 2003 23:54:02 GMT
From: "Robert" <yyyy@yyy.com>
Subject: Total Butt Heads in this news group
Message-Id: <uKnOa.184175$nr.8352141@twister.southeast.rr.com>





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

Date: Mon, 07 Jul 2003 19:13:32 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Total Butt Heads in this news group
Message-Id: <Xns93B1CDAA6C3F8sdn.comcast@206.127.4.25>


Did you have difficulty comprehending the posting guidelines to which you 
were referred?

-- 
Eric
$_ =  reverse sort qw p ekca lre Js reh ts
p, $/.r, map $_.$", qw e p h tona e; print


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

Date: Tue, 08 Jul 2003 00:31:18 GMT
From: "Robert" <yyyy@yyy.com>
Subject: Re: Total Butt Heads in this news group
Message-Id: <qhoOa.241665$jp.6614957@twister.southeast.rr.com>

Bite me
"Eric J. Roode" <REMOVEsdnCAPS@comcast.net> wrote in message
news:Xns93B1CDAA6C3F8sdn.comcast@206.127.4.25...
>
> Did you have difficulty comprehending the posting guidelines to which you
> were referred?
>
> -- 
> Eric
> $_ =  reverse sort qw p ekca lre Js reh ts
> p, $/.r, map $_.$", qw e p h tona e; print




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

Date: Tue, 08 Jul 2003 00:22:36 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Using semicolon delimited autosplit  "perl -aF\;"
Message-Id: <3F0A0EC6.40901@rochester.rr.com>

C Marshall wrote:

> I haven't had any luck managing to autosplit on the semi colon
> character under AIX when putting my commandline options into a script.
> 
> i.e. whilst
> 
> echo "1;2;3"| perl -anl -F\; -e 'print "$F[1]"'
> 2
> 
> works correctly I cannot reproduce the effects in a script 
> 
> eg
> echo "1;2;3"| test.pl                          
> Use of uninitialized value in string at test.pl line 4, <> line 1 (#1)
>     
>     (W uninitialized) An undefined value was used as if it were
> already defined.  It was
>     interpreted as a "" or a 0, but maybe it was a mistake.  To
> suppress this
>     warning assign a defined value to your variables.
> 
> where test.pl is:
> #!/usr/bin/perl -awnl -F\;
> use diagnostics;
> 
> print "$F[1]";
> 
> 
> I've tried a variety of formats for the -F line e.g
> "\;"
> ""\;""
> "'\;'"
> ";"
> \073
> \x3A
> /\073/
> /\;/
> 
> etc. to no avail.
> 
> Any idea where I'm going wrong ?
> 
> perl, v5.6.0 built for aix
 ...


> Chris
 
Hmmmmm...seems to work fine under Windoze, with or 

without the \ in the -F; in the script shebang line.

Maybe it's some idiosyncrasy in AIX with 

shebang-line options?  Or with whatever shell you 

are using?  You might want to turn off

warnings, though, since if an input line does not
split into at least two pieces, you will get the
warning you got.

Since you are writing a script rather than doing
a 1-liner, why not just code out the loops and
the split?  Then you don't have to worry about
the vagaries of shebang line interpretation.

It is probably more of a Unix / shell issue than
a Perl issue.


-- 
Bob Walton



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

Date: Mon, 07 Jul 2003 21:00:21 -0400
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: Wanted: Help/Script to truncate mp3 files.
Message-Id: <HIoOa.47877$Il3.1352495@wagner.videotron.net>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Stephen Hurrell wrote:
> Hello.
> 
> I would like to learn how to write a script that would truncate a mp3 
> file to a given number of seconds of music. This is like what amazon 
> does for their song samples. I want it for just that reason.
> 
> Does anyone know of a script to do this or could give pointers to how to 
> write such a script? I have done a good amount of googling and CPAN but 
> nothing has really looked applicable for this task.

I've never done any audio processing, and this seems like a very ghetto-like approach, but most MP3 
players will handle incomplete audio nicely, especially since MP3's streamable and lag happens.

So... use any of the MP3 modules to find out the playing time, use the -s operator to find out the 
file size, then use the simple:

$new_size = $size * $desired_play_time / $play_time;

Then do some sanity checking on $new_size (and $play_time before the above calculation) and if all 
is well, truncate the file to $new_size.

I'm sure others might have more professional approaches, this is just my $0.02

Best of luck.

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE/ChepeS99pGMif6wRAo7kAKCVn/2MtL8UKdvt0thhuajibLTYGwCgg2xY
tYKwIqnRSPjLPeyvh8o3PHc=
=p6EY
-----END PGP SIGNATURE-----



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

Date: 07 Jul 2003 16:15:38 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Win32 hidden Perl program
Message-Id: <etod6gm2dbp.fsf@wormtongue.emschwar>

"David A" <noemail@replytogroup.com> writes:
> If I can't figure out how to create a non-modal window from Win32 Perl, I'll
> probably just fire up the user's default browser with a suitable web page.
> Still not ideal, but less intrusive than a MessageBox.

Wow, you have a funny idea of 'less intrusive'.  *shrug* whatever
works for your users, I suppose.

-=Eric
-- 
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
		-- Blair Houghton.


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

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


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