perl module to write on a var

L

Larry

Hi,

I've been using a perl module that writes binary data on a file...now
I would like to save this binary data on a var insted of on a file...the
following si the code:

my $_mp3 = MP3::Tag->new($file);

my $_id3v2 = $_mp3->new_tag("ID3v2");
$_id3v2->add_frame($key, $value);
$_id3v2->write_tag();

I'd rather save the data on a var kept in memory (I must not save the
data on a file!)

so is there anyway to have my $_mp3 = MP3::Tag->new($file); point to a
var?

thanks
 
Z

zhaowu

Hi,

I've been using a perl module that writes binary data on a file...now
I would like to save this binary data on a var insted of on a file...the
following si the code:

my $_mp3 = MP3::Tag->new($file);

my $_id3v2 = $_mp3->new_tag("ID3v2");
$_id3v2->add_frame($key, $value);
$_id3v2->write_tag();

I'd rather save the data on a var kept in memory (I must not save the
data on a file!)

so is there anyway to have my $_mp3 = MP3::Tag->new($file); point to a
var?

thanks

Unfortunately you don't have much control with MP3 module, so you'd
have to write the file first and then read it into a variable.
 
C

C.DeRykus

Hi,

I've been using a perl module that writes binary data on a file...now
I would like to save this binary data on a var insted of on a file...the
following si the code:

my $_mp3 = MP3::Tag->new($file);

my $_id3v2 = $_mp3->new_tag("ID3v2");
$_id3v2->add_frame($key, $value);
$_id3v2->write_tag();

I'd rather save the data on a var kept in memory (I must not save the
data on a file!)

so is there anyway to have my $_mp3 = MP3::Tag->new($file); point to a
var?
Probably not unless MP3::Tags'
docs hint otherwise. To be sure, you might want to look inside
the constructor itself:

perldoc -m MP3::Tag | perl -ne 'print if /^sub new/../^}/'
 
X

xhoster

C.DeRykus said:
Probably not unless MP3::Tags'
docs hint otherwise. To be sure, you might want to look inside
the constructor itself:

perldoc -m MP3::Tag | perl -ne 'print if /^sub new/../^}/'

The constructor hints that you can't, but it isn't exactly clear. All it
does is stuff the name into a hash. The actual open of any filehandle
based on the name passed to the constructor seems to be delegated 8 ways
from Sunday.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
 
C

C.DeRykus

Hi,

I've been using a perl module that writes binary data on a file...now
I would like to save this binary data on a var insted of on a file...the
following si the code:

my $_mp3 = MP3::Tag->new($file);

my $_id3v2 = $_mp3->new_tag("ID3v2");
$_id3v2->add_frame($key, $value);
$_id3v2->write_tag();

I'd rather save the data on a var kept in memory (I must not save the
data on a file!)

so is there anyway to have my $_mp3 = MP3::Tag->new($file); point to a
var?

If the MP3::Tag docs don't provide any hints, you can usually peek at
the constructor to see what's
possible:

perldoc -m MP3::Tag |
perl -ne'print if /^sub new/../^}/'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top